Login

Tag "re"

Snippet List

Template filter to convert timecodes into links

This template filter, "jumptime" will find any timecodes in a chunk of text and convert them to links that can be used to jump a video player to that point. E.g., If there is the string "3:05", it will be converted into a link that can be used to jump to that point. This is similar to what youtube does. For information on how to implement, see Django's [custom template tag information](http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#howto-custom-template-tags). You'd use this with some javascript like this: `jQuery(document).ready(function(){ jQuery('a.jumpToTime').bind('click',function(){ player.sendEvent('PLAY'); player.sendEvent('SEEK', jQuery(this).attr('value')); }); });`

  • regex
  • time
  • re
  • timecode
Read More

Add rel=lightbox to all image-links

Add the attribute "rel='lightbox'" to all Links, if the target is an image. `<a href="/path/to/image.jpg">Image</a>` becomes `<a rel="lightbox" href="/path/to/image.jpg">Image</a>` Works for JPG, GIF and PNG Files.

  • filter
  • re
  • lightbox
  • regular-expression
Read More

Regular Expression Dictionary

Cute little dictionary-like object that stores keys as regexs and looks up items using regex matches. It actually came in handy for a project where keys were regexes on URLs.

  • regex
  • re
  • dict
Read More

3 snippets posted so far.