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
echo "Running debugger check" | |
FILES=$(git diff --cached --name-only HEAD) | |
RED='\x1B[0;31m'; | |
DEBUG_COMMANDS='debugger|console\.log|binding\.pry' | |
# Adding /dev/null so that grep reports file name when only one file is given | |
ERRORS=$(grep -E --line-number $DEBUG_COMMANDS $FILES /dev/null) | |
if [ -n "$ERRORS" ]; then |
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
lon | lat | zip | |
---|---|---|---|
-122.412 | 37.776 | 94103 | |
-122.402 | 37.791 | 94104 | |
-122.396 | 37.790 | 94105 | |
-122.728 | 37.785 | 94106 | |
-122.394 | 37.769 | 94107 | |
-122.409 | 37.791 | 94108 | |
-122.421 | 37.795 | 94109 | |
-122.416 | 37.749 | 94110 | |
-122.405 | 37.774 | 94111 |
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 mergeSort(arr) { | |
for (var n = 1; n < 4 ; n++){ | |
var seg_size = Math.pow(2, n); | |
for (var seg = 0; seg < Math.ceil(arr.length/seg_size); seg++) { | |
var before = arr.slice(0, seg * seg_size); | |
var cur = arr.slice(seg * seg_size, (seg+1) * seg_size); | |
var after = arr.slice((seg+1) * seg_size); | |
var left = cur.slice(0, seg_size/2); |
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
.slot { | |
padding: 3px; | |
text-align: center; | |
border: 0; | |
} | |
.available { | |
background-color: #eee; | |
} |
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 Stack() { | |
var data = []; | |
var stackPtr = [0,0,0]; | |
this.push = function(stackNumber, d) { | |
var index = stackNumber + stackPtr[stackNumber] * 3; | |
data[index] = d; | |
stackPtr[stackNumber]++; | |
}; | |
this.print = function() { | |
var strs = ["","",""]; |
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 Node(d) { | |
this.next = undefined; | |
this.data = d; | |
this.appendToTail = function(d) { | |
var end = new Node(d); | |
var n = this; | |
while (n.next !== undefined) { n = n.next; } | |
n.next = end; |
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 allUnique(str) { | |
var a = []; | |
for (var i = 0; i < str.length; i++) { | |
var char = str.charAt(i); | |
if (!a[char]) { | |
a[char] = true; | |
} else { | |
return 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
function Deferred () { | |
var rand = Math.random(); | |
var dones = []; | |
var is_resolved = false; | |
return { | |
promise: function () { | |
}, | |
resolve: function(str) { |
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
git for-each-ref --sort=-committerdate refs/heads/ |
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
/* Rotate an array n positions | |
* if n is positive - rotate to the left | |
* if n is negative - rotate to the right | |
*/ | |
Array.prototype.rotate = function(n) { | |
//Make a copy of the current array | |
var newArray = this.slice(0); | |
//Handle a number greater than the length so that it loops around |
NewerOlder