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
# http://www.webelements.com/aluminium/ | |
# http://environmentalchemistry.com/yogi/periodic/Al.html | |
# http://www.chemicool.com/elements/aluminum.html | |
parseWikipediaTableOfElements = -> | |
urls = [] | |
$("#mw-content-text table tr td[title] a").each -> | |
urls.push($(this).attr('href')) | |
urls |
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
// Uses [request](https://github.com/mikeal/request) | |
// /?url=http://nodejs.org/logo.png | |
// /?uri=http://nodejs.org/logo.png | |
// /?url=http://nodejs.org/logo.png&cb=cbName | |
// /?url=http://nodejs.org/logo.png&callback=cbName | |
var fs = require('fs'); | |
var url = require('url'); | |
var http = require('http'); | |
var request = require('request'); |
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 httpAgent = require('http-agent'), | |
util = require('util'); | |
var agent = httpAgent.create('www.google.com', ['finance', 'news', 'images']); | |
agent.addListener('next', function (err, agent) { | |
console.log('Body of the current page: ' + agent.body); | |
console.log('Response we saw for this page: ' + util.inspect(agent.response)); | |
// Go to the next page in the sequence |
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
#!/usr/bin/env node | |
require(__dirname+"/processor-usage.js").startWatching(); | |
var shouldRun = true; | |
var desiredLoadFactor = .5; | |
function blockCpuFor(ms) { | |
var now = new Date().getTime(); | |
var result = 0 |
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
curl localhost:3000 |
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 blah = setTimeout(function () { | |
console.log('example dying'); | |
}, 30000); | |
var blah2 = setTimeout(function () { | |
console.log('example debugging'); | |
process.stdout.write('example debugging'); | |
// debugger; | |
}, 5000); |
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 server = require( 'http' ).createServer(); | |
// our html template | |
var script = function( f ) { | |
// get just the content of this script | |
var s = /^[^\{]+\{\n?([\s\S]+)\}/.exec( f )[1]; | |
return [ | |
'<!DOCTYPE html><html>', | |
'<head>', | |
'<script type="text/javascript">',s,'</script>', |
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
start_date = Date.now() | |
old_date = start_date | |
seconds_running = 120 | |
console.log('Starting Program at: ' + Date()) | |
loop_flag = true | |
loop() | |
function loop() { |
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 request = require('request') | |
/** | |
* Handle multiple requests at once | |
* @param urls [array] | |
* @param callback [function] | |
* @requires request module for node ( https://github.com/mikeal/request ) | |
*/ | |
var __request = function (urls, callback) { |
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 TestProp () { | |
var p1 = 'abc'; | |
var priFunc = function() { | |
console.log('Im private function'); | |
} | |
this.privilegeFunc = function () { | |
console.log('Im priviledge function'); | |
} | |
this.pubProp = "Public property"; | |
} |