Skip to content

Instantly share code, notes, and snippets.

@sillero
sillero / README.md
Last active April 26, 2024 22:43
GitHub markdown TOC generator (bookmarklet)

#GitHub markdown TOC generator (bookmarklet) Drag THIS LINK to the your bookmarks

@sillero
sillero / togetherjs.bookmarklet
Last active October 19, 2022 13:57
TogetherJS bookmarklet
javascript:(function(e,t,n){var r=function(){var t=function(e){e=e||10;var t='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUV0123456789';var n='';for(var r=0;r<e;r++){n+=t.charAt(Math.floor(Math.random()*t.length))}return n},n=t(),r=e.prompt('Type session ID to join or create\n (default is \'together\')')||'together',i={reason:'started',shareId:r,running:true,date:Date.now(),sessionId:n};if(typeof sessionStorage['togetherjs-session.status']!=='undefined'){i=JSON.parse(sessionStorage['togetherjs-session.status']);i.shareId=r;i.running=true}i=JSON.stringify(i);return i}();sessionStorage['togetherjs-session.status']=r;if(typeof TogetherJS!=='undefined'){if(TogetherJS._loaded){TogetherJS.on('close',function(){TogetherJS(e)});TogetherJS(e)}else{TogetherJS(e)}}else{var i=t.createElement('script'),s='https://togetherjs.com/togetherjs-min.js';i.setAttribute('src',s);t.body.appendChild(i)}})(window,document)
@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 / classNames.js
Created July 9, 2018 22:54
classNames
export default (...args) => args.map(Boolean).join(' ')
@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 / 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 / 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