Skip to content

Instantly share code, notes, and snippets.

View ankur-anand's full-sized avatar
💭
Seize The Day!

Ankur Anand ankur-anand

💭
Seize The Day!
View GitHub Profile
@ankur-anand
ankur-anand / flatbufferInstall.md
Last active September 21, 2024 18:22
Install FlatBuffers On Linux
$ git clone https://github.com/google/flatbuffers.git
$ cd flatbuffers
$ cmake -G "Unix Makefiles"
$ make
$ ./flattests # this is quick, and should print "ALL TESTS PASSED"
$ sudo make install #install
$ sudo ldconfig #Configuring a dynamic link library
$ flatc --version #Check if FlatBuffers is installed successfully
@ankur-anand
ankur-anand / v8.md
Created June 29, 2018 18:13 — forked from kevincennis/v8.md
V8 Installation and d8 shell usage

Installing V8 on a Mac

Prerequisites

  • Install Xcode (Avaliable on the Mac App Store)
  • Install Xcode Command Line Tools (Preferences > Downloads)
  • Install depot_tools
    • git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
    • sudo nano ~/.bash_profile
  • Add export PATH=/path/to/depot_tools:"$PATH" (it's important that depot_tools comes first here)
@ankur-anand
ankur-anand / gist:0ed65c61d099ddb7a4f3a7f755564d22
Created June 28, 2018 18:51 — forked from totherik/gist:3a4432f26eea1224ceeb
v8 --allow-natives-syntax RuntimeFunctions
Per https://code.google.com/p/v8/codesearch#v8/trunk/src/runtime.cc
%CreateSymbol
%CreatePrivateSymbol
%CreateGlobalPrivateSymbol
%NewSymbolWrapper
%SymbolDescription
%SymbolRegistry
%SymbolIsPrivate
@ankur-anand
ankur-anand / curl.md
Created April 25, 2018 14:22 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@ankur-anand
ankur-anand / cpu.js
Created April 7, 2018 17:46 — forked from bag-man/cpu.js
How to calculate the current CPU load with Node.js; without using any external modules or OS specific calls.
var os = require("os");
//Create function to get CPU information
function cpuAverage() {
//Initialise sum of idle and time of cores and fetch CPU info
var totalIdle = 0, totalTick = 0;
var cpus = os.cpus();
//Loop through CPU cores
@ankur-anand
ankur-anand / ultimate-ut-cheat-sheet.md
Created March 23, 2018 07:41 — forked from yoavniran/ultimate-ut-cheat-sheet.md
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai and Sinon

The Ultimate Unit Testing Cheat-sheet

For Mocha, Chai and Sinon

using mocha/chai/sinon for node.js unit-tests? check out my utility: mocha-stirrer to easily reuse test components and mock require dependencies


const router = [{
path: '*',
method: '*',
handle: function(req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('404');
}
}];
@ankur-anand
ankur-anand / listenv1.js
Last active March 20, 2018 11:04
mini-expressjs gist
listen(port, cb) {
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader("Content-Type", "text/plain");
res.end("Hello World\n");
});
return server.listen.apply(server, arguments);
}
@ankur-anand
ankur-anand / 1-promise-error-handling.md
Created March 13, 2018 18:41 — forked from domenic/1-promise-error-handling.md
Proposal for promise error handling hooks

Promise Error Handling Hooks

Problem

A common desire in web programming is to log any uncaught exceptions back to the server. The typical method for doing this is

window.onerror = (message, url, line, column, error) => {
  // log `error` back to the server
};
@ankur-anand
ankur-anand / gist:68677c9a0d74aa65d0869c42b3fecd86
Created March 13, 2018 18:31 — forked from benjamingr/gist:0237932cee84712951a2
Promise unhandled rejection tracking global handler hook

Possibly Unhandled Rejection NodeJS Promise Hook

###Unhandled Rejection Tracking

Several promise libraries such as bluebird and when as well as some native promise implementations offer potentially unhandled rejection tracking. This means that the following:

Promise.reject(new Error("err")); // never attach a `catch`