Skip to content

Instantly share code, notes, and snippets.

View reu's full-sized avatar

Rodrigo Navarro reu

View GitHub Profile
@reu
reu / .zshrc
Created October 20, 2011 18:11 — forked from bernardeli/.zshrc
highlighting code for keynote with highlight
first: brew install highlight
second: add to your .zshrc (or .bashrc)
function hlr {
highlight --syntax ruby -k Menlo -K 20 -s edit-xcode $1 | pbcopy
}
third: paste the highlighted code to your Keynote talk.
# encoding: UTF-8
module ApplicationHelper
def sharing_on_social_networks(subject)
social_networks = {}
social_networks[:twitter] = "http://twitter.com/share?text=Estou vendo #{truncate(subject, :length => 60)} na página da Soulfitness. Veja também em&url=http://www.soulfitness.com.br"
String.new.html_safe.tap do |output|
social_networks.each_pair do |key, value|
output << link_to(image_tag(key.to_s + ".png", :width => 21, :height => 21), value, :class => key, :target => "_blank")
end
end
abstract public class Cliente {
protected double saldo;
public Cliente(float saldo){
this.saldo = saldo;
}
public void depositar(float valor){
this.saldo = this.saldo + valor;
}
@reu
reu / video.rb
Created February 23, 2011 16:24
# encoding: UTF-8
require "open-uri"
class Video < ActiveRecord::Base
class YoutubeVideoValidator < ActiveModel::Validator
def validate(record)
unless record.youtube_code.include? 'youtube.com/watch?v='
record.errors[:base] << "URL não é um endereço válido de um vídeo do youtube"
end
end
class NewYachtModel < ActiveRecord::Base
belongs_to :new_yacht
has_many :contents, :class_name => 'NewYachtTopicContent'
has_many :topics, :class_name => 'NewYachtTopic', :through => :contents
accepts_nested_attributes_for :contents
end
class NewYachtTopic < ActiveRecord::Base