Skip to content

Instantly share code, notes, and snippets.

@xat
xat / gist:5690206
Last active December 17, 2015 23:38
<?php
function setter($val) {
return function(&$val) use ($val) {}
};
$fooSetter = setter('foo');
$fooSetter($x);
@xat
xat / gist:6141235
Last active December 20, 2015 13:49
<?php
function treeWalker($fnCallback, $strTable, $intStart=0, $orderBy='pid, sorting')
{
$arrItemsByPid = array();
$arrItems = \Database::getInstance()->execute('SELECT * FROM ' . $strTable . ' ORDER BY ' . $orderBy)->fetchAllAssoc();
$strResult = '';
foreach($arrItems as $arrItem)
var page = require('webpage').create(),
system = require('system'),
address, output, size;
if (system.args.length < 3 || system.args.length > 5) {
console.log('Usage: rasterize.js URL filename');
phantom.exit(1);
} else {
address = system.args[1];
output = system.args[2];
const pipeline = (...fns) => (val) => fns.reduce((prom, fn) => prom.then(fn), Promise.resolve(val));
const myPipe = pipeline(
(val) => val + 1,
(val) => val + 1
);
Promise.resolve(1)
.then(myPipe)
.then((result) => {
I am attesting that this GitHub handle xat is linked to the Tezos account tz1P9djZkQKQdvt68eixoyBf8ezNYjgrEdue for tzprofiles
sig:edsigtue5MxmvLyCQsaXQGDNJ5hb3ovPMQjZkK6twewkscXr98ZCGUTN8zHqR9X4wqoZrJg6vy4EffLmipjmcYc9NtEypfSPWGg
@xat
xat / gist:9ccf5eab2d0adb34fe8d
Created October 12, 2014 19:07
start playback of a youtube clip on chromecast using castv2
var castv2Cli = require('castv2-client');
var inherits = require('util').inherits;
var Application = castv2Cli.Application;
var RequestResponseController = castv2Cli.RequestResponseController;
var extend = require('xtend');
var noop = function() {};
var slice = Array.prototype.slice;
var Api = function(client, session) {
var that = this;