<commit_before># Adaptive Evil Blocks

[Evil Blocks]:    https://github.com/ai/evil-blocks/
[matchMedia.js]:  https://github.com/paulirish/matchMedia.js/
[media queries]:  http://www.w3.org/TR/css3-mediaqueries/

Adaptive Evil Blocks is a filter that adds adaptivity to [Evil Blocks].
The [matchMedia.js] polyfill is used for old browsers.

The adaptivity is provided by the `@media` method powered by underlying
matchMedia API. So you can use [media queries] syntax.

## Installation

### Ruby on Rails

Add `adaptive-evil-blocks-rails` gem to `Gemfile`:

```ruby
gem "adaptive-evil-blocks-rails"
```

Add `adaptive-evil-blocks` to your scripts:

```js
//= require adaptive-evil-blocks
```

### Others
Add the `pkg/adaptive-evil-blocks.js` file to your project or install
the bower package:

```
bower install adaptive-evil-blocks
```

If you support old browsers, you may want to use the
`pkg/adaptive-evil-blocks.polyfilled.js` file.


## Usage

Run code once only if it matches a query:
```coffee
evil.block '@@block',

  init: -> ...
    @media '(max-width: 399px)', -> ...
    @media '(min-width: 400px)', -> ...

```

The `match` callback is executed every time on query match, the `mismatch`
callback is executed every time on query mismatch.

```coffee
evil.block '@@block',

  init: -> ...
    @media '(max-width: 399px), match: -> ...
    @media '(min-width: 400px), match: -> ...

    @media '(max-width: 399px), match: -> ... , mismatch: -> ...
    @media '(min-width: 400px), match: -> ... , mismatch: -> ...
```<commit_msg>Readme fixes<commit_after># Adaptive Evil Blocks

[Evil Blocks]:    https://github.com/ai/evil-blocks/
[matchMedia.js]:  https://github.com/paulirish/matchMedia.js/
[media queries]:  http://www.w3.org/TR/css3-mediaqueries/

Adaptive Evil Blocks is a filter that adds adaptivity to [Evil Blocks].
The [matchMedia.js] polyfill is used for old browsers.

The adaptivity is provided by the `@media` method powered by underlying
matchMedia API. So you can use [media queries] syntax.

## Installation

### Ruby on Rails

Add the `adaptive-evil-blocks-rails` gem to `Gemfile`:

```ruby
gem "adaptive-evil-blocks-rails"
```

Add `adaptive-evil-blocks` to your scripts:

```js
//= require adaptive-evil-blocks
```

### Others
Add the `pkg/adaptive-evil-blocks.js` file to your project or install
the bower package:

```
bower install adaptive-evil-blocks
```

If you support old browsers, you may want to use the
`pkg/adaptive-evil-blocks.polyfilled.js` file.


## Usage

Run code once only if it matches a query:
```coffee
evil.block '@@block',

  init: -> ...
    @media '(max-width: 399px)', -> ...
    @media '(min-width: 400px)', -> ...

```

The `match` callback is executed every time on query match, the `mismatch`
callback is executed every time on query mismatch.

```coffee
evil.block '@@block',

  init: -> ...
    @media '(max-width: 399px)', match: -> ...
    @media '(min-width: 400px)', match: -> ...

    @media '(max-width: 399px)', match: -> ... , mismatch: -> ...
    @media '(min-width: 400px)', match: -> ... , mismatch: -> ...
```
{'fraction_non_alphanumeric': 0.16801816412585144, 'fraction_numerical': 0.012974375608173857, 'mean_word_length': 3.386913229018492, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4165736', 'n_tokens_mistral': 1147, 'n_tokens_neox': 1013, 'n_words': 328}