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
# | |
# mmm m m mmm mmm mmm mmmmm mmm | |
# " # "m m m" #" # # " #" "# # # # #" # | |
# m"""# #m#m# #"""" """m # # # # # #"""" | |
# "mm"# # # "#mm" "mmm" "#m#" # # # "#mm" | |
# | |
# nginx configuration For Ruby/Rack web applications | |
# | |
# Cooked up with style, care and a bit of *secret* | |
# nerdy spice. :-) |
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 AppBuilder < Rails::AppBuilder | |
include Thor::Actions | |
include Thor::Shell | |
def test | |
append_test_gems | |
rspec | |
cucumber | |
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 'benchmark' | |
5.times do |i| | |
i = 10 ** i | |
h = Hash[i.times.map { |z| [z, z] }] | |
puts "N KEYS: #{i}" | |
puts | |
Benchmark.bm do |x| | |
x.report('dup') { 1000.times { h.dup } } |
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
------------ From Rake Task | |
namespace :app do | |
# Checks and ensures task is not run in production. | |
task :ensure_development_environment => :environment do | |
if Rails.env.production? | |
raise "\nI'm sorry, I can't do that.\n(You're asking me to drop your production database.)" | |
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
module AdsenseHelper | |
# Author: Tomasz Mazur (defkode@gmail.com) | |
# http://www.mydigitallife.info/2009/01/17/google-adsense-legacy-old-generation-code-reference-generate-and-get/ | |
# :slot | |
# :theme | |
# :background | |
# :border | |
# :link | |
# :text |