Skip to content

Instantly share code, notes, and snippets.

@sillero
sillero / classNames.js
Created July 9, 2018 22:54
classNames
export default (...args) => args.map(Boolean).join(' ')
@sillero
sillero / extensions.json
Last active July 26, 2018 00:54
VSCode's Settings - Syncing
[
{
"id": "christian-kohler.path-intellisense",
"name": "path-intellisense",
"publisher": "christian-kohler",
"version": "1.4.2"
},
{
"id": "eamodio.gitlens",
"name": "gitlens",
@sillero
sillero / extend-json
Last active July 8, 2018 02:49
extend-json CLI
#!/bin/bash
TARGET=$(tr -d '\n' < $1)
SOURCE=$(tr -d '\n' < $2)
node -e "console.log(JSON.stringify({ ...$TARGET, ...$SOURCE }, false, 4))"
@sillero
sillero / dev-environment.sh
Last active July 8, 2018 02:53
Set up Mac FE dev environment #node #npm #nvm #vscode #yarn #MacOS
# Install oh-my-zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
# Install Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Make sure yarn is sans-node
brew uninstall yarn node
brew install yarn --without-node
@sillero
sillero / delayed.ts
Last active May 22, 2018 17:51
JS helpers for delayed execution with async/await
export function delay(ms: number) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
export async function delayedRepeat(ms: number, repetitions: number, callback: (index) => any) {
for (let i = 1; i <= repetitions; i++) {
await delay(ms);
callback(i);
}
}
@sillero
sillero / LICENSE
Last active March 8, 2018 21:56
ES2015+ object deep merge
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
export default class Enum {
constructor(arr) {
const enumMap = new Map(enumerize(arr))
for (const [key, value] of enumMap) {
this[key] = value
this[value] = key
}
[
@sillero
sillero / README.md
Last active March 4, 2016 10:38
React Porto Alegre
@sillero
sillero / .babelrc
Last active November 13, 2015 19:02
Babel (ES7, React) + ESLint boilerplate
{
"presets": ["airbnb", "stage-0"]
}
// using iojs-v1.5.1 to run the code
/* jshint esnext:true */
/* globals console */
'use strict';
var app = {
pipeline: function(){
var pipeline = {};
// using arguments slice because iojs needs flags for Spreads