This file contains hidden or 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
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. |
This file contains hidden or 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
# 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 |
This file contains hidden or 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
abstract public class Cliente { | |
protected double saldo; | |
public Cliente(float saldo){ | |
this.saldo = saldo; | |
} | |
public void depositar(float valor){ | |
this.saldo = this.saldo + valor; | |
} |
This file contains hidden or 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
# 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 |
This file contains hidden or 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
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 |