Skip to content

Instantly share code, notes, and snippets.

@imekachi
imekachi / async-await.js
Created September 26, 2018 02:05 — forked from wesbos/async-await.js
Simple Async/Await Example
// 🔥 Node 7.6 has async/await! Here is a quick run down on how async/await works
const axios = require('axios'); // promised based requests - like fetch()
function getCoffee() {
return new Promise(resolve => {
setTimeout(() => resolve('☕'), 2000); // it takes 2 seconds to make coffee
});
}
@imekachi
imekachi / pure.zsh
Last active September 3, 2018 04:10 — forked from elijahmanor/pure.zsh
Add node and npm versions to [email protected]
# pure.zsh is located at /usr/local/lib/node_modules/pure-prompt/pure.zsh
# Pure @1.8.0
# by Sindre Sorhus
# https://github.com/sindresorhus/pure
# MIT License
# For my own and others sanity
# git:
# %b => current branch
@imekachi
imekachi / difference.js
Last active June 8, 2018 08:10 — forked from Yimiprod/difference.js
Deep diff between two object, using lodash
/**
* Deep diff between two object, using lodash
* @param {Object} object Object compared
* @param {Object} base Object to compare with
* @return {Object} Return a new object who represent the diff
*/
function difference(object, base) {
return _.transform(object, (result, value, key) => {
if (!_.isEqual(value, base[key])) {
result[key] = _.isObject(value) && _.isObject(base[key]) ? difference(value, base[key]) : value