Skip to content

Instantly share code, notes, and snippets.

View caffo's full-sized avatar

Rodrigo Franco caffo

View GitHub Profile
module ActionControllerExtensions
def self.included(base)
base::Dispatcher.send :include, DispatcherExtensions
end
module DispatcherExtensions
def self.included(base)
base.send :before_dispatch, :set_session_domain
end
module ActionControllerExtensions
def self.included(base)
base::Dispatcher.send :include, DispatcherExtensions
end
module DispatcherExtensions
def self.included(base)
base.send :before_dispatch, :set_session_domain
end
# OfflineIMAP config for GMail backup (only tested on OS X)
# Save it as ~/.offlineimaprc
# NB: this will sync *everything*, including All Mail, Spam, Bin, etc.
[general]
metadata = ~/.offlineimap
accounts = GMail
maxsyncaccounts = 1
# You might want to change the below to ui = TTY.TTYUI the first time you run offlineimap
# It can choke on large attachments and GMail might reset the connection if you download too much
100%[==================================================================================================================>] 608,462 12.3K/s in 34s
2010-09-17 15:28:54 (17.5 KB/s) - `/tmp/caffo-passenger-standalone-7527/nginx-0.7.67.tar.gz' saved [608462/608462]
Installing Phusion Passenger Standalone...
/Users/caffo/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/erb.rb:719: command not found: /Users/caffo/.rvm/wrappers/ruby-1.8.7-p249%global/ruby /Users/caffo/.rvm/gems/ruby-1.8.7-p249%global/bin/rake package:filelist --silent
/Users/caffo/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/erb.rb:719: command not found: /Users/caffo/.rvm/wrappers/ruby-1.8.7-p249%global/ruby /Users/caffo/.rvm/gems/ruby-1.8.7-p249%global/bin/rake nginx CACHING=no --dry-run
/Users/caffo/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/1.8/erb.rb:719: command not found: /Users/caffo/.rvm/wrappers/ruby-1.8.7-p249%global/ruby /Users/caffo/.rvm/gems/ruby-1.8.7-p249%global/bin/rake nginx CACHING=no --trace STDERR_TO_STDOUT=1
@caffo
caffo / radio.rb
Created November 1, 2010 15:05
oneliner radio
#!/usr/bin/env ruby
stations = {
'atmos' => 'http://89.179.179.5:8107/',
'goth' => 'http://85.25.184.19:7500/',
'goa' => 'http://87.230.21.161:6666/',
'heavy' => 'http://www.anothercog.com:8000/'
}
stations[ARGV[0]].nil? ? stations.each{|s| p s} : exec("mpg123 #{stations[ARGV[0]]}")
<style type='text/css'>
body {
background-color: #ccc;
}
* {
padding: 10px;
}
.header{
width: 86%;
left: 7%
@caffo
caffo / tower.asm
Created February 22, 2011 19:22
byte-code tower algorithm solver
;; byte-code tower algorithm solver
000000 0 1 2 3 4 5 6 7 8 9 0 1 D: 0
000000 1 0 0 0 0 1 2 3 4 5 6 * X: 0
000000 2 0 0 1 1 2 3 4 5 6 7 0 L: 0
000000 3 0 0 2 2 3 4 5 6 7 8 0 P: 0
000000 4 P 1 P 3 4 5 6 7 8 9 0
000000 5 E E E E E P E E P E 0
000000 6 X X X X X X X X X X 0
000000
@caffo
caffo / instakindle.rb
Created June 25, 2011 05:15
Simple script to trigger the 'send to kindle' button on Instapaper
#!/usr/bin/env ruby
require 'rubygems'
require 'mechanize'
mecha = Mechanize.new { |agent| agent.user_agent_alias = 'Mac Safari' }
login = mecha.get("http://www.instapaper.com/user/login")
login.form_with(:action => '/user/login') do |f|
f.username = "instapaper@username.com"
@caffo
caffo / gist:1150535
Created August 17, 2011 00:38
subscription_error
{
[["subscription","A coupon is already associated with this subscription."]]
}
@caffo
caffo / new_coupon.json
Created August 17, 2011 00:39
new_coupon.json
{
"coupon" :{
"name": "25% off",
"code": "25OFF",
"description": "25% off for life",
"percentage": "25",
"allow_negative_balance": "false",
"recurring": "false",
"end_date": "2012-08-29T12:00:00-04:00"
}