Skip to content

Instantly share code, notes, and snippets.

View eiriklv's full-sized avatar

Eirik L. Vullum eiriklv

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
eiriklv / HTTPGetRequestForQueriesInterface.js
Created September 27, 2017 12:17 — forked from n1ru4l/HTTPGetRequestForQueriesInterface.js
import { HTTPFetchNetworkInterface, printAST } from 'apollo-client';
* Serialize a object to a query string
* @source
function serialize( obj ) {
return `?` + Object.keys(obj).map(k => k + `=` + encodeURIComponent(obj[k])).join(`&`);
eiriklv / requestAnimationFrame.js
Created August 20, 2017 10:19 — forked from jacob-beltran/requestAnimationFrame.js
React Performance: requestAnimationFrame Example
// How to ensure that our animation loop ends on component unount
componentDidMount() {
componentWillUnmount() {

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style

eiriklv / SyncPath.js
Created March 1, 2017 13:22 — forked from davideast/SyncPath.js
Firebase Social Network Client Fanout
export class SyncPath {
constructor(rootRef, path) {
this._rootRef = rootRef;
this.user = this._rootRef.getAuth();
this._userDataRef = this._rootRef.child(path).child(this.user.uid); = {};
this._userDataRef.on('value', (snap) => = snap.val() || {});
keys() {
return Object.keys(;

@kangax's ES6 quiz, explained

@kangax created a new interesting quiz, this time devoted to ES6 (aka ES2015). I found this quiz very interesting and quite hard (made myself 3 mistakes on first pass).

Here we go with the explanations:

Question 1:
(function(x, f = () => x) {
eiriklv / firebase_workers.js
Created January 2, 2017 11:02 — forked from anantn/firebase_workers.js
Firebase: Implementing a worker queue pattern using firebase_queue_pop.js
var Firebase = require("./firebase-node.js");
function Queue(ref) {
this._ref = ref;
Queue.prototype.pop = function(cb) {
this._ref.startAt().limit(1).once("child_added", this._pop.bind(this, cb));
eiriklv /
Created November 27, 2016 09:19 — forked from SimplGy/
Rename files with a hash based on their contents. eg: `abc.jpg` to `3101ace8db9f.jpg`. Useful for detecting duplicates.
# TODO: skip tiny files (so small they couldn't be photos)
# TODO: make sure sym links and other file system oddities are handled
# Constants
SKIP_SIZE=3 # Every new block is sampled by skipping this amount of blocks to the next position
eiriklv / index.html
Created October 15, 2016 21:02 — forked from anonymous/index.html
JS Bin // source
<!DOCTYPE html>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<div id="root"></div>
<script id="jsbin-javascript">