If one was inclined to use the acts_as_yaffle pattern, they would probably use the second one, rather than the heavily cargo-culted first one.
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
require 'fileutils' | |
require 'sqlite3' | |
require 'uri' | |
require 'net/http' | |
require 'set' | |
require 'thread' | |
chrome_history_location = "#{ENV['HOME']}/Library/Application\ Support/Google/Chrome/Default/History" | |
temp_location = "/tmp/Chrome_history" | |
FileUtils.cp(chrome_history_location, temp_location) |
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 total_price | |
tp = Money.new(0.0, appropriate_package.base_price_currency) | |
puts "tp = #{tp.currency} #{tp.inspect}" | |
addon_packages.each do |pkg| | |
puts "pkg.base_price = #{pkg.base_price.currency} #{pkg.base_price}" | |
tax = pkg.tax_price(state_or_province).exchange_to(appropriate_package.base_price_currency) | |
puts "pkg.tax_price(state_or_province) = #{tax.currency} #{tax}" | |
tp += pkg.base_price.exchange_to(appropriate_package.base_price_currency) + tax | |
puts "tp = #{tp.currency} #{tp.inspect}" | |
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
# For "Classic" style/top-level type of apps do something like: | |
# | |
# configure :development do | |
# require File.join(File.dirname(__FILE__), 'sinatra_reloader') | |
# set :reload_paths, [File.join(File.dirname(__FILE__), '**', '*.rb')] | |
# end | |
# | |
# For "Modular" style/Sinatra::Base subclasses: | |
# | |
# configure :development do |
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
# | |
# Created by Eric Lindvall <[email protected]> | |
# | |
# WHAT: Provides a simple overview of memory allocation occuring during a | |
# require. | |
# | |
# For a longer explanation, see my post at: | |
# | |
# http://bitmonkey.net/post/308322913/tracking-initial-memory-usage-by-file-in-ruby | |
# |
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 star_sign | |
# 1980 is a leap year, so we're safe for Feb 29 people | |
# date ranges are according to wikipedia | |
case Date.new(1980, birthday.month, birthday.day) | |
when Date.new(1980, 1, 21)..Date.new(1980, 2, 18): "Aquarius" | |
when Date.new(1980, 2, 19)..Date.new(1980, 3, 20): "Pisces" | |
when Date.new(1980, 3, 21)..Date.new(1980, 4, 20): "Aries" | |
when Date.new(1980, 4, 21)..Date.new(1980, 5, 21): "Taurus" | |
when Date.new(1980, 5, 22)..Date.new(1980, 6, 21): "Gemini" | |
when Date.new(1980, 6, 22)..Date.new(1980, 7, 22): "Cancer" |
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 following_pages | |
twitter_user.friends_count.to_i / 100 + 1 | |
end | |
def following | |
@following ||= (1..following_pages).map do |i| | |
twitter.friends_for(uid, :page => i, :lite => true) | |
end.flatten | |
end | |