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
var util = require('util'); | |
var _ = require('lodash'); | |
var sinon = require('sinon'); | |
/** | |
* Replaces a query method on the given model object with a stub. The query | |
* will still operate on a callback, and allow full access to waterline's | |
* deferred object. However, the query will not cause any I/O and instead | |
* will immediately resolve to the given result. | |
* |
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
Prototype = { | |
create: function() { | |
var proto = Object.prototype; | |
var protoProperties = arguments[0] || {}; | |
if(arguments.length > 1) { | |
proto = arguments[0]; | |
protoProperties = arguments[1] || {}; | |
} | |
var prototypeObject = Object.create(proto); | |
for(var protoProperty in protoProperties) { |
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
<?php | |
/** | |
* This is project's console commands configuration for Robo task runner. | |
* | |
* @see http://robo.li/ | |
*/ | |
class RoboFile extends \Robo\Tasks | |
{ | |
use \Robo\Common\Timer; |
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
# Paste into .zshrc, with or without the alias: | |
function notify() { | |
printf "\x1b]9;%s\x7" "$*" | |
} | |
alias n="notify" | |
# Usage: | |
# notify Testing 1 2 3 | |
# |
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
<?php | |
/** | |
* Implements hook_menu(). | |
*/ | |
function MY_MODULE_menu() { | |
$items['MY_MODULE/redhen/contact/autocomplete'] = array( | |
'title' => 'Autocomplete for RedHen Contacts', | |
'page callback' => 'MY_MODULE_contact_autocomplete', | |
'access callback' => 'redhen_contact_access', |
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
brew cask install p4merge --force | |
git config --global merge.tool p4mergetool | |
git config --global mergetool.p4mergetool.cmd "$HOME/Applications/p4merge.app/Contents/Resources/launchp4merge \$PWD/\$BASE \$PWD/\$LOCAL \$PWD/\$REMOTE \$PWD/\$MERGED" | |
git config --global mergetool.keepBackup false | |
git config --global diff.tool p4mergetool | |
git config --global difftool.p4mergetool.cmd "$HOME/Applications/p4merge.app/Contents/Resources/launchp4merge \$LOCAL \$REMOTE" |
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
<?php | |
class RoboFile extends \Robo\Tasks | |
{ | |
/** | |
* Update site config by importing from a module's config directory. | |
* | |
* @param string $module Module name | |
* @param array $opts |
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
function getQueryParameters(queryString) { | |
queryString = (queryString || document.location.search).replace(/(^\?)/, ''); | |
var queryParams = {}; | |
if (queryString) { | |
var keyVals = queryString.split('&'); | |
for (var i = 0; i < keyVals.length; i++) { | |
var keyVal = keyVals[i].split('='); | |
queryParams[keyVal[0]] = decodeURIComponent(keyVal[1].replace(/\+/g, '%20')); |