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
'use strict'; | |
const db = require('ff-jsondb')(db_path); | |
// This creates a file at db_path + '/data/file.json' of the stringified | |
// json_object. | |
db.set('/data/file', json_object); | |
// The reads in the file at db_path + '/data/file.json' and returns the parsed | |
// object. |
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
ASCII, the American Standard Code for Information Exchange, (or the IANA | |
preferred US-ASCII) is a 7-bit encoding first standardized in 1960 as part of | |
the ASA, American Standards Association, X3.2. Though the most recent update | |
was in 1986 in the ANSI X3.4-1986 standard [1]. This was also standardized in | |
ISO/IEC 646:1991 [2] and later ratified by ECMA as ECMA-6 [3]. | |
Since ASCII was first standardized there have been proprietary extensions that | |
use the full 8-bit space. First to do so was IBM and their introduction of | |
"code pages" (most commonly called character encodings). Those who've used | |
MS-DOS will recognize CP437 [4]. Along with IBM, other companies such as Apple |
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
#include <v8.h> | |
#include <node.h> | |
using namespace v8; | |
typedef void (*FreeCallback)(Local<Object> object, Local<Function> fn); | |
class CallbackStuff { | |
public: |
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
'use strict'; | |
const http = require('http'); | |
const net = require('net'); | |
const print = process._rawDebug; | |
const FIELDS = isNaN(process.argv[2]) ? 128 : process.argv[2] >>> 0; | |
const PORT = 8080; | |
const headers = | |
'GET / HTTP/1.1\r\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
While the standard 80 character limit for source code can be traced back to the | |
IBM punch card[1] it can still be seen as a good upper bound for how long lines | |
of text should be on modern high definition displays. | |
First thing we must acknowledge is that source code is not read in the | |
traditional sense. Instead developers scan the source using non-linear eye | |
movements[2] or stay fixated in a small area of code while working out the | |
logical details of code being written. The fixation on a single location, even | |
for more than a few seconds, leads to a loss of visual accuity. Which occurs | |
when the eyes do not perform frequent saccadic eye movements.[3] Further |
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
'use strict'; | |
const SlowBuffer = require('buffer').SlowBuffer; | |
let buf_arr = []; | |
let str_arr = []; | |
// Allocate a lot of buffers | |
for (let i = 0; i < 1024 * 4 * 4; i++) { | |
buf_arr.push(new SlowBuffer(1024 * 256)); | |
} |
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
#include <v8.h> | |
#include <node.h> | |
#include <node_buffer.h> | |
#include <string.h> | |
using v8::FunctionCallbackInfo; | |
using v8::Handle; | |
using v8::Isolate; | |
using v8::Local; | |
using v8::Object; |
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
# To display the perf.data header info, please use --header/--header-only options. | |
# | |
# Samples: 127K of event 'cycles' | |
# Event count (approx.): 88135668311 | |
# | |
# Children Self Command Shared Object Symbol | |
# ........ ........ ....... ................... .................................................................................................................................................................................................................................. | |
# | |
59.57% 0.00% iojs [unknown] [.] 0x4736258d4c544155 | |
| |
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
'use strict'; | |
const SlowBuffer = require('buffer').SlowBuffer; | |
const ITER = 1e7; | |
const SIZE = 65536; | |
let t = process.hrtime() | |
for (let i = 0; i < ITER; i++) { | |
new SlowBuffer(SIZE); | |
} |
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
How to build/use | |
- Put these in the same folder then run | |
$ /path/to/nsolid/nsolid $(which node-gyp) rebuild --nodedir=/path/to/nsolid/../ | |
If it builds properly then run | |
$ /path/to/nsolid/nsolid run.js |