Skip to content

Instantly share code, notes, and snippets.

typeToName = ["gb", "rb", "bb", "yb", "sgb", "srb", "sbb", "syb", "sb", "sub", "td", "tdm", "db", "1eab", "2eab", "sbv", "sbh", "sbc", "pgb", "prb", "pbb", "pyb"];
var bitsPerChar = 14; // 14 bits fit in the CJK character range, 0x4E00 -> 0x9FCF
var arrowBits = Math.ceil(Math.log( 20 )/Math.log(2));
var amountBits = Math.ceil(Math.log( 256 )/Math.log(2));
var gameWidth = 11;
var gameHeight = 14;
var types = typeToName.length;
nameToType = [];
var i = types;
@Dykam
Dykam / gist:749144
Created December 20, 2010 22:41
Html templates, how it is done currently and what I dislike about that
<h1>{title}</h1>
<p>{item}</p>
@Dykam
Dykam / gist:749167
Created December 20, 2010 22:55
Html templates, my way
<html>
<head>
<title>Template</title>
</head>
<body>
<div class="Content">
<h1>Post Title</h1>
<p class="Item"></p>
<p class="Author"></p>
</div>
<span id="NotLoggedIn">You are not logged in! Please log in.</span>
{
".Foo": [],
".Foo": "ContentWhichYouNeverWillSee"
}
<html>
<head>
<title>foo</title>
</head>
</html>
# 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
Foo:
Bar:
class Zar:
constructor: ->
class Zoo:
constructor: ->
#or
Foo:
Bar:
Zar: class
@Dykam
Dykam / gist:808153
Created February 2, 2011 18:42
javascript `with` immitated in coffeescript
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"
var json_data = JSON.stringify({
"STATUS_ID is": status,
"COMMAND is": command_str.trim(),
"RESULT is": result_str
},
null, '\n');