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 "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 |
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 "redis" | |
require "nest" | |
redis = Redis.new | |
users = Nest.new(:users, redis) | |
posts = Nest.new(:posts, redis) | |
user = users[users.incr] | |
user.hmset(:name, "Albert") |
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
module Slug | |
def to_param | |
"#{super}-#{slug}" | |
end | |
def slug | |
to_s.gsub("'", "").gsub(/\p{^Alnum}/u, " ").strip.gsub(/\s+/, "-").downcase | |
end | |
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
class NilClass | |
def to_param | |
"all" | |
end | |
end | |
class Symbol | |
alias to_param to_s | |
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
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 |
NewerOlder