Skip to content

Instantly share code, notes, and snippets.

@gigablah
gigablah / thumbnail.js
Created July 14, 2012 12:05
nodejs + gearman + gm + pngquant + pngcrush thumbnail generator
#!/usr/bin/env node
var path = require('path'),
exec = require('child_process').exec,
when = require('when'),
gm = require('gm'),
Gearman = require('node-gearman'),
gearman = new Gearman(),
options = {
thumbDir: path.join(__dirname, 'thumb'),
@gigablah
gigablah / jquery.await.js
Created July 15, 2012 12:11
Simple jQuery deferred object manager
(function($) {
"use strict";
var dictionary = {};
$.Await = (function() {
function create(name, options) {
if (!(name in dictionary)) {
dictionary[name] = new $.Await._dictionary(name, options);
}
return dictionary[name];
@gigablah
gigablah / Rexfile.pm
Created August 22, 2012 14:47
Staging deployment using Rex
use strict;
use warnings;
use Rex::Transaction;
use Rex::Apache::Build;
use Rex::Apache::Deploy "Symlink";
user "vgmdb";
private_key "/var/lib/jenkins/.ssh/id_rsa";
public_key "/var/lib/jenkins/.ssh/id_rsa.pub";
@gigablah
gigablah / gist:3750245
Created September 19, 2012 15:26
Facebook post-auth redirect hash removal
if (window.history && window.history.replaceState && window.location.hash == '#_=_') {
var loc = window.location;
window.history.replaceState({}, document.title, loc.protocol + '//' + loc.host + loc.pathname);
}
@gigablah
gigablah / UserInterface.php
Created August 7, 2013 07:15
UserInterface
<?php
namespace Acme\Bundle\WebBundle\Security\User;
use Symfony\Component\Security\Core\User\UserInterface as BaseUserInterface;
class UserInterface extends BaseUserInterface
{
/**
* Email, e.g. [email protected]
@gigablah
gigablah / phpunit
Created August 28, 2013 01:25
phpunit for composer
#!/usr/bin/env php
<?php
/* PHPUnit
*
* Copyright (c) 2001-2012, Sebastian Bergmann <[email protected]>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
<?php
use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\RequestMatcher;
require_once __DIR__.'/../vendor/autoload.php';
$app = new Durian\Application();
<!DOCTYPE html>
<html prefix="og: http://ogp.me/ns#" xmlns:og="http://ogp.me/ns#">
<head>
<meta charset="utf-8">
<title>
{% if is_login %}Login
{% elif is_home %}{{ site.author }}
{% elif is_tag %}{{ tag }}
{% elif post.type == 'post' %}{{ post.title }}
{% elif post.type == 'link' %}{{ link.title }}
variable "access_key" {}
variable "secret_key" {}
variable "region" {
default = "ap-southeast-1"
}
variable "zone" {
default = "ap-southeast-1a"
}
@gigablah
gigablah / docker-clear-orphaned-volumes.py
Last active August 29, 2015 14:08 — forked from mindreframer/docker-clear-orphaned-volumes.py
Clear orphaned Docker volumes (updated for 1.3)
#!/usr/bin/python
import json
import os
import shutil
import subprocess
import re
dockerdir = '/var/lib/docker'
volumesdir = os.path.join(dockerdir, 'volumes')