Skip to content

Instantly share code, notes, and snippets.

View foca's full-sized avatar

Nicolás Sanguinetti foca

View GitHub Profile
@foca
foca / gist:55907
Created February 1, 2009 17:02 — forked from sinatra/gist:55898
# This method is heavily adapted from the Rails method of determining the subdomain.
require 'rubygems'
require 'sinatra'
helpers do
def subdomains(tld_len=1) # we set tld_len to 1, use 2 for co.uk or similar
@subdomains ||= if (!request.host.nil? &&
/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.match(request.host))
request.host.split('.')[0...(1 - tld_len - 2)]
else
Integrity.new "config/config.yml" do |app|
DataMapper.logger = app.logger = Integrity.logger
run app
end
module Sinatra
module CuackExtension
def cuack(something)
get "/#{something}" do
"cuack!"
end
end
end
register CuackExtension
require "sinatra"
require "sinatra/rendering"
render_with :haml
get "/" do
render :homepage
end
get "/some-ajax-action", :provides => "application/javascript" do
# entp.rb
# from Jeremy McAnally
plugin 'context', :git => 'git://github.com/jeremymcanally/context.git'
plugin 'matchy', :git => 'git://github.com/jeremymcanally/matchy.git'
plugin 'rr', :git => 'git://github.com/btakita/rr.git'
plugin 'machinist', :git => 'git://github.com/notahat/machinist.git'
plugin 'storyteller', :git => 'git://github.com/foca/storyteller.git'
plugin 'webrat', :git => 'git://github.com/brynary/webrat.git'
foca ~/.rake-compiler/sources/sqlite3-ruby (git: master)
▸ rake cross compile RUBY_CC_VERSION=1.8.6
(in /Users/foca/.rake-compiler/sources/sqlite3-ruby)
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/gempackagetask.rb:13:Warning: Gem::manage_gems is deprecated and will be removed on or after March 2009.
mkdir -p vendor/sqlite3/lib
cd vendor
--2009-04-04 03:50:37-- http://www.sqlite.org/sqlitedll-3_6_6_2.zip
Resolving www.sqlite.org... 67.18.92.124
Connecting to www.sqlite.org|67.18.92.124|:80... connected.
HTTP request sent, awaiting response... 200 OK
diff --git a/lib/bob/builder.rb b/lib/bob/builder.rb
index a316799..b5c2ea3 100644
--- a/lib/bob/builder.rb
+++ b/lib/bob/builder.rb
@@ -5,6 +5,7 @@ module Bob
def initialize(buildable, commit_id)
@buildable = buildable
@commit_id = commit_id
+ @build_status = nil
@build_output = nil
def __ROOT__
File.expand_path(File.dirname(__FILE__) + "/../")
end
require "test/unit"
require "contest"
require "matchy"
require "rr"
begin
class Test::Unit::TestCase
def self.setup(&block)
include module_with_callback(:setup, &block)
end
def self.teardown(&block)
include module_with_callback(:teardown, &block)
end
def self.global_setup(&block)
@foca
foca / integrity_notifiers.rb
Created May 16, 2009 08:28
some ideas for notifications in integrity
module Integrity
module Notifiers
def self.notify(&block)
block.call(Notificator.new)
end
def self.register(name, notifier)
notifiers[name.to_s] = notifier
end