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
Number.prototype.__defineGetter__('f', function() { return this.toFixed(2) }) | |
var b = 2345.324234 | |
console.log('b:', b.f) | |
// outputs: 2345.32 |
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
test here! |
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
$ npm --loglevel verbose uninstall yui3 | |
npm info it worked if it ends with ok | |
npm verb cli [] | |
npm info using npm@0.2.7-3 | |
npm info using node@v0.2.4 | |
npm verb config file /home/plato/.npmrc | |
npm verb config file /usr/local/etc/npmrc | |
npm info removing [ [ 'yui3', '0.5.9' ] ] | |
npm ERR! Error: ENOENT, No such file or directory '/usr/local/lib/node/.npm/yui3/0.5.9/package/package.json' | |
npm ERR! at node.js:772:9 |
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
$ npm --loglevel verbose uninstall yui3 | |
npm info it worked if it ends with ok | |
npm verb cli [] | |
npm info using npm@0.2.7-3 | |
npm info using node@v0.2.4 | |
npm verb config file /home/plato/.npmrc | |
npm verb config file /usr/local/etc/npmrc | |
npm info removing [ [ 'yui3', '0.5.9' ] ] | |
npm verb caching /usr/local/lib/node/.npm/yui3/0.5.9/package/package.json | |
npm info preuninstall yui3@0.5.9 |
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
meryl.p('GET /lib/*', function(req, res, next) { | |
var pathname = req.params.pathname | |
, filename = path.join(publicDir, pathname) | |
fs.readFile(filename, 'utf8', function(err, data) { | |
pathname = pathname.replace(/^\/lib\//, "").replace(/.js$/,"") | |
res.send("require.module('" + pathname + "', function(module, exports, require) {\n// start module: " + pathname + "\n\n" + data + "\n\n// end module: "+ pathname +"\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
// Flash websockets policy server | |
net.createServer(function (socket){ | |
socket.write([ | |
'<?xml version="1.0"?>' | |
, '<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">' | |
, '<cross-domain-policy>' | |
, '<allow-access-from domain="*" to-ports="*"/>' | |
, '</cross-domain-policy>' | |
].join('\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
// node-github leak? | |
var GitHubApi = require('github').GitHubApi | |
, github = new GitHubApi(true) | |
, repoApi = github.getRepoApi() | |
setInterval(function() { | |
repoApi.getRepoLanguages('ry', 'node', function(err, data) { | |
if (!err) console.log('.') | |
}) |
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
server.on('error', function (e) { | |
if (e.errno == require('constants').EADDRINUSE) { | |
log('Address in use, retrying...') | |
setTimeout(function () { | |
server.close() | |
server.listen(PORT, HOST) | |
}, 1000) | |
} | |
}) |
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
// typeof alternative | |
var check = function() { | |
var args = Array.prototype.slice.call(arguments) | |
, o = args[0] | |
, a = args.slice(1) | |
if (typeof o !== 'undefined' && (typeof o[a[0]] !== 'undefined') || !a.length && typeof o !== 'undefined') | |
if (a.length > 1) { | |
b = o[a[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
{ message: 'Parse Error', | |
stack: [Getter/Setter], | |
bytesParsed: 21260 } [ ' at Client.onData [as ondata] (http.js:889:27)', | |
' at Client._onReadable (net.js:762:27)', | |
' at IOWatcher.onReadable [as callback] (net.js:276:10)' ] |