This file contains hidden or 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 polygonIncludes = function(points) { | |
return function() { | |
var point = [this.grid_lat, this.grid_lng]; | |
var sides = points.length; | |
var map = function( elems, callback, arg ) { | |
var ret = [], value; | |
// Go through the array, translating each of the items to their | |
// new value (or values). | |
for ( var i = 0, length = elems.length; i < length; i++ ) { |
This file contains hidden or 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 Polygon | |
attr_reader :points | |
attr_reader :sides | |
def initialize(points) | |
@points = points | |
calculate_sides | |
end | |
def points=(points) |
This file contains hidden or 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
When /^all pending Resque jobs are processed$/ do | |
# run jobs | |
end |
This file contains hidden or 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() { | |
function objectToSpecIt(expectation, args) { | |
var args = $.makeArray(args), | |
matcherAndArgs = [args.shift()]; | |
$.each(args, function(i, item) { matcherAndArgs.push(item); }); | |
return SpecIt.expectations(this)[expectation].apply(this, matcherAndArgs); | |
} | |
function nativeShould() { return objectToSpecIt.call(this, "should", arguments); } | |
function nativeShouldNot() { return objectToSpecIt.call(this, "shouldNot", arguments); } |
This file contains hidden or 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
--type-add=ruby=.haml,.rake,.rsel,.builder | |
--type-add=html=.html.erb,.html.haml | |
--type-add=js=.js.erb | |
--type-add=css=.sass,.less | |
--type-set=cucumber=.feature | |
--ignore-dir=vendor | |
--ignore-dir=log | |
--ignore-dir=tmp | |
--ignore-dir=doc | |
--ignore-dir=coverage |
This file contains hidden or 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
--- | |
:backtrace: false | |
gem: --no-ri --no-rdoc | |
:sources: | |
- http://gemcutter.org | |
- http://gems.rubyforge.org/ | |
- http://gems.github.com | |
:benchmark: false | |
:update_sources: true | |
:verbose: true |
This file contains hidden or 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
Then /^I should see the following rows:$/ do |table| | |
assert_select "table" do | |
table.raw.each do |row| | |
assert_select "tr" do | |
row.each do |column| | |
assert_select "td", :text => column.to_s | |
end | |
end | |
end | |
end |
This file contains hidden or 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 time_distance(seconds = 0) | |
days, hours, minutes = 0,0,0 | |
in_days = seconds / (60*60*24) | |
days = in_days.floor | |
hours = ((in_days % days) * 24).floor | |
minutes = ((((in_days % days) * 24) % hours) * 60).floor | |
"#{days}d #{hours}h #{minutes}m" | |
end |
This file contains hidden or 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
# new IRB session, memcached 1.4.1 - looks like it marshalled the data incorrectly? | |
>> gem "memcache-client", "1.7.4" | |
=> true | |
>> require 'memcache' | |
=> true | |
>> mc = MemCache.new("localhost:11211") | |
=> <MemCache: 1 servers, ns: nil, ro: false> | |
>> | |
?> text = %( | |
get: ["Throttle:exp:"] |
This file contains hidden or 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 self.region(str, &blk) | |
self.class_eval(&blk) | |
end | |
end | |
class Joe < Person | |
def name; "Joe"; end | |
region "speaking" do |