This file contains 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
size = size.map { |s| s.to_f } | |
aspect = size[0] > size[1] ? size[1]/size[0] : size[0]/size[1] | |
mould = thumb[0] > thumb[1] ? thumb[1] : thumb[0] | |
resize = [mould, aspect * mould] | |
resize = resize.reverse if size[1] > size[0] | |
This file contains 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
God.watch do |w| | |
w.name = "apache" | |
w.start = "apache2ctl -k start" | |
w.stop = "apache2ctl -k stop" | |
w.restart = "apache2ctl -k restart" | |
w.start_if do |start| | |
start.condition(:process_running) do |c| | |
c.interval = 10.seconds | |
c.running = false |
This file contains 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
development: | |
host: 192.168.0.1 | |
port: 389 | |
base: dc=gaiz,dc=com,dc=br | |
bind_dn: cn=admin,dc=gaiz,dc=com,dc=br | |
password: gaiz | |
test: | |
host: 127.0.0.1 | |
port: 389 |
This file contains 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
require 'rubygems' | |
require 'uri' | |
require 'net/http' | |
require 'net/https' | |
require 'hpricot' | |
uri = URI::parse("https://pagseguro.uol.com.br/Default.aspx") | |
http = Net::HTTP.new(uri.host, 443) | |
http.use_ssl = true |
This file contains 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 Testing | |
def test | |
10.times do |i| | |
print "Testing #{i}" | |
end | |
end | |
end | |
Testing.new.test |
This file contains 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
require 'parable' | |
p = Parable.new | |
x_start = 0 | |
y_start = 0 | |
p.point(x_start,y_start) | |
x_finish = 200 |
This file contains 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
sudo gem install knock-knock |
This file contains 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
require 'rubygems' | |
require 'knock_knock' | |
include Bubble::KnockKnock | |
Connection.instance.connect('[email protected]', 'password', 'cp') | |
Request.get('http://www.google.com/m8/feeds/contacts/email%40gmail.com/full') |
This file contains 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 Contact < ActiveRecord::Base | |
validates_presence_of :start_at, :message=>"<strong>Data de Ida</strong> deve ser preenchida corretamente." | |
validates_presence_of :finish_at, :message=>"<strong>Data de Volta</strong> deve ser preenchida corretamente." | |
validate :check_dates | |
def start_at=(start_at) | |
super(format_date(start_at)) | |
end |
This file contains 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
script/plugin install git://github.com/dookie/paperclip.git |
OlderNewer