Skip to content

Instantly share code, notes, and snippets.

View colinmollenhour's full-sized avatar

Colin Mollenhour colinmollenhour

View GitHub Profile
@colinmollenhour
colinmollenhour / monitor-file.sh
Created June 24, 2010 03:37
Monitor File Script
#!/bin/bash
#
# Colin Mollenhour
#
# Run this from a cron job to be notified when a file is changed.
# Use the --append-new option to append new content to the notification email.
#
# Examples:
#
# # File in a directory changed? (recursive)
@colinmollenhour
colinmollenhour / calltest.php
Created February 14, 2010 18:46
call_user_func_array performance comparison
<?php
$iterations = 100000;
echo "Iterations: $iterations\n";
class Test {
public function nothing0(){}
public function nothing1($arg1){}
public function nothing2($arg1,$arg2){}
public function nothing3($arg1,$arg2,$arg3){}
@colinmollenhour
colinmollenhour / modman
Created October 17, 2009 04:48
Module Manager (old version)
#!/bin/bash
# Module Manager
# Version 1.0.1
# System Requirements:
# - bash
# - web server must follow symlinks
# - The following utilities must be locatable in your $PATH
# svn, grep (POSIX), find, ln, sed, cp, basename, dirname
class Kohana extends Kohana_Core {
// Se the active component in the Router
public static $component;
/**
* A wrapper for Kohana::find_file, this is to be used where the component path should be searched first
*/
public static function find_file($directory, $filename, $required = FALSE, $ext = FALSE)
{
@colinmollenhour
colinmollenhour / gist:83824
Created March 23, 2009 22:40
Event Delegator for Prototype
/*
Author: Colin Mollenhour
Delegator - An event delegation class for Prototype.
Supports CSS selectors or binary functions and mouseenter and mouseleave emulation.
Usage:
1. Create a 'Delegator' instance passing the event type to delegate. You cannot change the event type later.
2. Add some rules to the Delegator instance using "add". Rules can be added or removed at any point.