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
var testData = ['yeti', 'a dude', 'faceball 5000', 'zoolander', 'surfing', '', '90', '100'] | |
var lexiconalCompare = function(a, b) { | |
if (typeof a === 'string' && typeof b === 'string') { | |
a = a.toLowerCase(); | |
b = b.toLowerCase(); | |
var bigLength = a.length > b.length ? a.length : b.length; | |
for (var x = 0; x < bigLength; x++) { | |
var aCharValue = a[x] ? a.charCodeAt(x) : 0, | |
bCharValue = b[x] ? b.charCodeAt(x) : 0 |
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
.directive('backSpaceNotBackButton', [function(){ | |
return { | |
restrict: 'A', | |
link: function(scope, element, attrs){ | |
// This will stop backspace from acting like the back button | |
$(element).keydown(function (e) { | |
var elid = $(document.activeElement) | |
.filter( | |
"input:not([type], [readonly]),"+ | |
"input[type=text]:not([readonly]), " + |
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
var unsorted = [3, 6, 4, 5, 8, 1, 7, 9, 2]; | |
var mergeSort = (function(){ | |
var sort = function (toSort) { | |
var arlength = toSort.length; | |
var midpoint = Math.round(arlength / 2); | |
if (toSort.length > 1) { | |
// better to not slice here since it creates new arrays | |
return merge(mergeSort(toSort.slice(0, midpoint)), |