Skip to content

Instantly share code, notes, and snippets.

Gamaranto / snippets.json
Created Aug 11, 2020
JS and TS snippets for VSCode
View snippets.json
// Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
// Example:
// "Print to console": {
// "scope": "javascript,typescript",
View reducers.js
const Reducer = (run) => ({
concat: (other) => Reducer((acc, x) =>, x), x)),
map: (f) => Reducer((acc, x) => f(run(acc, x))),
contramap: (f) => Reducer((acc, x) => run(acc, f(x))),
const baseStyles = () => ({
backgroundColor: theme.backgroundColors.primary,
color: 'white'
Gamaranto / example.js
Created May 9, 2020
Async Constructor Helper in JavaScript
View example.js
function WillBe(Class){
return class AsyncConstructor extends Class {
constructor(...values) {
this.willBe = (async () => {
let resolvedThis = await promiseAllObj(this);
//Remove this.willBe to avoid circular promises
return Object.keys(resolvedThis)
.reduce((acc,key) => (key === 'willBe'
? acc

Keybase proof

I hereby claim:

  • I am gamaranto on github.
  • I am gamaranto ( on keybase.
  • I have a public key ASDZ6bM7SdLKORSGoe9BmxwCbAAXqvbmqFqJEtOAtNFEuwo

To claim this, I am signing this object: