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
Download Virtual Box & Install http://download.virtualbox.org/virtualbox/5.1.6/VirtualBox-5.1.6-110634-OSX.dmg | |
curl -s https://raw.githubusercontent.com/xdissent/ievms/master/ievms.sh | env IEVMS_VERSIONS="9" bash | |
This failed for me w/ message: | |
MD5 check failed for unar1.5.zip (wanted fbf544d1332c481d7d0f4e3433fbe53b, got ae4362c240eb7909fcda1ce2f26cfb36) | |
Instead: brew install unar | |
Try again: curl -s https://raw.githubusercontent.com/xdissent/ievms/master/ievms.sh | env IEVMS_VERSIONS="9" bash |
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
{ | |
"color_scheme": "Packages/Theme - Cobalt2/cobalt2.tmTheme", | |
"file_exclude_patterns": | |
[ | |
"*.pyc", | |
"*.pyo", | |
"*.exe", | |
"*.dll", | |
"*.obj", | |
"*.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
// Find duplicate in sorted array | |
var sortedArray = [1,2,3,3,4,5,6,7,8]; | |
var sortedNoDupes = [1,2,3,,4,5,6,7,8]; | |
// Binary search | |
function findDuplicate(arr) { | |
var midpoint = Math.floor(arr.length / 2); | |
var mid = arr[midpoint]; | |
var left = arr[midpoint - 1]; | |
var right = arr[midpoint + 1]; |
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
// simple O(n), linear method | |
function linearFindRotationPoint(array) { | |
var rotationPointIndex; | |
for (var i = 1; i <= array.length; i++) { | |
if (array[i-1] > array[i]) { | |
rotationPointIndex = i; | |
break; | |
} |
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
// First Build binary trees from a pojo representation | |
// Find the max depths of the binary tree's "node leafs" | |
var _ = require('underscore'); | |
function BinaryTreeNode(value) { | |
this.value = value; | |
this.left = null; | |
this.right = 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
echo " | |
rdr pass inet proto tcp from any to any port 80 -> 127.0.0.1 port 3000 | |
" | sudo pfctl -ef - |
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
angular.module('example', []) | |
.controller('libraryController', function (Books) { | |
var initialize = function () { | |
$scope.books = Books | |
} | |
$scope.removeBook = function () { | |
// accessible to scope | |
} | |
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
angular.module('example', []) | |
.service('libraryService', function () { | |
var books = []; | |
this.searchBooks = function () { | |
// return books that match query | |
} | |
}); | |
var library = libraryService; |
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
angular.module('example', []) | |
.factory('libraryFactorySingleton', function () { | |
var books = []; | |
return { | |
searchBooks: function (query) { | |
// return books that match query | |
} | |
}; | |
}) |
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 Library = function (books) { | |
var books = []; | |
this.searchBooks = function (query) { | |
// return books that match query | |
} | |
} | |
var books = []; | |
var library = new Library(books); |
NewerOlder