curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update
sudo apt install -y yarn nodejs nginx
This file contains 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
type AnyFunction = (...args: any[]) => any | |
/** | |
* `R.tryCatch` takes two functions, a `tryer` and a `catcher`. | |
* The returned function evaluates the `tryer`; | |
* if it does not throw, it simply returns the result. | |
* If the `tryer` does throw, | |
* the returned function evaluates the `catcher` function and returns its result. | |
* | |
* @note For effective composition with this function, |
This file contains 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 fn = {}; | |
const __ = (window.global || window); | |
__.fn = fn; | |
/** | |
* Pipe function | |
* | |
* @param {*} initial - Initial value | |
* @param {...Function} functions - Pipe functions | |
* |
This file contains 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
location / { | |
proxy_pass http://localhost:8080; | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection 'upgrade'; | |
proxy_set_header Host $host; | |
proxy_cache_bypass $http_upgrade; | |
} |
This file contains 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
expect(fn) | |
.toHaveBeenCalledWith(expect.anything()) | |
.toHaveBeenCalledWith(expect.any(constructor)) | |
.toHaveBeenCalledWith(expect.arrayContaining([ values ])) | |
.toHaveBeenCalledWith(expect.objectContaining({ props })) | |
.toHaveBeenCalledWith(expect.stringContaining(string)) | |
.toHaveBeenCalledWith(expect.stringMatching(regexp)) |
This file contains 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 Maybe = folktale.maybe | |
const Result = folktale.result | |
const noop = () => {} | |
const { href: current } = document.location | |
const { compose, ifElse, any, curry, split, head, map, complement, allPass, is, chain, find, mapObjIndexed, type } = R | |
const stringIncludes = curry((neddles, haystack) => any(neddles, n => haystack.includes(n))) | |
const findByClass = className => Array.from(document.getElementsByClassName(className)) | |
const safeContextQuery = curry((query, el) => Maybe.fromNullable(el.querySelector(query))) | |
const safeContextQueryMany = curry((query, el) => Array.from(el.querySelectorAll(query))) | |
const safeFindById = id => Maybe.fromNullable(document.getElementById(id)) |
This file contains 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 uuid from 'an-uuid'; | |
import {find, filter, findIndex} from 'lodash'; | |
class Collection { | |
constructor(schema, collection = [], clearFirst) { | |
this.schema = schema; | |
if(clearFirst) { | |
this.clear(); |