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 'sinatra' | |
require 'sinatra/bundles' | |
stylesheet_bundle(:all, %w(reset fonts grid)) | |
javascript_bundle(:all, %w(jquery lightbox blog)) | |
get '/' do | |
'sinatra-bundles rocks!' | |
end |
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 'digest/md5' | |
module Rack | |
# Automatically sets the ETag header on all String bodies | |
class ETag | |
def initialize(app) | |
@app = app | |
end | |
def call(env) |
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
source 'http://gemcutter.org' | |
gem 'rack', '1.1.0' | |
gem 'sinatra', '1.0.a', :require_as => 'sinatra/base' | |
gem 'haml' | |
gem 'builder' | |
gem 'i18n' | |
gem 'activerecord', '2.3.5', :require_as => 'active_record' | |
gem 'activesupport', '2.3.5', :require_as => 'active_support' | |
gem 'sinatra-bundles', :require_as => 'sinatra/bundles' |
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
source 'http://gemcutter.org' | |
gem 'rack', '>= 1.1.0' | |
gem 'sinatra', '1.0.a', :require_as => 'sinatra/base' | |
gem 'haml' | |
gem 'builder' | |
gem 'i18n' | |
gem 'activesupport', '2.3.5', :require_as => 'active_support' | |
gem 'activerecord', '2.3.5', :require_as => 'active_record' | |
gem 'sinatra-bundles', :require_as => 'sinatra/bundles' |
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
(function(open) { | |
XMLHttpRequest.prototype.open = function(method, url, async, user, pass) { | |
// Do some magic | |
open.call(this, method, rewrittenUrl, async, user, pass); | |
}; | |
})(XMLHttpRequest.prototype.open); |
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
$ ruby -v | |
ruby 1.8.7 (2009-12-24 patchlevel 248) [x86_64-darwin10.0.0], MBARI 0x6770, Ruby Enterprise Edition 2010.01 | |
$ ruby -rrbconfig -e "p Config::CONFIG['CFLAGS']" | |
"-g -O2 -arch x86_64 -pipe -fno-common " |
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
#!/usr/bin/env ruby | |
require 'growl' | |
require 'tweetstream' | |
require 'choice' | |
require 'ftools' | |
require 'restclient' | |
def returning(obj) | |
yield(obj) |
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
function GithubBadge(json) { | |
if (json) { | |
var badge = new Object(); | |
badge['username'] = json.user.login; | |
badge['repos'] = _.select(json.user.repositories, function(r) { | |
return !r.fork && '' != r.description; | |
}).sort(function() { | |
return (Math.round(Math.random()) - 0.5); | |
}).slice(0, 12); | |
$('#github-badge').html(Jaml.render('github-badge', badge)); |
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
db.values.mapReduce(function() { | |
emit(1, this.value * 2); | |
}, function(key, values) { | |
var sum = 0; | |
values.forEach(function(v) { | |
sum += v; | |
}); | |
return sum; | |
}, { | |
query: { |
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
{ | |
"context" : "Intro welcome", | |
"0" : 1278, | |
"25" : 1168, | |
"50" : 956, | |
"75" : 830, | |
"100" : 721, | |
"total" : 4953, | |
"0%" : 25.802543912780134, | |
"25%" : 23.581667676155867, |