Skip to content

Instantly share code, notes, and snippets.

Zhia Chong zhiachong

View GitHub Profile
View boxfile
api: &api
stack: node # remove this line
npm run-script test-local
daemon: node frozenyak/bin/www
npm install -g grunt-cli && grunt
env: &env
bash %{
sudo apt-get install nodejs
sudo apt-get install npm
sudo ln -s /usr/bin/nodejs /usr/bin/node #adds a symbolic link because most apps use node instead of nodejs
echo "Installed nodeJS: "
node -v
echo "Installed npm: "
npm -v
zhiachong / geotargeting.php
Created Jan 8, 2016
How to decouple GeoTargetWrapper from this function?
View geotargeting.php
public function getGeotargetingPopulationData($requestBody)
return parent::processMessage(
function () use ($requestBody)
if (empty($requestBody['geotargeting']) || empty($requestBody['impressions']))
throw new InvalidApiParameterException("Expecting geo-targeting and impressions.");
# Alot of these configs have been taken from the various places
# on the web, most from here
# Set the colours you can use
zhiachong / add.php
Last active Aug 29, 2015
Adding two numbers w/o arithmetic operator
View add.php
// my initial version
function add($x, $y)
$result = 0;
$i = 0; // the first bit to look at
$max = max($x, $y);
$msb = log($max, 2); // get the most signicant bit
$carry = 0;
You can’t perform that action at this time.