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
transparency - cached template, one todo x 92,279 ops/sec ±1.59% (90 runs sampled) specHelper.js:65 | |
handlebars - compiled and cached template, one todo x 49,922 ops/sec ±0.71% (92 runs sampled) specHelper.js:66 | |
transparency - cached template, 100 todos x 1,073 ops/sec ±3.16% (76 runs sampled) specHelper.js:65 | |
handlebars - compiled and cached template, 100 todos x 1,979 ops/sec ±1.07% (89 runs sampled) specHelper.js:66 | |
transparency - unused template, one todo x 22,917 ops/sec ±11.99% (36 runs sampled) specHelper.js:65 | |
handlebars - unused and compiled template, one todo x 2,369 ops/sec ±2.31% (87 runs sampled) specHelper.js:66 | |
transparency - unused template, 100 todos x 311 ops/sec ±4.77% (71 runs sampled) specHelper.js:65 |
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" | |
"http://www.w3.org/TR/html4/loose.dtd"> | |
<html> | |
<head> | |
<title>Jasmine Spec Runner</title> | |
<link rel="shortcut icon" type="image/png" href="lib/jasmine-1.1.0/jasmine_favicon.png"> | |
<link rel="stylesheet" type="text/css" href="lib/jasmine-1.2.0/jasmine.css"> | |
<script type="text/javascript" src="lib/jasmine-1.2.0/jasmine.js"></script> |
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
template = $(""" | |
<div> | |
<div class="name"></div> | |
<a class="url"></a> | |
</div> | |
""") | |
data = | |
name: 'Foo Bar' | |
url: 'linkedin.com/foo.bar' |
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
Backbone.EventStream = | |
asEventStream: (eventName, eventTransformer = _.identity) -> | |
eventTarget = this | |
new Bacon.EventStream (sink) -> | |
handler = (args...) -> | |
reply = sink(new Bacon.Next(eventTransformer args...)) | |
if reply == Bacon.noMore | |
unbind() | |
unbind = -> eventTarget.off(eventName, handler) |
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
ClojureScript:phonebook.core> text | |
#<function text($elem, txt) { | |
return $elem.text(txt) | |
}> | |
ClojureScript:phonebook.core> text2 | |
#<function ($elem,txt){ | |
switch(arguments.length){ | |
case 1: | |
return text2__1.call(this,$elem); |
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
curl localhost:3000 |
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
# OLD SYNTAX | |
it "should render list containing simple values", -> | |
template = $ """ | |
<div class="comments"> | |
<span></span> | |
<label>blah</label> | |
</div> | |
""" |
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
it "should ignore null values", -> | |
doc = $ """ | |
<div class="container"> | |
<div class="hello"></div> | |
<div class="goodbye"></div> | |
</div> | |
""" | |
data = | |
hello: 'Hello' |
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
data = [ | |
title: "Cat A" | |
items: [{name: "foo"},{name: "bar"}] | |
, | |
title: "Cat b" | |
items: [{name: "hello"}, {name: "world"}] | |
] |
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
(def book-price 8) | |
(def discounts [1 1 0.95 0.90 0.80 0.75]) | |
(defn price [books] | |
(let [uniques (set books) | |
discount (discounts (count uniques))] | |
(+ (* (count uniques) book-price discount))) (price (remove books uniques))) |