Skip to content

Instantly share code, notes, and snippets.

View funkytaco's full-sized avatar

Luis Gonzalez funkytaco

View GitHub Profile
<?php
# sender
require_once($LIB_DIR_PATH .'/pheanstalk/pheanstalk_init.php');
$beanstalk = new Pheanstalk('127.0.0.1');
$beanstalk->useTube("booth-jobs");
$watchtasks[] = $beanstalk->put(microtime(1), Pheanstalk::DEFAULT_PRIORITY, 10); # 10 sec wait
$beanstalk->useTube("booth-jobs");
$watchtasks[] = $beanstalk->put(microtime(1), Pheanstalk::DEFAULT_PRIORITY, 20); # 20 sec wait
$beanstalk->useTube("booth-jobs");
$watchtasks[] = $beanstalk->put(microtime(1), Pheanstalk::DEFAULT_PRIORITY, 30); # 30 sec wait
@funkytaco
funkytaco / gist:5885993
Created June 28, 2013 16:26
Pheanstalk facade Unit test
/**
* Tests the Pheanstalk facade (the base class).
* Relies on a running beanstalkd server.
*
* @author Paul Annesley
* @package Pheanstalk
* @licence http://www.opensource.org/licenses/mit-license.php
*/
class Pheanstalk_FacadeConnectionTest
extends UnitTestCase
@funkytaco
funkytaco / phpunit.rb
Last active December 19, 2015 14:29 — forked from itspriddle/phpunit.rb
require 'formula'
class Phpunit < Formula
homepage 'http://www.phpunit.de/manual/current/en/index.html'
url 'http://pear.phpunit.de/get/phpunit.phar'
sha1 '88d4919ffc91c9aec8aea2b28e500d3e43e2b13b'
version 'HEAD'
def install
bin.install "phpunit.phar" => "phpunit"
#!/bin/sh
CURRENT=$(node -v)
VERSION=$(curl -L -s http://nodejs.org/dist/latest/ \
| egrep -o '[0-9]+\.[0-9]+\.[0-9]+' \
| tail -n1)
PLATFORM=darwin
ARCH=x64
PREFIX="$HOME/node-v$VERSION-$PLATFORM-$ARCH"
tmpmac:javascript tmpvar$ node node-jsdom-pure.js
<div id="template">
<div class="hello">
<span class="who">Hello Wrrrld</span>
</div>
</div>
<html>
<head>
<title>photobooth</title>
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
</head>
<body>
<div class="container">
<div class="row-fluid">
<span>Step 1</span>
<img src='http://placehold.it/125x125&text=lomo' onClick='setFilter("lomo")'>
@funkytaco
funkytaco / json.php
Last active December 25, 2015 19:39
Use JSON with OpenJS Grid #openjs
<?php
$rows['_1234'] =
array(
'rowone' => 'Row One',
'rowtwo' => 'Row Two',
'rowthree' => 'Row Three',
'rowfour' => 'Row Four',
'rowfive' => 'Row Five',
@funkytaco
funkytaco / index.php
Last active December 26, 2015 05:59
openJS cellTypes not working
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="/bootstrap/css/bootstrap.css"/>
<link rel="stylesheet" href="/grid.css" title="openJsGrid"/>
<script src="/jquery.js" type="text/javascript"></script>
<script src="/root.js" type="text/javascript"></script>
<script src="/grid.js" type="text/javascript"></script>
var express = require('express');
var sys = require('util');
var oauth = require('oauth');
var app = express.createServer();
var _twitterConsumerKey = process.env['TWITTER_CONSUMER_KEY'];
var _twitterConsumerSecret = process.env['TWITTER_CONSUMER_SECRET'];
console.log("_twitterConsumerKey: %s and _twitterConsumerSecret %s", process.env['TWITTER_CONSUMER_KEY'], process.env['TWITTER_CONSUMER_SECRET']);

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
 // the rest of your code goes here.