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
| squogre:/tmp:% cat test.js | |
| (function ThisIsFunctionName() {throw new Error()})() | |
| squogre:/tmp:% node test.js | |
| node.js:201 | |
| throw e; // process.nextTick error, or 'error' event on first tick | |
| ^ | |
| Error | |
| at ThisIsFunctionName (/tmp/test.js:1:101) |
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
| try { | |
| (function ThisIsFunctionName() { | |
| throw new Error() | |
| })() | |
| } catch(x) { | |
| console.log(x.stack) | |
| } | |
| Error | |
| at ThisIsFunctionName (unknown source) |
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
| define('test', { | |
| task1: function(cb) { | |
| require('dep', function() { | |
| // do smth | |
| cb(); | |
| }); | |
| }, | |
| }); |
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
| class WrapFunc | |
| constructor: -> | |
| for key of @ | |
| do (key) => | |
| old_fn = @[key] | |
| @[key] = => | |
| console.log('wrapping call to ' + key) | |
| old_fn.apply(@, arguments) |
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
| #!/usr/bin/node | |
| var net = require('net'); | |
| var fs = require('fs'); | |
| var server = require('net').createServer(function(conn) { | |
| var upsock = new net.Socket(); | |
| var send = []; | |
| var connected = false; | |
| var connecting = false; | |
| console.log('===== CONNECT ====='); |
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 net = require('net'); | |
| net.createServer(function (socket) { | |
| socket.setEncoding("ascii"); | |
| socket.on("data", function (data) { | |
| data = data.trim(); | |
| console.log('Serving: ', data); | |
| if (data == 'img') { | |
| socket.write('The reference images:\r\n'); | |
| socket.write('\r\n'); |
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 crypto = require('crypto'); | |
| var crc32 = require('crc').crc32; | |
| var x = 1; | |
| while(1){ | |
| var string = ''; | |
| for (var j=0; j<x; j++) { | |
| string += String(Math.random()); |
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 cookie = require('./') | |
| var acc, x; | |
| console.log(x = cookie.sign('hello', 'test')) | |
| function quantile(arr, from, to) { | |
| from = Math.floor((arr.length) * from) | |
| to = Math.ceil((arr.length) * to) | |
| var s = 0 | |
| arr = arr.sort() |
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 eve = require('EVE') | |
| var type = eve.type | |
| schema = type.object({ | |
| number: type.number().min(5), | |
| something: type.string().trim().notEmpty().required() | |
| }) | |
| console.log(schema.val({number:'123'}).validate()) |
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
| function get_global() { | |
| if (typeof(window) === 'undefined' && typeof(window) === 'object' && window != null && window.window === window) | |
| return window | |
| if (typeof(global) === 'undefined' && typeof(global) === 'object' && global != null && global.global === global) | |
| return global | |
| } |
OlderNewer