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
alias commit='git commit -a -m \"$(curl -s http://whatthecommit.com|xpath "//p[1]/text()" 2>/dev/null)\"' |
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 | |
WD="." | |
function extract_revision() | |
{ | |
REV=$(svn info $1|grep "Revision:"|cut -d ":" -f 2-|sed -e 's/^[ ]*//') | |
} | |
function split_op_and_loc() |
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 n = 100, | |
data = (function (l, r, i) { for (i = 0; i < l; r.push(i++)); return r;}(n, [])); | |
// http://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle | |
function shuffle(arr) { | |
var i, n = arr.length, p; | |
for (i = n - 1; i > 0; i--) { | |
p = Math.floor(Math.random() * i); | |
arr.splice(i, 1, arr.splice(p, 1, arr[i]).pop()); | |
} |
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 n = 100, | |
arr = (function (l, r, i) { for (i = 0; i < l; r.push(i++)); return r;}(n, [])); | |
// http://en.wikipedia.org/wiki/Quicksort | |
function quicksort(arr) { | |
var pivot, | |
pi = Math.floor(Math.random() * arr.length), // Random pivot index | |
below = [], | |
above = [], | |
i, l; |
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
/** | |
* My take on Bresenham's line algorithm | |
* | |
* http://en.wikipedia.org/wiki/Bresenham's_line_algorithm | |
* | |
* Based off of the limited algorithm, amended by own research, | |
* trial and error, and plain stubborness. | |
* | |
* Demo: http://jsfiddle.net/VFybR/26/ | |
*/ |
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
/** | |
* Lightbox script I made back in the day when I wasn't happy with the ones I could find | |
* already out there. Also my first exercise using the Module-pattern, copied from jQuery, | |
* which is the reason for the overtly complex and stupid structure. | |
* | |
* Contains bugs and weird solutions. (Some of which I just had to fix, in case someone | |
* actually sees this code.) | |
* | |
* This source code is stored here more as a curiosity than for real world usage. | |
* |
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 | |
// Set elsewhere before including: | |
// | |
// $template = contains file to be read when fresh content is served | |
// CACHE_TTL_SECONDS = how long the cache should live, defaults to 10 mins | |
// | |
// Note: this does not necessarily save your server from receiving the GET request, | |
// you simply don't serve any content over the wire if the caching headers match, | |
// and you might save some disk I/O. |
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
{ | |
// Settings | |
"passfail" : false, // Stop on first error. | |
"maxerr" : 10000, // Maximum error before stopping. | |
// Predefined globals whom JSHint will ignore. | |
"browser" : true, // Standard browser globals e.g. `window`, `document`. | |
"node" : 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
document.addEventListener( | |
"mousemove", | |
function (e) { | |
var sample = {x: parseInt(e.clientX, 10) || 0, y: parseInt(e.clientY, 10) || 0}; | |
var diff = {x: sample.x - this.lastSample.x, y: sample.y - this.lastSample.y}; | |
this.lastSample = sample; | |
console.dir(diff); | |
}.bind({lastSample: {x: 0, y: 0}}), | |
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
#!/bin/bash | |
PROJECTHOME=$(dirname $(dirname $0)) | |
JSSOURCEDIR="$PROJECTHOME/public/js" | |
VERSIONFILE="$JSSOURCEDIR/version.js" | |
VERSION=$(git describe --all --long | tr "-" " " | cut -d " " -f 3) | |
if [ ! -d "$PROJECTHOME" -o ! -d "$JSSOURCEDIR" ]; | |
then | |
echo "Unable to resolve PROJECTHOME or JSSOURCEDIR" | |
exit 1 |
OlderNewer