1.9.3-p385 :020 > title = Recipe.find(12934).title
=> "The River Café's Strawberry Sorbet"
1.9.3-p385 :021 > title.encode('ISO-8859-1', 'utf-8')
=> "The River Caf\xC3\xA9's Strawberry Sorbet"
1.9.3-p385 :022 > puts _
The River Café's Strawberry Sorbet
=> nil
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
1.8.7-p370 :008 > MICHAEL = "michael" | |
=> "michael" | |
1.8.7-p370 :009 > a = MICHAEL | |
=> "michael" | |
1.8.7-p370 :010 > a << " hoffman" | |
=> "michael hoffman" | |
1.8.7-p370 :011 > a | |
=> "michael hoffman" | |
1.8.7-p370 :012 > MICHAEL | |
=> "michael hoffman" |
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
def status | |
if self.reverted then | |
"Reverted" | |
elsif !self.ship_date then | |
"Open" | |
elsif (self.tracking_numbers.length == 0 and !self.shipping_cost_micros) then | |
"Processing (awaiting)" | |
else | |
self.ship_date > Date.today ? | |
"Processing" : |
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
SELECT COUNT(*) FROM `shipments` WHERE (status != 'delivered') | |
SELECT COUNT(*) FROM `shipments` WHERE (status IS NULL OR status != 'delivered') |
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
Model.find(1,2) == Model.find(2,1) | |
=> true | |
Model.find(1,2) == Model.find(2,1).reverse | |
=> 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
get '/' do | |
if !File.exist?('cache') || (File.mtime('cache') < (Time.now - 1800)) | |
puts "**********CACHE MISS**********" | |
data = erb(:index) | |
File.open('cache',"w"){ |f| f << data } | |
else | |
puts "**********CACHE HIT**********" | |
end | |
send_file 'cache', :type => 'html' | |
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
def check | |
ActiveRecord::Base.send(:subclasses).each do |klass| | |
if klass.column_names.include?(klass.table_name) | |
raise "#{klass.to_s}'s table name collides with column #{klass.table_name}" | |
end | |
end | |
puts "All Clear." | |
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
{ | |
:email=>"[email protected]", | |
:items=> | |
[ | |
{ | |
:qty=>2, | |
:title=>"Vintage Jam Serving Spoon", | |
:price=>1500, | |
:id=>253, | |
:url=>"http://food52.dev/provisions/products/143-vintage-jam-serving-spoon", |
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
### Keybase proof | |
I hereby claim: | |
* I am hoffm on github. | |
* I am hoffm (https://keybase.io/hoffm) on keybase. | |
* I have a public key whose fingerprint is 3431 91FF 4C06 135F 33FC 1E8A 1828 FE50 861D 0EBF | |
To claim this, I am signing this object: |
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
Domain Name: TANE.US | |
Domain ID: D6470007-US | |
Sponsoring Registrar: GODADDY.COM, INC. | |
Sponsoring Registrar IANA ID: 146 | |
Registrar URL (registration services): whois.godaddy.com | |
Domain Status: clientDeleteProhibited | |
Domain Status: clientRenewProhibited | |
Domain Status: clientTransferProhibited | |
Domain Status: clientUpdateProhibited | |
Variant: TANE.US |
OlderNewer