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 CHANGE = true; | |
let calculate = () => { | |
return new Promise((resolve) => { | |
setTimeout(() => { | |
resolve(5) | |
}, 100); | |
}) | |
} |
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
import { red, yellow } from "chalk"; | |
import { differenceWith, isEqual } from "lodash"; | |
import { Observable, of, Subject } from "rxjs"; | |
import { | |
concatMap, delay, groupBy, map, mergeMap, scan, switchMap, | |
} from "rxjs/operators"; | |
/* | |
Transform stream of arrays into stream of distinct elements |
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
import { useReducer } from "react"; | |
import produce from "immer"; | |
export default (initialState) => ( | |
/* | |
First, we need to apply the `useReducer` hook. | |
React reducer signature is `(state, action)`, where `state` is the current state | |
and `action` is the argument provided to the `set` method. | |
In our case, `action` is just the `producer` method we'll pass to immer. |
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
// See live demo: https://repl.it/DCWZ | |
// Flatten array exercise | |
// Hubert Orlik–Grzesik | |
// [email protected] | |
// 2016C | |
// Of course, in real-life environment I would write: | |
// |
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
var Term = { | |
BLACK: '\033[30m', | |
RED: '\033[31m', | |
GREEN: '\033[32m', | |
YELLOW: '\033[33m', | |
BLUE: '\033[34m', | |
MAGENTA: '\033[35m', | |
CYAN: '\033[36m', | |
WHITE: '\033[37m', | |
GRAY: '\033[38m', |
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
#!/bin/bash | |
if [ ! -e $HOME/.meteor ]; | |
then | |
sudo curl https://install.meteor.com/ | sh | |
fi | |
sudo apt-get update | |
sudo apt-get install -y python-software-properties | |
sudo add-apt-repository ppa:chris-lea/node.js |
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($) { | |
var getNext = function(item) { | |
if(item.length === 0) return null; | |
if(item.next().length > 0) return item.next(); | |
return getNext(item.parent()); | |
}; | |
var getPrev = function(item) { | |
if(item.length === 0) return null; |
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
if(Meteor.isServer) { | |
Nodetime.profile({ | |
accountKey: '...', | |
appName: '...', | |
debug: true, | |
mongodbMetrics: true, | |
}); |