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
/** | |
* Adds ECMA-262 rev. 5 methods to Array prototype, if they are missing | |
* Please note that the global prototypes are updated, so only use this file | |
* if that is acceptable, or if you're running in an iframe | |
* | |
* Please not that this file WILL NOT BE COPYRIGHTED, as it merely wraps mozilla implementation | |
* of JavaScript 1.6 / ECMA-262 rev. 5 methods | |
* | |
* @author Morgan Roderick - morgan@roderick.dk | |
*/ |
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
/* | |
* callbackify | |
* | |
* Copyright (c) 2012 "Cowboy" Ben Alman | |
* Licensed under the MIT license. | |
* http://benalman.com/about/license/ | |
*/ | |
function callbackify(fn, args, done) { | |
// If the function arity exceeds args length, it's accepts a "done" callback. |
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 | |
/** | |
* Middleware to set correct header for JSON output. | |
* Very basic initial version, simply checks the body of the response to see if it is valid JSON. | |
* If response is not JSON then continues with default settings. | |
* If response is JSON then header is updated. | |
* | |
* @author Richard Styles | |
*/ | |
namespace App\Middleware; |
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
# script insstalls qemu and vagrant, then uses vagrant to build a qemu- | |
# supported rpi kernel for dev. | |
# - tested with 2015-02-16-raspbian-wheezy.zip on OSX El Capitan | |
# Variables | |
IMAGE=http://downloads.raspberrypi.org/raspbian_latest | |
IMG_PATH="/vagrant/raspbian_latest.img" | |
PI_LINUX=https://github.com/raspberrypi/linux | |
PI_LINUX_BRANCH="rpi-4.2.y" | |
PI_TOOLS=https://github.com/raspberrypi/tools |
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
add_filter( 'woocommerce_currencies', 'add_my_currency' ); | |
function add_my_currency( $currencies ) { | |
$currencies['ABC'] = __( 'Currency name', 'woocommerce' ); | |
return $currencies; | |
} | |
add_filter('woocommerce_currency_symbol', 'add_my_currency_symbol', 10, 2); | |
function add_my_currency_symbol( $currency_symbol, $currency ) { |
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 | |
use doctrine\ORM\EntityManagerInterface; | |
$entityManager->transactional(function (EntityManagerInterface $entityManager) { | |
// first transaction | |
$entityManager->transactional(function () { | |
// nested transaction #1 | |
}); |
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
#!/bin/bash | |
NODE_VERSION=0.4.7 | |
NPM_VERSION=1.0.94 | |
# Save script's current directory | |
DIR="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
#cd "${DIR}" | |
# |
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
#!/bin/bash | |
# REFERENCE: http://stackoverflow.com/a/1638397/1260526 | |
# Absolute path to this script, e.g. /home/user/bin/foo.sh | |
SCRIPT=$(readlink -f "$0") | |
# Absolute path this script is in, thus /home/user/bin | |
SCRIPTPATH=$(dirname "$SCRIPT") | |
echo $SCRIPTPATH |
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 cloneObject(object) { | |
return extendObject({}, object); | |
} | |
function extendObject(base, object) { | |
var visited = [object]; | |
// http://en.wikipedia.org/wiki/Adjacency_list_model | |
var set = [{value: base}]; |
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 install libvirt | |
sudo ln -s /opt/vagrant/embedded/include/ruby-2.0.0/{universal-darwin12.6.0,x86_64-darwin12.6.0} | |
ARCHFLAGS='-arch x86_64' \ | |
CONFIGURE_ARGS="with-libvirt-include=/usr/local/include/libvirt:/opt/vagrant/embedded//include/ruby-2.0.0/universal-darwin12.6.0/ with-libvirt-lib=/usr/local/lib" \ | |
vagrant plugin install vagrant-libvirt |
OlderNewer