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(env){ | |
env.Mixins.Events = { | |
bindEvents: function(events) { | |
if (!this._bEvents) { | |
this._bEvents = []; | |
} | |
for (var i=0,evt; evt=events[i]; i++) { |
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 destroyViews(views){ | |
if (!views) { return; } | |
var v; | |
if ($.isArray(views)) { | |
for (var i=0; i<views.length; i++) { | |
v = views[i]; | |
if(v && $.isArray(v)){ | |
destroyViews(v); | |
} else { | |
v && v.destroy && v.destroy(); |
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
if (!Array.prototype.filter) { | |
Array.prototype.filter = function(fun/*, thisArg*/) { | |
'use strict'; | |
if (this === void 0 || this === null) { | |
throw new TypeError(); | |
} | |
var t = Object(this); | |
var len = t.length >>> 0; |
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
if (!Array.prototype.indexOf) { | |
Array.prototype.indexOf = function (searchElement, fromIndex) { | |
if ( this === undefined || this === null ) { | |
throw new TypeError( '"this" is null or not defined' ); | |
} | |
var length = this.length >>> 0; // Hack to convert object.length to a UInt32 | |
fromIndex = +fromIndex || 0; |
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
// From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys | |
if (!Object.keys) { | |
Object.keys = (function () { | |
'use strict'; | |
var hasOwnProperty = Object.prototype.hasOwnProperty, | |
hasDontEnumBug = !({toString: null}).propertyIsEnumerable('toString'), | |
dontEnums = [ | |
'toString', | |
'toLocaleString', | |
'valueOf', |
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 ($) { | |
// this is a binary search that operates via a function | |
// func should return < 0 if it should search smaller values | |
// func should return > 0 if it should search larger values | |
// func should return = 0 if the exact value is found | |
// Note: this function handles multiple matches and will return the last match | |
// this returns -1 if no match is found | |
function binarySearch(length, func) { | |
var low = 0; |
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 relativeDate = (function(undefined){ | |
var SECOND = 1000, | |
MINUTE = 60 * SECOND, | |
HOUR = 60 * MINUTE, | |
DAY = 24 * HOUR, | |
WEEK = 7 * DAY, | |
YEAR = DAY * 365, | |
MONTH = YEAR / 12; |
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
set nocompatible | |
set guioptions=aAce | |
set number | |
set ruler | |
syntax on | |
" Whitespace stuff | |
set nowrap |
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/bash | |
# | |
# This script installs and configures couchdb on a fresh Amazon Linux AMI instance. | |
# | |
# Must be run with root privileges | |
# Tested with Amazon Linux AMI release 2011.02.1.1 (ami-8c1fece5) | |
# | |
export BUILD_DIR="$PWD" |
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
/** | |
* Modified version of TJ's http support file from the Express repo: | |
* https://github.com/visionmedia/express/blob/master/test/support/http.js | |
* | |
* Module dependencies. | |
*/ | |
var EventEmitter = require('events').EventEmitter | |
, should = require('should') | |
, methods = ['get','post','put','delete','head'] |
NewerOlder