This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
| #Deploy and rollback on Heroku in staging and production | |
| namespace :deploy do | |
| PRODUCTION_APP = 'YOUR_PRODUCTION_APP_NAME_ON_HEROKU' | |
| STAGING_APP = 'YOUR_STAGING_APP_NAME_ON_HEROKU' | |
| task :staging_migrations => [:set_staging_app, :push, :off, :migrate, :restart, :on, :tag] | |
| task :staging_rollback => [:set_staging_app, :off, :push_previous, :restart, :on] | |
| task :production_migrations => [:set_production_app, :push, :off, :migrate, :restart, :on, :tag] |
| #!/usr/bin/perl -w | |
| ############################################################################## | |
| ## | |
| ## Written by: Jared Cheney <[email protected]> | |
| ## | |
| ## Original Template written by: | |
| ## Brandon Zehm <[email protected]> and Jared Cheney <[email protected]> | |
| ## | |
| ## License: | |
| ## |
| #content | |
| = spinner_tag() | |
| :javascript | |
| jQuery.ready(function() { | |
| var pageView = new PageView(); | |
| pageView.render() | |
| }); | |
| val persons = Seq( | |
| Person(2000, 2010), | |
| Person(2000, 2005), | |
| Person(1990, 2005) | |
| ) | |
| // Create an array of population change. | |
| val births = persons.groupBy(_.birthYear).mapValues(_.length) | |
| val deaths = persons.groupBy(_.deathYear).mapValues(_.length) | |
| val populationChanges = (births.keySet ++ deaths.keySet).map { year => |
| persons.flatMap(p => Seq((p.birthYear, 1), (p.deathYear, -1))) | |
| .sorted | |
| .foldLeft((0,0,0)){case ((mxYear,mxPop,curPop), (thisYear,dif)) => | |
| if (curPop+dif > mxPop) (thisYear, curPop+dif, curPop+dif) | |
| else (mxYear, mxPop, curPop+dif) | |
| }._1 //res0: Int = 2000 |
Node Version Manager (https://github.com/nvm-sh/nvm) works perfectly across native node installations as well as emulated Rosetta installations. The trick I am using here is to install one LTS version of node under Rosetta and another stable version as native binary.