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
----------------- | |
my_world.rb | |
class MyWorld | |
def initialize | |
@king = King.new | |
end | |
def king_of_the_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
div A single activity | |
ul.activity | |
li.date | |
li.activity | |
li.comment | |
li.user | |
div Multiple activities | |
table | |
tr |
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))) |
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
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
# 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
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
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
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
template = $(""" | |
<div> | |
<div class="name"></div> | |
<a class="url"></a> | |
</div> | |
""") | |
data = | |
name: 'Foo Bar' | |
url: 'linkedin.com/foo.bar' |