Skip to content

Instantly share code, notes, and snippets.

* {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
#tools {
list-style: none;
margin: 4px 0px 0px 10px;
padding: 0;
@jgv
jgv / gist:2430270
Created April 20, 2012 16:55 — forked from marcel/gist:2100703
giftube – Generates an animated gif from a YouTube url.
#!/usr/bin/env ruby
# giftube – Generates an animated gif from a YouTube url.
#
# Usage:
#
# giftube [youtube url] [minute:second] [duration]
#
# ex.
#
@jgv
jgv / gist:1502777
Created December 20, 2011 19:03 — forked from trevorturk/gist:34895
Allow "uploads via url" with Rails and Paperclip
#
# See also: http://almosteffortless.com/2008/12/11/easy-upload-via-url-with-paperclip/
#
# Allow "uploads via url" with Rails and Paperclip
#
# http://www.thoughtbot.com/projects/paperclip
# http://github.com/thoughtbot/paperclip/tree/master
# http://groups.google.com/group/paperclip-plugin/browse_thread/thread/456401eb93135095
#
# This example is designed to work with a "Photo" model that has an "Image" attachment
Single-line version of pattern:
(?i)\b((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))
Extended version of same pattern:
(?xi)
\b
( # Capture 1: entire matched URL