This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
var tags = "abbr|article|aside|audio|canvas|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video".split("|"); | |
for (var i = 0, tag; tag = tags[i]; i++) { document.createElement(tag); } | |
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Question | |
CHARS = ("a".."z").to_a | |
attr_accessor :description | |
attr_writer :right_answer, :chosen_answer | |
[:right_answer, :chosen_answer].each do |name| | |
class_eval <<-RUBY | |
def #{name}(*args) | |
@#{name} = args.first if args.any? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "active_record" | |
module Polite | |
BAD_WORDS = ["fuck", "asshole", "motherfucker", "cunt", "cock", "dickhead"] | |
ESCAPED = BAD_WORDS.collect {|word| Regexp.escape(word)} | |
RE = /(#{ESCAPED.join("|")})/i | |
def self.extended(base) | |
base.extend ClassMethods | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module App | |
extend self | |
def configure(&block) | |
yield config | |
end | |
def config | |
Config | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Message | |
def to(name) | |
@to = name | |
self | |
end | |
def from(name) | |
@from = name | |
self | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Message | |
def initialize(&block) | |
instance_eval(&block) if block_given? | |
end | |
def to(name) | |
@to = name | |
self | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def hello; end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "plist" | |
require "sqlite3" | |
APP_SUPPORT = File.expand_path("~/Library/Application Support") | |
PLIST_FILE = APP_SUPPORT + "/Keywurl/Keywords.plist" | |
CHROME_FILE = APP_SUPPORT + "/Google/Chrome/Default/Web Data" | |
plist = Plist.parse_xml(PLIST_FILE) | |
db = SQLite3::Database.new(CHROME_FILE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Allow table headers to be fixed on the top, | |
// with this beautiful and lovely hack. | |
// | |
// Usage: $("table").headify(); | |
// | |
// This CSS will get you started: | |
// | |
// .headified { width: 230px; } | |
// .headify-headers { list-style: none; margin: 0; overflow: hidden; padding: 0; } | |
// .headify-headers li { float: left; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global_gemfile = File.expand_path("~/.Gemfile") | |
eval File.read(global_gemfile), binding if File.exist?(global_gemfile) |