This file contains hidden or 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
$.extend(Function.prototype, { | |
use: function() { | |
var method = this, args = Array.prototype.slice.call(arguments), object = args.shift(); | |
return function() { | |
return method.apply(object, args.concat(Array.prototype.slice.call(arguments))); | |
} | |
}, | |
useEL: function() { | |
var method = this, args = Array.prototype.slice.call(arguments), object = args.shift(); | |
return function(event) { |
This file contains hidden or 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 password_strength(password, username) { | |
var p = password | |
, u = username | |
; | |
if( | |
/^[a-z]*$/.test(p) | |
|| /^[A-Z]*$/.test(p) | |
|| /^[0-9]*$/.test(p) | |
) { |
This file contains hidden or 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
TZ = { | |
getTimezoneOffset: function(timezone) | |
{ | |
var dst = (TZ.isDSTObserved()) ? 'dst' : 'std'; | |
return TZ.zones[timezone][dst]; | |
}, | |
isDSTObserved: function() | |
{ | |
// 2nd sunday of march |
This file contains hidden or 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 | |
DIR=$1 | |
ACTION='backup' | |
if [ $# -eq 2 ]; then | |
ACTION=$2 | |
fi | |
if [ $ACTION = 'delete' ]; then | |
rsync -rv --delete --size-only backup@files::$DIR/ /mnt/group1/media/$DIR/ | |
else |
This file contains hidden or 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 node | |
/* | |
Run nodeunit tests | |
Simple node.js script to find all *.test.js files and execute them through nodeunit. | |
Without arguments, will search recursively through the current directory for tests. | |
Supply arguments of directories or specific tests to run. | |
Sample Usage: | |
$ ./runtests.js |
This file contains hidden or 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 node | |
var child_process = require('child_process'), | |
fs = require('fs'), | |
root = __dirname + '/../../', | |
configFile = root + 'config/config.js', | |
jslint = require(root + 'lib/jslint/jslint.js'); | |
function setPushVersion() { | |
child_process.exec('git rev-parse HEAD', { cwd: root }, function (error, stdout, stderr) { |
This file contains hidden or 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 | |
installonly=no | |
while [ $# -gt 0 ] | |
do | |
case "$1" in | |
(-i) installonly=yes;; | |
(-*) echo "$0: error - urecognized option $1" 1>&2; exit 1;; | |
(*) break;; |
This file contains hidden or 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
// What does this return? | |
(function() { | |
function f() { return 1; } | |
return f(); | |
function f() { return 2; } | |
})(); | |
// What is x? | |
var y = 1, x = y = typeof x; |
This file contains hidden or 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
// A* path finding algorithm for impactjs game engine | |
// adapted from http://stormhorse.com/a_star.js | |
// via http://46dogs.blogspot.com/2009/10/star-pathroute-finding-javascript-code.html | |
// impact-ified by jminor - http://pixelverse.org/ | |
/* Example: | |
this.pathFinder = new PathFinder(); | |
var start = [((this.pos.x+this.size.x/2) / tilesize).floor(), ((this.pos.y+this.size.y/2) / tilesize).floor()]; | |
var destination = [((target.pos.x+target.size.x/2) / tilesize).floor(), ((target.pos.y+target.size.y/2) / tilesize).floor()]; |
This file contains hidden or 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
/** | |
* AStar | |
* | |
* Created by Paul Armstrong on 2011-05-26. | |
* Copyright (c) 2011 Paul Armstrong Designs. All rights reserved. | |
* | |
* Based on: https://gist.github.com/827899 | |
*/ | |
ig.module('plugins.a-star') |
OlderNewer