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
# Free RESTful interface for your Ruby objects with Rackable | |
# http://github.com/madx/rackable/tree/master | |
# | |
# + Free HTTP caching with rack-cache | |
# http://github.com/rtomayko/rack-cache/tree/master | |
require 'rackable' | |
require 'rack/cache' | |
APP_ROOT = File.dirname(__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
#!/usr/bin/env ruby | |
def usage | |
puts "./pair [name] [name]: pair two people (set the user in git)" | |
puts "./pair reset: revert to default settings" | |
exit | |
end | |
if ARGV.size == 2 | |
pair = [ARGV[0], ARGV[1]] |
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
/* Ismael Celis 2010 | |
Simplified WebSocket events dispatcher (no channels, no users) | |
var socket = new ServerEventsDispatcher(); | |
// bind to server events | |
socket.bind('some_event', function(data){ | |
alert(data.name + ' says: ' + data.message) | |
}); |
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 SectionHelpers | |
def selector_of_section(section_name) | |
case section_name | |
when 'recent podcasts' | |
[:css, 'ul.podcasts'] | |
when /^the row containing "[\"+]"$/ | |
[:xpath, "//*[.='#{$1}']/ancestor::tr"] | |
else | |
raise "Can't find mapping from \"#{section_name}\" to a section." | |
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
// Ghetto fabulous template system for replacing values in strings. If {{.foo}} | |
// or {{.bar[0].baz}} is encountered (leading . or ( or [ char), attempt to | |
// access properties of data object like `data.foo` or `data.bar[0].baz`. | |
// Alternately, if {{foo}} or {{bar("baz")}} is encountered (no leading dot), | |
// simply evaluate `foo` or `bar("baz")`. If an error occurs, return empty | |
// string. Oh yeah, you have to pass the result of ghettoTmpl to eval. :) | |
function ghettoTmpl(data, str) { | |
ghettoTmpl._data = data; | |
ghettoTmpl._str = str; |
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
find . -exec iconv -t UTF-8 {} \; |
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
/** | |
* jQuery.support.cssProperty | |
* To verify that a CSS property is supported (or any of its browser-specific implementations) | |
* | |
* @param string p - css property name | |
* [@param] bool rp - optional, if set to true, the css property name will be returned, instead of a boolean support indicator | |
* | |
* @Author: Axel Jack Fuchs (Cologne, Germany) | |
* @Date: 08-29-2010 18:43 | |
* |
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
# Put this file under Rails.root /lib | |
class CssColourValidator < ActiveModel::EachValidator | |
def validate_each(record, attribute, value) | |
return false unless value | |
record.errors[attribute] << (options[:message] || 'is not a valid CSS colour') unless ::HexadecimalColourValidator.matches?(value) or ::WebSafeColourValidator.matches?(value) | |
end | |
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
// Destroys the localStorage copy of CSS that less.js creates | |
function destroyLessCache(pathToCss) { // e.g. '/css/' or '/stylesheets/' | |
if (!window.localStorage || !less || less.env !== 'development') { | |
return; | |
} | |
var host = window.location.host; | |
var protocol = window.location.protocol; | |
var keyPrefix = protocol + '//' + host + pathToCss; |
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
Capybara.register_driver :selenium do |app| | |
Capybara::Selenium::Driver # this line ensures that the top level Selenium module is loaded | |
profile = Selenium::WebDriver::Firefox::Profile.new | |
profile.add_extension File.expand_path "spec/support/vendor/firebug-1.8.4-fx.xpi" | |
profile.add_extension File.expand_path "spec/support/vendor/fireStarter-0.1a6.xpi" | |
profile.add_extension File.expand_path "spec/support/vendor/netExport-0.8b20.xpi" | |
# Configures Firebug - look at http://getfirebug.com/developer/api/firebug1.6/symbols/src/defaults_preferences_firebug.js.html | |
profile['extensions.firebug.currentVersion'] = "1.8.4" # avoid 'first run' tab | |
profile["extensions.firebug.previousPlacement"] = 1 |
OlderNewer