Turn on command line colors. Just do this:
git config color.ui true
Also, and this is a huge time saver: to stage all deleted for files for GIT deletion, simply call:
To find all rake tasks that are available:
rake -P | grep rake
If you want to reset the database (migrations & all), for example:
rake db:migrate:reset
I was having some problems installing mongodb. I did the following:
brew update
brew install mongodb
This proceeded just fine, could not symlink, with the error:
This is a quick writeup on how I get Rails & Angular up and running and working together, and how I set up the test environment so that I can test both back-end Rails as well as front-end JavaScript. This is a work in progress, and I make no guarantees to its accuracy or up-to-dateness.
I will walk through putting together a simple application shell running angular.js
together with a Rails-based back-end authentication system.
Angular.js is a powerful clientside JS framework that aims to enhance HTML for web applications. I think it already an excellent and feature-complete framework and it is only going to get better. But it is a new framework, and its documentation is currently in a state of flux, often riddled with outdated references to beta versions, and sometimes just damn confusing.
I struggled with understanding how to make a directive and after too many hours, I succeeded. I am writing up my thoughts on the matter here for my future self, and all who happen upon this gist.
In honor of the effort it took to learn how to build a proper directive in Angular, I will be creating a widget that I call a swear jar — an HTML element that may be included as any other element would — i.e., by writing `````` — and that, when clicked by a profane programmer, adds a dollar
Upgrading to ruby 2.0:
$ rvm remove 2.0.0 # get rid of unsuccessful installation
$ rvm get head --autolibs=3 # get the latest RVM and build required libs
$ rvm requirements # just in case, install all other required stuff
$ rvm install ruby-2.0.0
$ rvm --default use ruby-2.0.0
After installing the latest & greatest:
To have launchd start postgresql at login:
ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
Then to load postgresql now:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
Suppose you have an array of multiple (i.e., more than two) ruby arrays,
ary = [[1,2,3,4], [4,5,6,7], [8,9,10,11]]
To zip together these arrays in an element-wise fashion, we can use the array's zip
method:
zipped_ary = ary[0].zip(*ary.last(ary.size-1)) # => [[1,4,8], [2,5,9], [3,6,10], [4,7,22]]