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
/** | |
* EventEmitter with jQuery 1.7's $.Callbacks(). | |
*/ | |
function EventEmitter() { | |
this.topics = {}; | |
} | |
/** | |
* Listen on the given `topic` event with `fn`. |
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($) { | |
var serialize = function(type,form) { | |
var data = {}; | |
var first_run_ignore_types = ['submit','checkbox']; | |
form.find('input, select').each(function() { | |
var input_type = $(this).attr('type'); | |
var input_name = $(this).attr('name'); | |
if (first_run_ignore_types.indexOf(input_type) === -1) { | |
// process and push to data |
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
<?php | |
/* | |
* Manages migrations for Yii database | |
* | |
* Author: Ryan Bales <[email protected]>, 2011 | |
*/ | |
class DbMigrateCommand extends CConsoleCommand | |
{ | |
const MIGRATION_TABLE = 'Migration'; |
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
<?php | |
/* | |
* Directory enumeration and presentation for jQuery TreeView Widget | |
* Author: Ryan Bales, 2011 | |
*/ | |
class DirectoryEnumerator | |
{ | |
private $enumeration_list = array(); | |
private $directory; | |
private $public_directory; |
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
<?php | |
class EIterableActiveRecord extends CActiveRecord | |
{ | |
public function getIter($buffer_size) | |
{ | |
return new ActiveRecordIterator($this,$buffer_size); | |
} | |
} | |
class ActiveRecordIterator implements Iterator |
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
class myClass(object): | |
def __init__(self): | |
self.elems = ['meh','meep','moop','mop'] | |
self.index = None | |
def __iter__(self): | |
return self | |
def next(self): | |
if self.index is None: | |
self.index = 0 | |
return self.elems[self.index] |
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
<?php | |
/** | |
* Script to recursively remove all traces of svn from a directory tree | |
* Author: Ryan Bales, Creative Anvil 2011 | |
*/ | |
ini_set('memory_limit','512M'); | |
function usage() | |
{ | |
ob_start(); ?> |
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 inArray = function(needle,haystack) { | |
for(i=0;i<haystack.length;i++) { | |
if( needle === haystack[i] ) { | |
return true; | |
} | |
} | |
} | |
var reverseGeocode = function(options) | |
{ | |
if( typeof(options.lat) !== 'undefined' && typeof(options.lng) !== 'undefined' && typeof(options.onReverseGeocode) === 'function' ) |
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
Array.prototype.contains = function(elem) | |
{ | |
return (this.indexOf(elem) === -1) ? false : true; | |
} | |
function addNumberSuffix(n) | |
{ | |
var suffix = ''; | |
n = parseInt(n); | |
var number_last_digit = parseInt((''+n).substr(-1,1)); | |
if( [4,5,6,7,8,9,0].contains(number_last_digit) || (n > 10 && n < 14) ) |
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
/* FILE UPLOADER */ | |
var CLASS_UPLOADING = 'file-uploading'; | |
var CLASS_UPLOADING_COMPLETE = 'file-uploading-complete'; | |
var CLASS_LOADER_WIDGET = 'file-upload-loader'; | |
var CLASS_LOADER_LABEL = 'file-upload-loader-label'; | |
var CLASS_LOADER_CONTAINER = 'file-upload-container'; | |
var FILE_UPLOAD_URL = '/path/to/handler'; | |
var updateFileContainerState = function(file_input) | |
{ | |
// hide input |