Skip to content

Instantly share code, notes, and snippets.

View darkhelmet's full-sized avatar
🏠
Working from home

Daniel Huckstep darkhelmet

🏠
Working from home
View GitHub Profile
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
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)
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'
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'
(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);
$ 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 "
#!/usr/bin/env ruby
require 'growl'
require 'tweetstream'
require 'choice'
require 'ftools'
require 'restclient'
def returning(obj)
yield(obj)
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));
db.values.mapReduce(function() {
emit(1, this.value * 2);
}, function(key, values) {
var sum = 0;
values.forEach(function(v) {
sum += v;
});
return sum;
}, {
query: {
{
"context" : "Intro welcome",
"0" : 1278,
"25" : 1168,
"50" : 956,
"75" : 830,
"100" : 721,
"total" : 4953,
"0%" : 25.802543912780134,
"25%" : 23.581667676155867,