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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Custom jQuery Filter with Parameters</title> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> | |
<script type="text/javascript"> | |
(function($) { | |
$.expr[':'].hasTitle = function(elem, index, list) { | |
var params = eval("([" + list[2] + list[3] + list[2] + "])"); | |
for (var i = 0; i < params.length; i++) { |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>RegEx jQuery Filter</title> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> | |
<script type="text/javascript"> | |
(function($){ | |
$.expr[':'].regex = function(elem, index, match) { | |
var matchParams = match[3].split(','), | |
validLabels = /^(data|css):/, |
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 Object | |
def local_methods | |
parent = self.class.superclass | |
(parent ? self.methods - parent.instance_methods : self.methods).sort | |
end | |
alias_method :m, :local_methods | |
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 Person | |
def initialize(options = {}) | |
options.each do |key, value| | |
self.instance_variable_set(:"@#{key}", value) | |
self.class.send(:define_method, key) do | |
self.instance_variable_get(:"@#{key}") | |
end | |
self.class.send(:define_method, "#{key}=".intern) do |*args| |
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
syntax on | |
"font | |
color github | |
set cursorline | |
set guifont=Monaco:h12 | |
set guioptions-=T | |
set linespace=1 | |
set vb |
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
#!/usr/bin/env ruby | |
require 'yaml' | |
PAIR_EMAIL = "paired@developers.local" | |
AUTHORS = YAML.load(`cat ~/.pair.yml`) | |
unless File.exists?(".git") | |
puts "This doesn't look like a git repository." |
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
window.console = window.console || {}; | |
["log", "info", "debug", "warn", "error"].forEach(function(level) { | |
console[level] = console[level] || function(){} | |
}); |
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
desc "Checks the JavaScript files with JSLint" | |
task :jslint do | |
failed_files = [] | |
skipped_files = ["jquery-1.4.js", "jquery-json-2.1.js"] | |
rhino_path = File.join(RAILS_ROOT, "vendor", "jslint", "js.jar") | |
jslint_path = File.join(RAILS_ROOT, "vendor", "jslint", "jslint.js") | |
Dir['public/**/*.js'].reject{|path| skipped_files.include?(path.match(/.*\/(.*)/)[1])}.each do |name| | |
cmd = "java -jar #{rhino_path} #{jslint_path} #{name}" |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>name</key> | |
<string>GitHub</string> | |
<key>settings</key> | |
<array> | |
<dict> | |
<key>settings</key> |
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
var rows = ["alice apple", "bob banana", "charlie cherry", "alice date", "bob eggplant"]; | |
var mapped = rows.map(function(row) { | |
return row.split(" "); | |
}); | |
var reduced = mapped.reduce(function(hash, pair) { | |
var key = pair[0], | |
val = pair[1]; |