Skip to content

Instantly share code, notes, and snippets.

View angus-c's full-sized avatar

angus croll angus-c

View GitHub Profile
@angus-c
angus-c / index.html
Created September 25, 2014 05:05
A Bouncing Ball // source http://jsbin.com/hidori/75
<!DOCTYPE html>
<html>
<head>
<title>A Bouncing Ball</title>
</head>
<body>
<canvas id="canvas" width="300" height="300"></canvas>
<input id="delay" type="range" max="2000" value="10"/>
@angus-c
angus-c / index.html
Created September 23, 2014 16:39
A Bouncing Ball // source http://jsbin.com/hidori/11
<!DOCTYPE html>
<html>
<head>
<title>A Bouncing Ball</title>
</head>
<body>
<canvas id="canvas" width="300" height="300"></canvas>
<input id="delay" type="range" max="2000" value="10"/>
@angus-c
angus-c / index.html
Created September 22, 2014 04:18
A Bouncing Ball // source http://jsbin.com/figotoreqoxe/83
<!DOCTYPE html>
<html>
<head>
<title>A Bouncing Ball</title>
</head>
<body>
<canvas id="canvas" width="300" height="300"></canvas>
<input id="delay" type="range" max="2000" value="10"/>

So long as you write what you wish to write, that is all that matters; but to sacrifice a hair of the head of your vision, a shade of its colour, in deference to some professor with a measuring-rod up his sleeve, is the most abject treachery...

– Virginia Woolf on breaking the rules.

Array.apply(0,Array(123)).map(String.fromCharCode).slice(97)
i=96,r=[];while(i++<122)r.push(String.fromCharCode(i));r
String.fromCharCode[b='apply'](0,(a=Array)[b](0,a(123)).map(Date.call,Number)).slice(97)
eval('i=97;String.fromCharCode('+Array(26).join('i++,')+'i)')
/*
sayIt accepts an unlimited number of chaining calls, each passing a word. When it's finally called
without arguments, all the passed words are printed in order
sayIt('have')('you')('got')('any')('fish')('fingers?')(); ->
"have you got any fish fingers?"
A regular implementaion would go sthg like this
function sayIt(firstWord) {
@angus-c
angus-c / sleepSpeakMemory
Last active August 29, 2015 13:57
9 year-old Vladimir Nabokov trying to fall asleep (from Speak, Memory)
Now she has entered her room. A brisk interchange of light values tells me that the candle on her bed table takes over the job of the ceiling cluster of bulbs, which, having run up with a couple of clicks two additional steps of natural, and then supernatural, brightness, clicks off altogether. My line of light is still there, but it has grown old and wan, and flickers whenever Mademoiselle makes her bed creak by moving. For I still hear her. Now it is a silvery rustle spelling "Suchard"; now the trk-trk-trk of a fruit knife cutting the pages of La Revue des Deux Mondes. [...] I am in acute distress, desperately trying to coax sleep, opening my eyes every few seconds to check the faded gleam [...].
The inevitable happens: the pince-nez case shuts with a snap, the review shuffles onto the marble of the bed table, and gustily Mademoiselle's pursed lips blow; the first attempt fails, a groggy flame squirms and ducks; then comes a second lunge, and light collapses. In that pitchy blackness [...] finally my
So there we were at the Red Drum, a tableful of beers a few that is and all the gangs cutting in and out, paying a dollar quarter at the door, the little hip-pretending weasel there taking tickets, Paddy Cordavan floating in as prophesied (a big tall blond brakeman type subterranean from Eastern Washington cowboy-looking in jeans coming in to a wild generation party all smoky and mad and I yelled, "Paddy Cordavan?" and "Yeah?" and he'd come over)--all sitting together, interesting groups at various tables, Julien, Roxanne (a woman of 25 prophesying the future style of America with short almost crewcut but with curls black snaky hair, snaky walk, pale pale junky anemic face and we say junky when once Dostoevski would have said what? if not ascetic but saintly? but not in the least? but the cold pale booster face of the cold blue girl and wearing a man's white shirt but with the cuffs undone untied at the buttons so I remember her leaning over talking to someone after having been slinked across the floor with f
//the old way
var a= {
aa: function() {
return this;
}
}
a.aa(); //a :)
// Arrow functions would have been useful for defining concise formulae to be invoked in
// the context of other objects.
// For example here's an object describing a piece of rope. It includes a method which
// returns the area enclosed by the rope.
// Since the enclosed area will vary according to the shape of the rope, the area method
// accepts a formula for calculating the area based on a specified shape.
// However with fat arrows, the context is static and tight-bound so 'this' is wrong and
// 'call' is useless