Chili 2.1 Released Today

UPDATE: Chili 2.2 has been released

Changes

  • Added support for line numbers (boolean option: lineNumbers)
  • Added a selection helper for Internet Explorer and Mozilla
  • Improved the PHP recipe for working fine with Safari too
  • Improved crossbrowser support

Links

Counting, repeating, and unique ids

Here are some micro jQuery plugins that implement JavaScript closures, for object oriented pleasure.

Repeat Something n Times

{[ .repeat | .hilite( =javascript= ) ]}

New Date Value (unique id)

{[ .newdate | .hilite( =javascript= ) ]}

Counter

{[ .counter | .hilite( =javascript= ) ]}

How to write a fast catch-all RegExp

In How to write a safe catch-all RegExp I suggested to use (?:w|W)* for matching any character in a regular expression. It’s certainly true and safe, and the same stands for its siblings (?:s|S)* and (?:d|D)*.

If you want to match a large text, these expressions are not the best. I’ve prepared a simple test page where the GeSHi’s engine file, which is almost 120KB, is going to be matched by the regular expression you input.

In Firefox 2 the performance is quite good, about 100 ms on my PC, but in Internet Explorer 7 it takes more than 7 minutes !!!

The best catch-all regular expression is [wW]*, which employs about 50 ms in FF2, and 0 ms in IE7 !!! (yes, zero milliseconds)