brew install mongodb
Set up launchctl to auto start mongod
$ ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents
/usr/local/opt/mongodb/ is a symlink to /usr/local/Cellar/mongodb/x.y.z (e.g., 2.4.9)
| <?php | |
| /** | |
| * Merge two dimensional arrays my way | |
| * | |
| * Will merge keys even if they are of type int | |
| * | |
| * @param array $array1 Initial array to merge. | |
| * @param array ... Variable list of arrays to recursively merge. | |
| * |
| // | |
| // SVG — hasClass, addClass, removeClass, toggleClass | |
| // Source: | |
| // https://gist.github.com/branneman/8436956 | |
| // Taken and adapted from: | |
| // http://toddmotto.com/hacking-svg-traversing-with-ease-addclass-removeclass-toggleclass-functions/ | |
| // | |
| if (SVGElement && SVGElement.prototype) { |
| # to generate your dhparam.pem file, run in the terminal | |
| openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
Debounce a function when you want it to execute only once after a defined interval of time. If the event occurs multiple times within the interval, the interval is reset each time.
Example A user is typing into an input field and you want to execute a function, such as a call to the server, only when the user stops typing for a certain interval, such as 500ms.
When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:
var Article = require('../../../models/article');Those suck for maintenance and they're ugly.
Typing vagrant from the command line will display a list of all available commands.
Be sure that you are in the same directory as the Vagrantfile when running these commands!
vagrant init -- Initialize Vagrant with a Vagrantfile and ./.vagrant directory, using no specified base image. Before you can do vagrant up, you'll need to specify a base image in the Vagrantfile.vagrant init <boxpath> -- Initialize Vagrant with a specific box. To find a box, go to the public Vagrant box catalog. When you find one you like, just replace it's name with boxpath. For example, vagrant init ubuntu/trusty64.vagrant up -- starts vagrant environment (also provisions only on the FIRST vagrant up)| #!/bin/sh | |
| matches=$(git diff --cached | grep -E '\+.*?FIXME') | |
| if [ "$matches" != "" ] | |
| then | |
| echo "'FIXME' tag is detected." | |
| echo "Please fix it before committing." | |
| echo " ${matches}" | |
| exit 1 |