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
(defn get-chars-at [seq count] | |
(reduce (fn [accum next] | |
(let [next-char (get next count) | |
char (if-not (nil? next-char) next-char " ")] | |
(str accum char))) | |
"" seq)) | |
(defn max-count [seq] | |
(reduce (fn max-count [last line] | |
(let [c (count line)] |
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> | |
<link href="bootstrap.css" rel="stylesheet"/> | |
<style> | |
#expanded:target .nav-collapse { | |
height: auto; | |
} | |
.navbar .btn-contract { | |
display: none; |
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> | |
<link href="bootstrap.css" rel="stylesheet"/> | |
<style> | |
#expanded:target .nav-collapse { | |
height: auto; | |
} | |
</style> | |
</head> |
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
<body id="expanded"> | |
<div class="navbar"> | |
<div class="navbar-inner"> | |
<a class="btn btn-navbar btn-expand" href="#expand"> | |
<span class="icon-bar"></span> | |
<span class="icon-bar"></span> | |
<span class="icon-bar"></span> | |
</a> |
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 module = (function () { | |
var hash = {}; | |
function fetch (name) { | |
return hash[name]; | |
} | |
fetch.create = function (name, thing) { | |
if (name in hash) { |
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> | |
<script> | |
(function () { | |
var id = 'sendhack'; | |
function sendPost(url, data) { | |
var iframe = document.createElement('iframe'); |
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 times(first, second) { | |
return first * second; | |
} | |
console.log(times(3, 4)); // 12 | |
console.log(times(10, 50)); // 500 | |
console.log(times); // function () {} |
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 Animal (name, numLegs) { | |
this.name = name; | |
this.numLegs = numLegs; | |
} | |
Animal.prototype.greet = function () { | |
console.log("Hi! My name is " + this.name); | |
} | |
function Horse (name) { |
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
define(['hashmap'], function (HashMap) { | |
describe('HashMap', function () { | |
var hash; | |
function size (obj) { | |
var size = 0; | |
for (var key in obj) { | |
if (obj.hasOwnProperty(key)) size++; |
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 HashMap() { this.data = []; } | |
HashMap.prototype.hash = function (val) { | |
var i = 0; | |
var d = ('' + val).split(''); | |
var l = d.length; | |
var t = 0; | |
while(i < l) { | |
t += d[i].charCodeAt(); | |
i++; |