Skip to content

Instantly share code, notes, and snippets.

@PARC6502
PARC6502 / OpenSourceBaas.md
Last active May 4, 2025 12:34
List of open source, self hosted BaaS - Backend as a service

Backend as a Service

Supabase - ~52K stars

  • Designed explicitly as an open source firebase alternative
  • Typescript based
  • Docker support

Appwrite - ~32K stars

  • Written in JavaScript and PHP
  • Docker based
  • Realtime support across all services
@genadyp
genadyp / javascript-useful-links.md
Last active April 28, 2025 09:27
javascript (js) useful links
@masaeedu
masaeedu / state.js
Created March 17, 2018 01:58
State monad in JS
// Functor
export const map = f => s => x0 => {
const [v, x1] = s(x0);
return [f(v), x1];
};
// Applicative
export const pure = a => x => [a, x];
export const ap = stf => stv => x0 => {
const [f, x1] = stf(x0);
// @flow
import { createAction, createReducer, on, onType, Action } from "transdux";
const inc: Action<void> = createAction();
const add: Action<number> = createAction();
const DEC = "DEC";
const SUB = "SUB";
@mvaldesdeleon
mvaldesdeleon / state.js
Created November 20, 2017 19:49
State monad
function State(fn) {
this._fn = fn;
}
State.state = fn => new State(fn);
State.of = val => State.state(state => [val, state]);
State.get = State.state(state => [state, state]);
@branneman
branneman / fp-lenses.js
Last active May 17, 2023 00:56
JavaScript: Lenses (Functional Programming)
// FP Lenses
const lens = get => set => ({ get, set });
const view = lens => obj => lens.get(obj);
const set = lens => val => obj => lens.set(val)(obj);
const over = lens => fn => obj => set(lens)(fn(view(lens)(obj)))(obj);
const lensProp = key => lens(prop(key))(assoc(key));
const Set = (lens, value, target) => lens.set(value, target)
const View = (lens, target) => lens.get(target)
const Over = (lens, func, target) =>
Set(lens, func(View(lens, target), target), target)
const Compose = (...lenses) => {
lenses = lenses.reverse()
const itar = (i, target, value) => {
if (i === lenses.length) return value
return lenses[i].set(itar(i + 1, lenses[i].get(target), value), target)
const B = f => g => x => f(g(x));
const K = a => b => a;
const I = a => a;
const toPair = p => p(a => b => ({ first: a, second: b }));
const toNumber = n => n(x => x + 1)(0);
const toArray = l => l(x => xs => [x, ...xs])([]);
const toBoolean = b => b(true)(false);
const pair = a => b => f => f(a)(b);
@tomfun
tomfun / plural.js
Created August 23, 2016 12:31
JavaScript russian plural function
function getNoun(number, one, two, five) {
let n = Math.abs(number);
n %= 100;
if (n >= 5 && n <= 20) {
return five;
}
n %= 10;
if (n === 1) {
return one;
}
@dypsilon
dypsilon / continuation.js
Created August 8, 2016 09:27
Eager Continuation in JavaScript
const {tagged} = require('daggy');
let Continuation = tagged('x');
Continuation.prototype.of = Continuation.of = x => {
return new Continuation((resolve) => resolve(x));
}
Continuation.prototype.chain = function(f) {
return this.x(f);