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(name, parent) { | |
return { | |
name:name, | |
parent:parent | |
} | |
} | |
root = node('root') | |
n2 = node('left', root) | |
root.left = n2 | |
n3 = node('2left', n2) |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=UTF-8"> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
<title></title> | |
<meta name="viewport" content="width=device-width"> | |
<style>@media print, screen and (view-mode:minimized){#ghostery-purple-bubble{display:none}}</style> | |
<style>path {stroke: #FFFFFF; stroke-width: 1px;} .datamaps-legend dt, |
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(name, parent) { | |
return { | |
name:name, | |
parent:parent | |
} | |
} | |
root = node('root') |
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
//get the three words that appear most often in a single string | |
var s = "two one two three four one one eight one two four eight three one" | |
var p = _.pairs(_.countBy( s.split(" "))) | |
var f = _.sortBy(p, function (p) { return p[1]; }).reverse().slice(0,3); | |
console.log( | |
f | |
) |
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 G(name, names) { | |
this.name = name; | |
this.players = {}; | |
for (i=0; i < names.length; i++) { | |
this.players[ names[i] ] = {}; | |
} | |
} | |
G.prototype = { |
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 addAsync(data) { | |
var d = Q.defer(); | |
setTimeout(function() { | |
console.log('data in ' + data); | |
if (data === 2) { | |
d.reject("rejected!"); | |
} else { | |
d.resolve(data + 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
$scope.getFakeStuff = function() { | |
timeoutTest(1) | |
.then(timeoutTest) | |
.then(timeoutTest) | |
.then(function(data) { | |
console.log("done " + data); | |
}, function(reason) { | |
console.log("error " + reason); | |
}) | |
; |
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
/* | |
"/book/$id?/$author?/$authorid?"(controller: "book") { | |
action = [GET:"show", PUT:"update", DELETE:"delete", POST:"save"] | |
} | |
*/ | |
class BookController { | |
def beforeInterceptor = [action:this.&checkAuthor, except:'author'] | |
def checkAuthor() { |
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
<tomcat>/conf/Catalina/localhost/solr.xml | |
<Context path="/solr" docBase="<location of solr war>" debug="0" crossContext="true"> | |
<Environment name="solr/home" type="java.lang.String" value="<solr Home>" override="true"/> | |
</Context> |
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
iptables -A INPUT 4 -s x.x.x.x -m state --state NEW -p tcp --dport x -j ACCEPT |