Skip to content

Instantly share code, notes, and snippets.

View caffo's full-sized avatar

Rodrigo Franco caffo

View GitHub Profile
#!/bin/sh
## Information
## http://carlo-hamalainen.net/blog/2007/12/11/installing-minion-pro-fonts/
## http://www.ctan.org/tex-archive/fonts/mnsymbol/
## 0.1: Install LCDF Typetools
## http://www.lcdf.org/type/
## If you use Homebrew (http://mxcl.github.com/homebrew/), then uncomment:
# brew install lcdf-typetools
user = User.from_omniauth(env['omniauth.auth'])
session[:auth_token] = user.auth_token
----
user = User.from_omniauth(env['omniauth.auth'])
session[:auth_token] = user.auth_token
def flash_message
types = { :notice => 'success', :alert => 'error', :info => 'info' }
flash.inject("") do |sum, message|
content_tag :div, :class => "alert alert-#{types[message[0]]}" do
button_tag('×'.html_safe, :type => 'button', :class => 'close', :'data-dismiss' => 'alert', :name => nil) +
message[1]
end
end
end
@caffo
caffo / robot.js
Created December 5, 2012 17:25
10 GOTO 10
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(Math.floor(Math.random()*110));
rvm gemset create mailcatcher
rvm use mailcatcher
gem install mailcatcher
rvm wrapper 1.9.3@mailcatcher --no-prefix mailcatcher catchmail
def foobar
# sux :(
foo = String.new
@bar.each do |b|
foo << b.body
end
foo
end
@caffo
caffo / killpersonaldocs.js
Created May 28, 2012 18:10
Bookmarklet to delete all displayed items in a Personal Document listing in Amazon Kindle Library
javascript:(function(){ var v = new RegExp("PersonalDocuments"); if (!v.test(document.URL)) { return false; } {a=document.getElementsByClassName('rowBodyCollapsed');for(var i = 0; i<a.length; i++){Fion.deleteItem('deleteItem_'+a[i].getAttribute('asin'));};return; }})();
Não sei como é a receita original, mas o que eu fiz foi tirar um espresso e deixar ele esfriar na geladeira. Depois disso peguei um copo de 500ml, coloquei gelo e "Limonada do Bem" até completar uns 400ml. Adicionei umas 30 gotas de baunilha e virei o espresso gelado em cima.
@caffo
caffo / radio.rb
Created February 21, 2012 16:27
coding music radio stations d-_-b
#!/usr/bin/env irb -f --noverbose -r yaml -r open-uri --noprompt
YAML::load(open('http://is.gd/U4tpcO'))
exec("mpg123 #{_[ARGV[0]]}") unless _[ARGV[0]].nil?
unless := method(
(call sender doMessage(call message argAt(0))) ifFalse(
call sender doMessage(call message argAt(1))) ifTrue(
call sender doMessage(call message argAt(2)))
)
unless(1 == 2, write("One is not two\n"), write("one is two\n"))