Skip to content

Instantly share code, notes, and snippets.

View the-swerve's full-sized avatar

Jay R. Bolton - now @jayrbolton the-swerve

View GitHub Profile
// Using a constructor function + prototype property + "new"
var Fruit = function(shape) {
if (!this instanceof Fruit) return new Fruit()
this.shape = shape
return this
}
Fruit.prototype.taste = 'sweet'
data NestedList a = Elem a | List [NestedList a]
flatten = reverse . rec []
where
rec acc (List []) = acc
rec acc (Elem x) = x : acc
rec acc (List (x:xs)) = rec (rec acc x) (List xs)
@the-swerve
the-swerve / gist:6001409
Created July 15, 2013 16:36
Backup heroku db and transfer between production, staging, and localhost
# Get the add-on
heroku addons:add pgbackups -a staging_app_name
heroku addons:add pgbackups -a production_app_name
# Capture backups. Use --expire if your existing list is full.
heroku pgbackups:capture -a production_app_name
# Import production to localhost
curl -o latest.dump `heroku pgbackups:url -a production_app_name`
pg_restore --verbose --clean --no-acl --no-owner -h localhost -U local_psql_username -d development_db_name latest.dump