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
// 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' |
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
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) |
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 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 |