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 Invisibility | |
def activate | |
@visible = false | |
end | |
def deactivate | |
@visible = true | |
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
# example borrowed from Capybara.timeout | |
class Sleepy | |
def self.do_this(seconds = 1, &block) | |
start_time = Time.now | |
result = nil | |
until result | |
return result if result = yield |
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 'rubygems' | |
require 'json' | |
custom_fields = [ | |
{ :Key => 'memstatus', :Value => "{account_status}"}, | |
{ :Key => 'memtype', :Value => "{user.member_type}"}, | |
{ :Key => 'memsincedate', :Value => "{member_since.to_date}"}, | |
{ :Key => 'memrenewaldate', :Value => "{user.account.renewal_date.to_date}"}, | |
{ :Key => 'usertype', :Value => "{user_type}"}, | |
#{ :Key => 'neighborhood group', :Value => "#{neighborhood_groups.join('||')}", :DataType => 'Multi-Options'}, |
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
$:.unshift(File.dirname(__FILE__), ".") | |
require 'spec_helper' | |
module Butler | |
def self.included base | |
base.instance_eval { @place = [] } | |
end | |
def put_fork_on_the_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
require 'rubygems' | |
require 'sinatra/base' | |
class Bar < Sinatra::Base | |
set :static, true | |
set :public, File.join(File.dirname(__FILE__), 'bar/_site/') | |
get '' do |
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 'rubygems' | |
require 'sinatra' | |
Sinatra::Base.inline_templates = true | |
class App < Sinatra::Base | |
get '/' do | |
erb :index | |
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
parseInt(Date().split(" ")[4].split(":")[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
class Account | |
def initialize | |
@balance = 0 | |
end | |
def deposit amount | |
@balance += amount.as_money | |
end | |
def withdraw amount |
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 'minitest/autorun' | |
class Array | |
def zzzip(*args) | |
results = [] | |
i = 0 | |
each do |ary_element| | |
zipped_entry = args.inject([ary_element]) do |memo, element| | |
memo << element[i] | |
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 'rubygems' | |
require 'nokogiri' | |
require 'httparty' | |
require 'uri' | |
require 'pp' | |
class HtmlParserIncluded < HTTParty::Parser | |
SupportedFormats.merge!('text/html' => :html) | |
def html |