Keep in mind that not all gems (versions) support a needed ruby version.
- Remove 1.8 gems: rcov, ruby-debug
- Add 1.9 gems: debugger
Try 'bundle install'.
words = ['qwerty', 'abcdef', 'xyzzyx'] | |
SecureRandom.stub(:base64) { words.shift } | |
SecureRandom.base64.should eq('qwerty') | |
SecureRandom.base64.should eq('abcdef') | |
SecureRandom.base64.should eq('xyzzyx') |
# ./Gemfile | |
source "http://rubygems.org" | |
gem "sinatra", "~> 1.3.1" | |
group :test do | |
gem "rspec", "~> 2.7.0" | |
gem "rack-test", "~> 0.6.1" | |
gem "fuubar", "~> 0.0.6" |
- if Rails.env.test? | |
:javascript | |
$.fx.off = true; |
// iframe auto-height | |
(function ($) { | |
$.fn.autoheight = function () { | |
return this.each(function () { | |
var iframe = $(this); | |
var height = iframe.contents().find('body').height() + 20; | |
iframe.height(height); | |
}); |
# Enforce that all models define their accessible attributes | |
config.active_record.whitelist_attributes = true |
# Change mass-assignment protection strategy to black-list to allow updates of virtual attributes | |
Delayed::Job.attr_protected nil |
# Problem 1 of 3: Math | |
# ==================== | |
# | |
# n! means n * (n - 1) * ... * 3 * 2 * 1 | |
# For example, 10! = 10 * 9 * ... * 3 * 2 * 1 = 3628800 | |
# Let R(n) equal the sum of the digits in the number n! | |
# For example, R(10) is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27. | |
# Find the lowest value for n where R(n) is 8001. | |
# | |
# Result: 787. |
# Monitor some background process on execution | |
watch -n 1 "ps aux | grep php" |
# Example for http://rungist.com/ | |
about = ".xobdnas ybur eht ni tsig s'buhtig a nur ot uoy swolla tI .ybuR yrT rehtonA teY eht si sihT" | |
"Hi, #{about.reverse}" |