This file contains 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> | |
<style> | |
.axis text { | |
font: 8px sans-serif; | |
} | |
.axis line, | |
.axis path { | |
fill: none; | |
stroke: #000; |
This file contains 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
angular.module('app', []) | |
.factory('throttle', ['$timeout', function ($timeout) { | |
return function (fn, delay) { | |
var timer = null; | |
return function () { | |
var ctx = this, args = arguments; | |
$timeout.cancel(timer); | |
timer = $timeout(function () { | |
fn.apply(ctx, args); | |
}, delay); |
This file contains 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 path = require('path'), | |
fs = require('fs'); | |
module.exports = function (rootComponentPath) { | |
var componentBase, modules, modPaths, modRoutes; | |
modPaths = []; | |
modRoutes = {}; | |
rootComponentPath = rootComponentPath || '.'; |
This file contains 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
/* | |
Usage: | |
module.exports([ | |
'Demo of a prompt?', // cannot be empty | |
'Prompt with a default? (No prob)', // the last parenthesized term will be the default if empty | |
'Dont echo text?*' // end with an asterisk to turn off echoing to console | |
], | |
function (answer1, answer2, answer3) { | |
console.log("You responded with:\n'%s'\n'%s'\n'%s'", answer1, answer2, answer3); |
This file contains 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 net = require('net'); | |
var socket = new net.Socket(); | |
socket.connect(80, 'google.com', function () { | |
socket.pipe(process.stdout); | |
socket.write('GET / HTTP/1.0\n\n'); | |
}); |
This file contains 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 net = require('net'); | |
var socket = new net.Socket(); | |
socket.connect(8124, 'localhost', function () { | |
console.log ('connected'); | |
process.stdin.resume(); | |
process.stdin.pipe(socket); | |
socket.pipe(process.stdout); | |
}); |
This file contains 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 ng-app> | |
<head> | |
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.4/angular.min.js"></script> | |
</head> | |
<body> | |
<span>Clicked: {{clickCount}}</span> | |
<button ng-click='clickCount = clickCount + 1'>Click</button> | |
</body> | |
</html> |
This file contains 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> | |
<head> | |
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.4/angular.min.js"></script> | |
<script src="module.js"></script> | |
</head> | |
<body> | |
<span> | |
{{msg}} | |
</span> | |
<button>Click</button> |
This file contains 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
/*jshint indent:4, forin:true, noarg:true, noempty:true, eqeqeq:true, | |
bitwise:true, strict:true, undef:true, unused:true, curly:true, | |
browser:true, laxcomma:true, jquery:true*/ |
This file contains 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
function compile(fmt) { | |
fmt = fmt.replace(/"/g, '\\"'); | |
var js = ' return "' + fmt.replace(/:([-\w]{2,})(?:\[([^\]]+)\])?/g, function(_, name, arg){ | |
return '"\n + (tokens["' + name + '"](req, res, "' + arg + '") || "-") + "'; | |
}) + '";' | |
return new Function('tokens, req, res', js); | |
}; |