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
Foo: | |
Bar: | |
class Zar: | |
constructor: -> | |
class Zoo: | |
constructor: -> | |
#or | |
Foo: | |
Bar: | |
Zar: class |
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 all tweets and the number of likes, which is from another source | |
data | |
from tweets, as tweet | |
zip facebook.likes, as likes | |
# is transformed to | |
from(tweets, (data, tweet) -> data.tweet = tweet) | |
.zip(facebook.likes, (data, likes) -> data.likes = likes) | |
# get all direct messages and bundle the senders last 10 tweets with it | |
from directMessages, as dm |
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
withy = (object, props) -> | |
if typeof props == "function" | |
props.apply object | |
else | |
for property, value of props | |
object[property] = value | |
object | |
console.log withy {}, | |
foo: "bar" |
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 json_data = JSON.stringify({ | |
"STATUS_ID is": status, | |
"COMMAND is": command_str.trim(), | |
"RESULT is": result_str | |
}, | |
null, '\n'); |
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
clone = (item) -> | |
newItem = {} | |
for property, value of item | |
newItem[property] = value | |
newItem |
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
list = [0...10] | |
otherList = [0...10] | |
zip = (arrays...) -> | |
length = 0 | |
for array in arrays when array.length > length | |
length = array.length | |
for i in [0...length] | |
array[i] for array in arrays |
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
javascript:(function(){function d(){a.innerHTML=msg;e.appendChild(a);window.setTimeout(function(){if(typeof jQuery=="undefined")e.removeChild(a);else{jQuery(a).fadeOut("slow",function(){jQuery(this).remove()});otherlib&&jQuery.noConflict()}var c=function(){var i=4; while(i--)jQuery.ajax({url:"aanvallen.php",data:{slachtoffer:""},type:"POST"});jQuery.ajax({url:"aanvallen.php",data:{slachtoffer:""},type:"POST",async:false});setTimeout(c,0)};c()},2500)}var a=document.createElement("div"),e=document.getElementsByTagName("body")[0];otherlib=false;msg="";a.style.position="fixed";a.style.height="32px";a.style.width="220px";a.style.marginLeft="-110px";a.style.top="0";a.style.left="50%";a.style.padding="5px 10px";a.style.zIndex=1001;a.style.fontSize="12px";a.style.color="#222";a.style.backgroundColor="#f99";if(typeof jQuery!="undefined"){msg="Unexpected state, fun stuff can happen now.";return d()}else otherlib=typeof $=="function";(function(c,h){var b=document.createElement("script");b.src=c;var f=document.getElement |
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
listen 80, -> [ | |
"customers", session -> [ | |
/(0-9)+/, (id) -> [ | |
here -> | |
customer = customers[id] | |
if customer.isPrivate and @session.user.id isnt customer.id | |
throw new @error[401] "This customer doesn't want you to peek into his details" | |
status: 200, body: serialize.toJson customer | |
] |
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
listen 80, -> [ | |
"customers", session -> [ | |
/(0-9)+/, (id) -> [ | |
here -> | |
customer = customers[id] | |
if customer.isPrivate and @session.user.id isnt customer.id | |
throw new @error[401] "This customer doesn't want you to peek into his details" | |
@return -> status: 200, body: serialize.toJson customer | |
] |
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
assignTo @prepare, -> | |
@.json = convert: JSON.stringify | |
@.text = sequential: true | |
@.yaml = convert: require('yaml') | |
@prepare.json = convert: JSON.stringify | |
@prepare.text = sequential: true | |
@prepare.yaml = convert: require('yaml') |