Skip to content

Instantly share code, notes, and snippets.

@huglester
huglester / xvfb
Created May 28, 2013 07:16 — forked from jterrace/xvfb
XVFB=/usr/bin/Xvfb
XVFBARGS=":1 -screen 0 1024x768x24 -ac +extension GLX +render -noreset"
PIDFILE=/var/run/xvfb.pid
case "$1" in
start)
echo -n "Starting virtual X frame buffer: Xvfb"
start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile --background --exec $XVFB -- $XVFBARGS
echo "."
;;
stop)
@huglester
huglester / clearTube
Last active December 17, 2015 08:58
Pheanstalk clear tube command
<?php
public function clearTube($tube)
{
try
{
while($job = $pheanstalk->peekReady($tube))
{
$pheanstalk->delete($job);
}
@huglester
huglester / fuel17_install.sh
Last active December 17, 2015 00:38
Installing FuelPHP 1.7/develop framework
#initial install
# cd /your/path
git clone --recursive git://github.com/fuel/fuel.git . --branch 1.7/develop
git submodule foreach git checkout 1.7/develop
php composer.phar selfupdate
php composer.phar install
#later, updating...
<?php
// app/start/global.php
/*
|--------------------------------------------------------------------------
| Application Error Logger
|--------------------------------------------------------------------------
|
| Here we will configure the error logger setup for the application which

Awesome PHP Libraries

A list of amazingly awesome PHP libraries that you should consider using (and some other shiny extras).

<?php require_once(__DIR__.'/../../vendor/autoload.php');
use Guzzle\Http\Client;
use Guzzle\Common\Event;
use Guzzle\Http\Message\Request;
use Guzzle\Http\Message\Response;
use Guzzle\Http\Exception\BadResponseException;
$url = 'http://www.amazon.com';
$client = new Client($url);
module-{{ global:module }}{{
if page:id
}} page-id-{{ page:id }}{{
if page:is_home
}} home{{
endif }}{{
endif }}{{
if user:logged_in
@huglester
huglester / example.js
Created February 14, 2013 07:46
jQuery examples
var savehelp = {
init: function() {
$('.save-help').on('click', function(e){
e.preventDefault();
var $this = $(this);
var id = $this.closest('tr').find('textarea').attr('id');
var text = $this.closest('tr').find('textarea').attr('value');
console.log( { id: id, text: text } );
@huglester
huglester / fuel16_install.sh
Last active December 12, 2015 05:28
Installing FuelPHP 1.6/develop framework
#initial install
# cd /your/path
git clone --recursive git://github.com/fuel/fuel.git . --branch 1.6/develop
git submodule foreach git checkout 1.6/develop
php composer.phar selfupdate
php composer.phar install
#later, updating...
$url = "http://factoryjoe.com/projects/emoticons/";
$html = file_get_contents($url);
$doc = new DOMDocument();
$doc->strictErrorChecking = FALSE;
$doc->loadHTML($html);
$xml = simplexml_import_dom($doc);
$flags = array();
foreach ($xml->body->div->div->table[1]->tbody->tr as $value)