Skip to content

Instantly share code, notes, and snippets.

@nata79
nata79 / gist:8372600
Created January 11, 2014 15:54
Rust traits method overloading (does not compile)
trait BalancedEater {
fn eat(&self) -> Self;
}
trait CrazyEater {
fn eat(&self) -> Self;
}
struct CookiesMonster {
cookies: int,
class App
def initialize
router.get '/sparta' do
[200, { 'Content-Type' => 'text/plain' }, ["This is Rack!"]]
end
router.get '/knock' do
[200, { 'Content-Type' => 'text/plain' }, ["Who's there?"]]
end
end
group :test do
# ...
gem 'timecop'
end
@nata79
nata79 / database.yml
Created October 19, 2012 11:32
database.yml for appfgo
production:
adapter: postgresql
encoding: unicode
pool: 5
timeout: 5000
host: <%= JSON.parse( ENV['VCAP_SERVICES'] )['postgres'].first['credentials']['hostname'] rescue 'localhost' %>
port: <%= JSON.parse( ENV['VCAP_SERVICES'] )['postgres'].first['credentials']['port'] rescue 3306 %>
database: <%= JSON.parse( ENV['VCAP_SERVICES'] )['postgres'].first['credentials']['name'] rescue '' %>
username: <%= JSON.parse( ENV['VCAP_SERVICES'] )['postgres'].first['credentials']['username'] rescue '' %>
password: <%= JSON.parse( ENV['VCAP_SERVICES'] )['postgres'].first['credentials']['password'] rescue '' %>