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 http = require('http'); | |
http.createServer(function (req, res) { | |
res.writeHead(200, {'Content-Type': 'text/plain'}); | |
res.end('Hello World\n'); | |
}).listen(1337, "127.0.0.1"); | |
console.log('Server running at http://127.0.0.1:1337/'); |
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
// Triangle.js | |
// | |
// Pick up 3 side numbers a[i] to make a triangle from n numbers. | |
// Find the maximum circumference of triangles. | |
// | |
// Constraints : | |
// 3 <= n <= 100 | |
// 1 <= a[i] <= 10^6 | |
var TRI = {}; |
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
if (typeof Object.create != 'function') { | |
Object.create = function (obj) { | |
var F = function () {}; | |
F.prototype = obj; | |
return new F(); | |
}; | |
} |
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
// factorial.js for node.js | |
BD = require("./bigdecimal"); // https://github.com/jhs/bigdecimal.js | |
ONE = new BD.BigDecimal.ONE; | |
// Usage : factorial(BD.BigDecimal("number")) | |
factorial = function (n) { | |
if (n.compareTo(ONE) == 0) { | |
return ONE; | |
} else { | |
return n.multiply(factorial (n.subtract(ONE))); |
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
// mathcontext & bigdecimal.js is http://stz-ida.de/index.php?option=com_content&id=18 | |
load("mathcontext.js"); | |
load("bigdecimal.js"); | |
ONE = new BigDecimal("1"); | |
// Usage : factorial(new BigDecimal("number")) | |
function factorial (n) { | |
if (n.compareTo(ONE) == 0) { | |
return ONE; | |
} else { |
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
//////////////////////////////////////////////////////////////////////////////////////// | |
// Big Integer Library v. 5.4 | |
// Created 2000, last modified 2009 | |
// Leemon Baird | |
// www.leemon.com | |
// | |
// Version history: | |
// v 5.4 3 Oct 2009 | |
// - added "var i" to greaterShift() so i is not global. (Thanks to PŽter Szab— for finding that bug) | |
// |
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: coffee factorial.coffee _number_ | |
bi = (require "./bigdecimal").BigInteger # github.com/jhs/bigdecimal.js | |
ONE = bi '1' | |
n = bi (process.argv[2] or= '100') | |
# factorial (BigInteger) returns BigInteger | |
factorial = (x) -> | |
if x.compareTo(ONE) is 0 | |
ONE | |
else |
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
;------------------------------------------------------------------------- | |
; | |
; The WOZ Monitor for the Apple 1 | |
; Written by Steve Wozniak 1976 | |
; | |
;------------------------------------------------------------------------- | |
.CR 6502 | |
.OR $FF00 | |
.TF WOZMON.HEX,HEX,8 |
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 http = require("http"); | |
var port; | |
if (process.argv.length < 3) { | |
port = 8192; | |
} else { | |
port = process.argv[2]; | |
} | |
http.createServer(function(requset, response) { |
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 fs = require('fs'); | |
fs.readdir( process.argv[2], function (err, files) { | |
if (!err) | |
console.log(files); | |
else | |
throw err; | |
}); | |
console.log("Fired callback."); |
OlderNewer