Skip to content

Instantly share code, notes, and snippets.

@zkessin
zkessin / gist:3691499
Created September 10, 2012 15:24
run coffeescript
#!/bin/bash
COUNTER=0
while [ $COUNTER -lt 10 ]; do
clear
coffee --compile --output js-out --watch .
done
@zkessin
zkessin / stream.erl
Created September 13, 2012 19:14
Erlang Data Streaming
-module(streaming).
-export([stream_data/1, out/1, stream_from_file/3]).
out(_Arg) ->
_Pid = spawn_link(?MODULE, stream_data, [self()]),
{streamcontent, "audio/mp3", <<>>}.
stream_data(Pid) ->
File = "/home/erlang/erlang-talk/audio.mp3",
FileHDL = open_file(File),
stream_from_file(Pid, FileHDL, 1).
@zkessin
zkessin / 02_underscore.coffee
Created September 14, 2012 08:13
Underscore chaining
_.chain([1,2,3,4,5,6,7,8])
.filter((x) -> x > 3)
.map((x) -> x * x)
.map((x) -> x + 1)
.value() #> [17, 26, 37, 50, 65]
_.filter([1,2,3,4], is_even) #> [2,4]
@zkessin
zkessin / all_and_any.js
Created September 14, 2012 08:52
All and Any
_.any([1,2,3,4], function (x) {return x % 2 === 0;});
_.all([1,2,3,4], function (x) {return x % 2 === 0;});
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>QUnit Example</title>
<link rel="stylesheet" href="/resources/qunit.css">
</head>
<body>
<div id="qunit"></div>
<script src="/resources/qunit.js"></script>
test( "hello test", function() {
ok( 1 == "1", "Passed!" );
});
module("group a")
test( "hello test", function() {
ok( 1 == "1", "Passed!" );
});
module("group b")
test( "Goodbye Test", function() {
//....
});
test("AjaxTest", function ()
stop()
$.ajax({
success: function (Result)
start()
equal(ExpectedResult, Result)
}))
test("AjaxTest", function ()
expect(1)
stop()
$.ajax({
success: function (Result)
start()
equal(ExpectedResult, Result)
}))