This file contains hidden or 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 assert = require('assert') | |
, subclass = function(type, proto){ | |
// make sure we are extending a global constructor | |
// accepted: [Boolean, Number, String, Array, Object, Function, RegExp, Date] | |
if(!global[type.name] || global[type.name].name != type.name) throw new Error(); | |
var constructor = proto.constructor, | |
keys = Object.keys(proto), | |
Obj = process.binding('evals').Script.runInNewContext('x = '+type.name), // eval ftw |
This file contains hidden or 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
// pluck | |
function getProp(thing, key) { | |
if (thing === null || thing === undefined) return thing | |
var prop = thing[key] | |
return typeof prop === 'function' ? prop.call(thing) : prop | |
} | |
function drillInto(thing, keyPath) { | |
return keyPath.split('.').reduce(function(memo, key) { |
This file contains hidden or 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
class Symbol | |
# Turns a symbol into a proc. | |
# | |
# Example: | |
# # The same as people.map { |p| p.birthdate } | |
# people.map(&:birthdate) | |
# | |
def to_proc | |
Proc.new {|thing, *args| thing.send(self, *args)} | |
end |
This file contains hidden or 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
// spot the mistake | |
var objects = [self valueForKeyPath:param], | |
length = [objects count], | |
index = length; | |
average = 0.0; | |
// try again | |
var objects = [self valueForKeyPath:param] | |
, length = [objects count] | |
; index = length |
This file contains hidden or 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
<body> | |
<div class="share_container"> | |
<div class="close"> | |
<a id="close" href="#"></a> | |
<div class="instruction"></div> | |
</div> | |
<div class="cover"> | |
<div class="instruction"></div> | |
</div> | |
</div> |
This file contains hidden or 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
<!DOCTYPE html> | |
<html manifest="chalk.manifest"> |
This file contains hidden or 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
html { | |
background: #000 url(/images/background.jpg) no-repeat; | |
-webkit-user-select: none; | |
} | |
@media only screen and (orientation:landscape) { | |
html { | |
background-position-y: -129px; | |
} | |
} |
This file contains hidden or 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
#shade { | |
position: absolute; | |
top: 0; | |
left: 0; | |
width: 0; | |
height: 0; | |
z-index: 10; | |
visibility: hidden; | |
-webkit-transition: visibility 0.5s ease-in-out; | |
} |
This file contains hidden or 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
#chalkboard { | |
position: absolute; | |
} | |
#chalkboard, | |
#canvas, | |
#output { | |
width: 768px; | |
height: 690px; | |
} |
This file contains hidden or 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
#tools div.indicator { | |
position: absolute; | |
opacity: 0; | |
background-image: url(../images/chalk-sprites.png); | |
background-repeat: no-repeat; | |
background-position-y: -230px; | |
width: 36px; | |
height: 25px; | |
bottom: -15px; | |
left: 50%; |