Skip to content

Instantly share code, notes, and snippets.

humm?
class Truco
NAIPES = %w{Ouro Copas Espada Paus}
SPECIALS = %w{Zap SeteCopas Espadilha SeteOuro}
VALUES = %w{3 2 A K J Q 7 6 5 4}
end
class String
ACCIDENTS = {
:a => %w{ ã á â },
:e => %w{ é ê },
:i => %w{ í },
:o => %w{ õ ó ô },
:u => %w{ ú },
:c => %w{ ç }
}
def to_ascii
def <=>(other)
raise("Comparing a revision to #{other.class} is not supported") unless other.is_a? Revision
@number <=> other.number
end
# from cruisecontrol code...
# ruby = poem
require 'activesms'
class Noter < ActiveSms::Base
def emaio
@delivery = :email
@carrier = 'tim'
@recipients = '55555555'
@from = ''
@body = "Hello"
module Compile
def self.c
system "ruby ext/extconf.rb && cd ext && make"
end
end
class Autotest
Autotest.add_hook :ran_command do |a|
Compile::c
end
end
module SubtitleIt
module Sub2Srt
def Sub2Srt.convert(filename)
framerate = 23.976
infile = File.open(filename,'r')
read_mode = 0
for line in inn do |line|
line.strip!
@nofxx
nofxx / .autotest
Created October 5, 2008 09:55
RSpec 1.1.8 autospec only works with this...
Autotest.add_hook :initialize do |at|
at.clear_mappings
at.add_mapping(%r{^spec/.+_spec\.rb$}) do |filename,_|
filename
end
at.add_mapping(%r{^lib/< project folder!! >/(.+)\.rb$}) do |_,match|
[ "spec/< project folder!!!! >/#{match[1]}_spec.rb" ] +
at.files_matching(%r{^spec/integration/.+_spec\.rb$})
@nofxx
nofxx / deploy.rb
Created November 1, 2008 19:37
Cap Recipe
# #
# CAPISTRANO 2.5.0 DEPLOY
# GIT, Passenger, BackgrounDRB, Juggernaut
#
# Workflow:
# cap <stage> <task>
# cap <stage> deploy:setup
# cap <stage> deploy:cold
# . . .
# cap <stage> deploy