This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function zip(...iterables) { | |
const iterators = iterables.map(i => i[Symbol.iterator]()); | |
let done = false; | |
return { | |
[Symbol.iterator]() { | |
return this; | |
}, | |
next() { | |
if (!done) { | |
const items = iterators.map(i => i.next()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo mkdir /c | |
sudo mount --bind /mnt/c /c | |
cd /c/path/to/project |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// FAKEAPI | |
let id = 0; | |
const v4 = () => ++id; | |
const fakeDatabase = { | |
todos: [{ | |
id: v4(), | |
text: `hey`, | |
completed: true, | |
}, { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const createStore = (reducer) => { | |
let state; | |
let listeners = []; | |
const getState = () => state; | |
const dispatch = (action) => { | |
state = reducer(state, action); | |
listeners.forEach(listener => listener()) | |
}; |