Skip to content

Instantly share code, notes, and snippets.

@tilgovi
tilgovi / README.md
Created June 20, 2012 23:09 — forked from mbostock/.block
Fisheye Grid

The above grid shows the effect of fisheye distortion. Move the mouse to change the focal point.

@tilgovi
tilgovi / case.js
Created December 2, 2011 03:12 — forked from jhs/case.js
A better case statement?
// Prettier case statement, but can also return a value since it is an expression.
//
first_condition
? first_action()
: second_condition
? second_action()
: third_condition && can && (be || compound)
? (
can(),
chunkify(InList, BaseChunkSize) ->
%%io:format("length of list is ~p and chunk size is ~p ~n",[length(InList),BaseChunkSize]),
case byte_size(term_to_binary(InList)) of
Size when Size > BaseChunkSize ->
NumberOfChunksLikely = ((Size div BaseChunkSize) + 1),
ChunkThreshold = Size div NumberOfChunksLikely,
chunkify(InList, ChunkThreshold, [], 0, []);
_Else ->
[InList]
end.
@tilgovi
tilgovi / couchdb-custom-header-attachments.txt
Created May 7, 2011 00:57 — forked from max-mapper/couchdb-custom-header-attachments.txt
spec for specifying custom headers on attachments in couchdb
INLINE ATTACHMENT
{
_attachments: {
"awesome.jpeg": {
content_type: "image/jpeg",
data: "base64 data goes here",
headers: {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET, POST, OPTIONS",