Skip to content

Instantly share code, notes, and snippets.

View darrylhebbes's full-sized avatar

Darryl Hebbes darrylhebbes

  • Berlin, Germany
View GitHub Profile
@Platekun
Platekun / machine.js
Created December 3, 2019 18:31
Generated by XState Viz: https://xstate.js.org/viz
function cuid() {}
function sweetAlert() {}
function moment() {}
function domToImage() {}
function api() {}
function createProgressFormDraft() {}
function adjustMonthYearDate() {}
function formatIntoValidServerDate () {}
@gordonbrander
gordonbrander / starting.yaml
Created May 12, 2019 00:29
Starting - creative prompts
# Prompts for beginning new projects
start:
- "#5ps#"
- "#heart#"
- "#disirability_feasibility_viability#"
- "#practical_step#"
- "#build#"
- "#story#"
- "#ooda#"
@gordonbrander
gordonbrander / ruleset.example.js
Last active November 6, 2022 09:20
ruleset.js — parse style-attribute-like strings.
import {Schema, string, bool, number, listOf, optional, cssUnit4} from './ruleset.js';
const parse = Schema({
title: string,
isHidden: optional(bool, false),
numbers: listOf(number)
});
parse("title: 8 Beautiful Notes; numbers: 1, 2, 3, 4, 5, 6, 7, 8")
// > {title: "8 Beautiful Notes", numbers: [1, 2, 3...], isHidden: false}
@darrylhebbes
darrylhebbes / combinators.js
Created June 27, 2018 07:42 — forked from Avaq/combinators.js
Common combinators in JavaScript
const I = x => x;
const K = x => y => x;
const A = f => x => f(x);
const T = x => f => f(x);
const W = f => x => f(x)(x);
const C = f => y => x => f(x)(y);
const B = f => g => x => f(g(x));
const S = f => g => x => f(x)(g(x));
const P = f => g => x => y => f(g(x))(g(y));
const Y = f => (g => g(g))(g => f(x => g(g)(x)));
@huytd
huytd / customize.material-dark-theme.md
Last active September 2, 2023 13:03
My minimal Emacs config

;; Automatically generated
(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(anzu-cons-mode-line-p nil)
const { withStateHandlers } = Recompose;
const Counter = ({ count, increment, decrement }) =>
<div>
Count: {count}
<div>
<button onClick={increment}>+</button>
<button onClick={decrement}>-</button>
</div>
</div>;
@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));
@mpj
mpj / example01.js
Created August 14, 2017 07:38
Code for the async/await episode of Fun Fun Function.
const response = await fetch(`https://catappapi.herokuapp.com/users/${userId}`)
const data = await response.json()
return data.imageUrl
}

Table of Contents

  1. Basic syntax
  2. Flow Examples
  3. Advanced features
  4. Using with existing libraries (flow-typed and libdefs)
  5. Tooling
  6. Try

1. Basics