Skip to content

Instantly share code, notes, and snippets.

View nem035's full-sized avatar
🐢
always learning

Nemanja Stojanovic nem035

🐢
always learning
View GitHub Profile
@nem035
nem035 / node-modules-in-react-native.md
Created July 26, 2018 16:29 — forked from parshap/node-modules-in-react-native.md
Running Node Modules in React Native

Running Node Modules in React Native

How to use packages that depend on Node.js core modules in React Native.

Node.js Core Modules

Node has several modules that are automatically available via require(): http, crypto, etc. While these modules are available in Node, they are not automatically available in other environments

import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
  • 🎨 when improving the format/structure of the code
  • 🚀 when improving performance
  • ✏️ when writing docs
  • 💡 new idea
  • 🚧 work in progress
  • ➕ when adding feature
  • ➖ when removing feature
  • 🔈 when adding logging
  • 🔇 when reducing logging
  • 🐛 when fixing a bug
@nem035
nem035 / latency.txt
Created February 1, 2017 02:51 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@nem035
nem035 / template-literals.md
Created January 25, 2017 05:11 — forked from dherman/template-literals.md
What can you do with ES6 string template literals?

DOM selectors

var elements = query`.${className}`;

Localization

var message = l10n`Hello ${name}; you are visitor number ${visitor}:n!
@nem035
nem035 / template-literals.md
Created January 25, 2017 05:11 — forked from dherman/template-literals.md
What can you do with ES6 string template literals?

DOM selectors

var elements = query`.${className}`;

Localization

var message = l10n`Hello ${name}; you are visitor number ${visitor}:n!
@nem035
nem035 / ember-cli-build.js
Created January 24, 2017 22:48 — forked from mathieul/ember-cli-build.js
Using ES7 decorators & async/await with Ember: example
// ...
var app = new EmberApp(defaults, {
hinting: false,
babel: {
includePolyfill: true,
optional: [
"es7.decorators",
"es7.classProperties",
"es7.asyncFunctions"

What I Wish I'd Known About Equity Before Joining A Unicorn

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

function * just (...values) {
yield * values;
};
function first (iterable) {
const iterator = iterable[Symbol.iterator]();
const { done, value } = iterator.next();
if (!done) return value;
};
@nem035
nem035 / better-nodejs-require-paths.md
Created November 6, 2016 04:19 — forked from branneman/better-nodejs-require-paths.md
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

var Article = require('../../../models/article');

Those suck for maintenance and they're ugly.

Possible solutions