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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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 Array | |
def to_proc | |
proc {|o| o.send(*self) } | |
end | |
end | |
# p (1..10).map{|i|i.divmod(2)} | |
p (1..10).map(&[:divmod,2]) | |
content = "Hello World" |
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
Spork.each_run do | |
require 'cucumber/rails/world' | |
require 'rr' | |
Cucumber::Rails::World.send(:include, RR::Adapters::RRMethods) | |
Before do | |
RR.reset | |
end | |
After 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
development: &global_settings | |
database: textual_development | |
host: 127.0.0.1 | |
port: 27017 | |
test: | |
database: textual_test | |
<<: *global_settings | |
production: |
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 "rack/openid" | |
require "warden" | |
use Rack::OpenID | |
use Warden::Manager do |manager| | |
Warden::Strategies.add(:openid) do | |
def authenticate! | |
if resp = env["rack.openid.response"] | |
case resp.status | |
when :success |
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
# include at least one source and the rails gem | |
source :gemcutter | |
gem 'rails', '~> 2.3.5', :require => nil | |
group :development do | |
# bundler requires these gems in development | |
gem 'rails-footnotes' | |
end | |
group :test 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
# world 外のパッケージを手動で remerge するときは emerge -av1 nss みたいにすると world に記録されなくていいですよ | |
dev-libs/nss | |
# USE=hal で emerge -avN world すれば勝手に入るはず | |
sys-apps/hal | |
# 最近は mlocate の方がいいらしいです | |
sys-apps/slocate | |
# emerge -av @module-rebuild で |
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 BowlongGameMacro | |
class BowlongGamePlayer | |
def initialize | |
@game = Game.new | |
end | |
def roll_spare |
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 User < ActiveRecord::Base | |
validates( | |
:email, | |
presence: true, | |
format: {with: VALID_EMAIL_REGEX}, | |
uniqueness: {case_sensitive: false} | |
) | |
end | |
class User < ActiveRecord::Base |
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
ken = 'けん' | |
prefixes = %w(さん くん ちゃん) | |
while (ken + (prefix = prefixes.sample)).size < 140 | |
ken << prefix | |
end | |
puts ken + '…' |
OlderNewer