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 EventEmitter = require('events').EventEmitter; | |
var util = require('util'); | |
// Here is the Ticker constructor | |
var Ticker = function() { // This is a pseudo-class | |
} | |
util.inherits(Ticker, EventEmitter); | |
// Emit tick on the tick event |
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> <head> <title>file.js</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> file.js </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">¶</a> </div> <p>This is a JavaScript comment</p> </td> <td class="code"> <div class="highlight"><pre></pre></div> </td> </tr> <tr id="section-2"> <td class="docs"> <div class="pilwrap"> |
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
// This is a JavaScript comment | |
console.log('This is some output.') | |
// Another comment | |
console.log('More output.'); | |
// Last comment | |
// but no output! |
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 http = require('http'); | |
function catch_sigint (server) { | |
process.on('SIGINT', function () { | |
process.stdout.write('\r'); | |
console.log('Interrupt'); | |
try { | |
server.close(); | |
} catch (e) { |
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
#!/bin/sh | |
# Figure out what we are comparing to. | |
if git-rev-parse --verify HEAD >/dev/null 2>&1 ; then | |
against=HEAD | |
else | |
# Initial commit: diff against an empty tree object | |
against=2ca2a592640b979a4092c19daa1938f9dd1baa46 | |
fi |
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
<div class="notice-box"> | |
<img id="picture" class="small box" src="/josh.jpg"> | |
<span id="name" class="push-2">Joshua Kehn</span> | |
<ul id="notifications"> | |
<li class="notification">Someone commented</li><li class="notification">A server went down</li><li class="notification">The grilled cheese is ready</li><li class="notification">Downtime scheduled</li></ul> | |
</div> | |
<div id="settings box"> | |
<li><input class="input-email" id="email" value="[email protected]"></li> | |
<li><input class="input-number" id="age" value="24"></li> |
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
map : function (parent, element, key, value) { | |
if (key === 'sources') { | |
element.setAttribute('data-original', value); | |
element.setAttribute('href', '/source/link/' + value); | |
element.innerHTML = value; | |
} | |
} |
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 me = { | |
name : 'Joshua Kehn', | |
picture : '/josh.jpg', | |
age : 24, | |
email : "[email protected]", | |
notification : [ | |
'Someone commented', | |
'A server went down', | |
'The grilled cheese is ready', | |
'Downtime scheduled' |
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
<div id="profile"> | |
<div class="notice-box"> | |
<img id="picture" class="small box" src="/nopicture.jpg" /> | |
<span id="name" class="push-2">Username</span> | |
<ul id="notifications"> | |
<li class="notification">No notifications</li> | |
</ul> | |
</div> | |
<div id="settings box"> |
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 Laws = { | |
drinking_age : function (fn) { | |
fn(this.age > 21); | |
} | |
} | |
/* snip */ | |
Laws.drinking_age.call(this, function (able_to_drink) { |