Skip to content

Instantly share code, notes, and snippets.

View lxe's full-sized avatar
🦀
Crab

Aleksey Smolenchuk lxe

🦀
Crab
View GitHub Profile
CXX(target) Release/obj.target/bignum/bignum.o
In file included from ../bignum.cc:8:
In file included from ../../nan/nan.h:74:
In file included from ../../nan/nan_new.h:190:
../../nan/nan_implementation_12_inl.h:181:66: error: too many arguments to function call, expected at most 2, have 4
return v8::Signature::New(v8::Isolate::GetCurrent(), receiver, argc, argv);
~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~
/Users/aleksey/.node-gyp/5.3.0/include/node/v8.h:4674:3: note: 'New' declared here
static Local<Signature> New(
Searching 1282 files for "pulseTillDone\(" (regex)
/Users/aleksey/.nvm/v0.10.32/lib/node_modules/npm/lib/fetch-package-metadata.js:
109 pickVersionFromRegistryDocument(clone(regCache[url]))
110 } else {
111: npm.registry.get(url, {auth: auth}, pulseTillDone('fetchMetadata', iferr(next, pickVersionFromRegistryDocument)))
112 }
113 function returnAndAddMetadata (pkg) {
/Users/aleksey/.nvm/v0.10.32/lib/node_modules/npm/lib/cache/add-named.js:
@lxe
lxe / npm_install_node_4_2_2_hapijs.cpuprofile
Last active November 13, 2015 23:55
npm3 install flamegraphs
This file has been truncated, but you can view the full file.
{
"typeId": "CPU",
"uid": 1,
"title": "Profile 1",
"head": {
"functionName": "(root)",
"url": "",
"lineNumber": 0,
"callUID": 1437,
"bailoutReason": "",

ES6 Shit

I started converting simple things into the cool new Babel/ES6/ES2015. Turns out that a lot of the new features are very much half-assed.

Root exports handling

Let's use export syntax to replicate:

module.exports = function () {};
@lxe
lxe / movingtosfsalary.md
Last active July 19, 2017 07:54
Easy way to calculate San Francisco salary requirements if you're moving from Pittsburgh

Easy way to calculate SF salary requirements if you're moving from Pittsburgh.

  1. Let's say you are currently paying 800/month for a nice one-bedroom in Pittsburgh.
  • If you would like to stay in a one-bedroom, You will/should be paying about $2500-3500 / month for it in SF
  • If you want to split with roommates, you will/should be paying $1000-2000 in SF
  1. Calculate the difference between your current rent and your guestimated SF rent:
  • 3200 (nice one-bedroom rent price) - 800 = 2400
  1. Adjust negative car and utility
@lxe
lxe / README.md
Last active August 29, 2015 14:20

All of the npm packages (May 7, 2015)

# Get all of the NPM metadata (82M file)!
curl -s -H "Transfer-Encoding: chunked" http://registry.npmjs.org/-/all > all.json

# Get all of the package names (155k of them)!
jq 'map(.name)' all.json > allnpm.json

# There are 171 case-insensitive repeating package names:
@lxe
lxe / hello-world-emscripten.js
Last active November 1, 2016 13:23
hello-world-emscripten-closurecompiled.js
// Original Source:
// #include <stdio.h>
//
// int main(int argc, char **argv) {
// printf("Hello World\n");
// return 0;
// }
//
var Module;
var request = require('request')
, JSONStream = require('JSONStream')
, es = require('event-stream')
var req = request({url: 'http://isaacs.couchone.com/registry/_all_docs'});
var parse = JSONStream.parse('rows.*');
var map = es.map(function (data) {
// console.log(data);
return data;
});
var fs = require('fs');
var stream = require('stream');
var ts = new stream.Transform();
ts._transform = function(chunk, enc, cb) {
// 'chunk' is the data from the readable source
//
// 'this.push(whatever)' or callback(err, whatever) writes
// to target writeable
@lxe
lxe / httpreqstreams.js
Last active August 29, 2015 14:11
httpreqstreams.js
// Works (console.logs the headers)
require('http').request('http://www.google.com')
.on('response', function (response) {
console.log(response.headers);
})
.end();
// Doesn't work (hangs)
require('http').request('http://www.google.com')
.on('response', function (response) {