Instantly share code, notes, and snippets.

View go.rb
require "go/gtp/board"
require "cutest"
setup do
string = <<-EOS.gsub(/^ {2}/, "")
A B C D E F G H J
9 . . . . . . . . . 9
8 . . . . . . . . . 8
7 . . X . . . + . . 7
6 . . . . . . . . . 6
View sample.rb
require "redis"
require "nest"
redis = Redis.new
users = Nest.new(:users, redis)
posts = Nest.new(:posts, redis)
user = users[users.incr]
user.hmset(:name, "Albert")
View slug.rb
module Slug
def to_param
"#{super}-#{slug}"
end
def slug
to_s.gsub("'", "").gsub(/\p{^Alnum}/u, " ").strip.gsub(/\s+/, "-").downcase
end
end
View url.rb
class NilClass
def to_param
"all"
end
end
class Symbol
alias to_param to_s
end
View gist:163707
class Ssh < Thor
desc "copy", "Copies the public key to a remote server"
def copy(server)
system %Q{cat ~/.ssh/id_dsa.pub | ssh #{server} "cat >> ~/.ssh/authorized_keys"}
end
end