This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function _getElementsByClassName(DOMNode $node, $class) | |
{ | |
$elements = array(); | |
if (XML_ELEMENT_NODE === $node->nodeType && $node->hasAttributes()) { | |
for ($i = 0; $i < $node->attributes->length; $i++) { | |
$attribute = $node->attributes->item($i); | |
if ('class' === strtolower($attribute->name)) { | |
$values = explode(' ', $attribute->value); | |
if (in_array($class, $values)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Quick script for discovering and installing PHPUnit | |
# For real speed use the following command: | |
# wget http://gist.github.com/raw/521622/e5eb07769f21bef858ec062dd43bd4686021e8ca/phpunit_install.sh -O - | sh | |
echo "This will install PHPUnit on your machine" | |
echo "" | |
echo "+ Discovering pear channels for PHPUnit" | |
echo "=====================================" | |
pear channel-discover pear.phpunit.de |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$chop = function($query) { | |
parse_str($query); | |
unset($query); | |
return get_defined_vars(); | |
}; | |
$query = $chop("catid=1&follow=false"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var util = require('util'); | |
var fs = require('fs'); | |
var http = require('http'); | |
// Check for an input file | |
if (2 >= process.argv.length) { | |
console.error('An input file must be specified'); | |
process.exit(1); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# This script will change the desktop background to a | |
# random image taken from a directory | |
# | |
# Use random_background.py --help for options | |
# | |
# Author: Mattijs Hoitink <mattijs@monkeyandmachine.com> | |
# License: none (public domain) | |
import sys, argparse, os, mimetypes, re, random, gconf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# This script will change the desktop background to a | |
# random image taken from a directory | |
# | |
# Use random_background.py --help for options | |
# | |
# Author: Mattijs Hoitink <mattijs@monkeyandmachine.com> | |
# License: none (public domain) | |
import sys, argparse, os, mimetypes, re, random, gconf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{EventManager} = require 'events' | |
class CloudManager extends EventEmitter | |
constructor: (@config) -> | |
# Do some stuff | |
instance = null | |
module.exports = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Small EventEmitter implementation borowed from MicroEvent.js | |
* | |
* MicroEvent.js: https://github.com/jeromeetienne/microevent.js | |
*/ | |
var Emitter = function(){}; | |
Emitter.prototype = { | |
on: function(event, fct){ | |
this._events = this._events || {}; | |
this._events[event] = this._events[event] || []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# t.py wrapper --------------------------------------------------------------- | |
todo() { | |
if [ -f "$(pwd)/todo" ]; then | |
python ~/bin/t.py --task-dir . --list todo $@ | |
else | |
echo "No todo file found in this directory. Run 'touch todo' to create a new todo list." | |
fi | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// GNU C printf for JavaScript | |
// http://www.gnu.org/software/libc/manual/html_mono/libc.html#Formatted-Output | |
// | |
// Syntax | |
// % [ param-no $] flags width . * [ param-no $] type conversion | |
// Parts | |
// ----- | |
// Zero or more flag characters that modify the normal behavior of the conversion specification. |
OlderNewer