Measuring sync vs async child processes in Node.js
- macOS 10.12.3
- Node.js 7.4.0
childProcess
const childProcess = require('child_process');
/* Metaproxy | |
* The proxy that doesn't do anything | |
**/ | |
let target = { a: 1, b: 2, c: 3 } | |
let handler = new Proxy({}, { | |
get: (...args) => Reflect[args[1]](...args) | |
}) |
import { HTTPFetchNetworkInterface, printAST } from 'apollo-client'; | |
/** | |
* Serialize a object to a query string | |
* @source https://stackoverflow.com/questions/1714786/query-string-encoding-of-a-javascript-object#comment47677757_18116302 | |
*/ | |
function serialize( obj ) { | |
return `?` + Object.keys(obj).map(k => k + `=` + encodeURIComponent(obj[k])).join(`&`); | |
} |
// How to ensure that our animation loop ends on component unount | |
componentDidMount() { | |
this.startLoop(); | |
} | |
componentWillUnmount() { | |
this.stopLoop(); | |
} |
/** | |
* WHY? - BECAUSE EXCEPTIONS/TRY/CATCH IS A GLOBAL HORRIBLE MESS :-( | |
* Check out error handling in golang: https://blog.golang.org/error-handling-and-go | |
*/ | |
/** | |
* Wrap an "unsafe" promise | |
*/ | |
function safePromise(promise) { | |
return promise |
const childProcess = require('child_process');
Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.
This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would
#!/bin/bash | |
# TODO: skip tiny files (so small they couldn't be photos) | |
# TODO: make sure sym links and other file system oddities are handled | |
# TODO: look at paralellization for perf boost | |
# | |
# Constants | |
# | |
CHAR_COUNT=12 | |
BLOCK_COUNT=6 |
http://ogp.me/ | |
https://moz.com/blog/meta-data-templates-123 | |
https://search.google.com/structured-data/testing-tool | |
https://developers.facebook.com/tools/debug/og/object - https://developers.facebook.com/docs/reference/opengraph | |
https://cards-dev.twitter.com/validator - https://dev.twitter.com/cards/types | |
https://developers.pinterest.com/tools/url-debugger/ - https://developers.pinterest.com/docs/rich-pins/overview/ | |
https://developer.linkedin.com/docs/share-on-linkedin |
const ABORTABLE_ERROR_KEY = '__abortablePromise'; | |
/** | |
* @typedef {Promise.<*>} AbortablePromise | |
* | |
* @property {function} abort Additional method for abort original promise | |
*/ | |
/** | |
* |
It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.