Skip to content

Instantly share code, notes, and snippets.

@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 } );
module-{{ global:module }}{{
if page:id
}} page-id-{{ page:id }}{{
if page:is_home
}} home{{
endif }}{{
endif }}{{
if user:logged_in
<?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);

Awesome PHP Libraries

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

<?php
// app/start/global.php
/*
|--------------------------------------------------------------------------
| Application Error Logger
|--------------------------------------------------------------------------
|
| Here we will configure the error logger setup for the application which
@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...
@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 / 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)
sudo bash
cd /usr/local/lib
wget http://launchpad.net/gearmand/trunk/0.18/+download/gearmand-0.18.tar.gz
tar -xvzf gearmand-0.18.tar.gz
cd gearmand-0.18/
apt-get install libboost-program-options-dev uuid-dev libevent-dev build-essential g++ perf libcloog-ppl0
./configure && sudo make && sudo make install
ldconfig
<?php
Class ProjectsController Extends BaseController {
public function getNew(){
return dd(Sentry::getUserProvider()->createModel()
->join('throttle','throttle.user_id','=','users.id','left')
->where('throttle.banned',0)
->orWhere('throttle.banned',null)
->where('throttle.suspended',0)