Skip to content

Instantly share code, notes, and snippets.

import { Tempo } from 'tempo-dom/lib/tempo'
import { simpleComponent } from 'tempo-dom/lib/html'
const component = simpleComponent<number, unknown>($ =>
$.div($ =>
$.class('app').div($ =>
$.div($ => $.class(['count', 'count-small']).text('count'))
.div($ => $.class('count').text(String))
.div($ =>
$.class('buttons')
import kempo.Reducer
import kempo.el
data class State(
val name: String,
val counter: Int = 0
) {
fun withName(name: String) = State(name, counter)
fun withCounter(counter: Int) = State(name, counter)
}
import { DOMView, div, up, button, down, when, repeat, Spoon } from './lib'
type State = { value: number }
class Adjust {
kind: 'adjust' = 'adjust'
constructor(
readonly value: number
) {}
}

Keybase proof

I hereby claim:

  • I am fponticelli on github.
  • I am fponticelli (https://keybase.io/fponticelli) on keybase.
  • I have a public key ASClK4h4qiVDpNzg0sTgtFiXxhsfEJNFAMqKidDMs8548Ao

To claim this, I am signing this object:

module Comp.FormData exposing (..)
type FormMessage u s
= UpdateForm u
| SubmitForm s
| ResetForm
type FieldStatus valid invalid
= FieldIsIncomplete
| FieldIsValid valid
@fponticelli
fponticelli / postgresql_color_adt.sql
Created September 19, 2017 02:32 — forked from mlms13/postgresql_color_adt.sql
Create a sum type for colors in sql
create type custom_color as (r smallint, g smallint, b smallint);
create type named_color as enum ('red', 'green', 'blue');
create type color as (named named_color, custom custom_color);
create or replace function check_color(c color) returns boolean as $$
begin
return
(c.named IS NOT NULL)::int +
@fponticelli
fponticelli / postgresql_color_adt.sql
Created September 19, 2017 02:32 — forked from mlms13/postgresql_color_adt.sql
Create a sum type for colors in sql
-- data NamedColor = Red | Green | Blue
-- data CustomColor = CustomColor
-- { r :: Int
-- , g :: Int
-- , b :: Int
-- }
-- data Color = NamedColor | CustomColor
create type custom_color as (r int, g int, b int);
@fponticelli
fponticelli / Actions.hx
Last active April 11, 2017 02:34
Free Monad in Haxe
using thx.Functions;
import thx.Unit;
import thx.promise.Promise;
using Actions;
enum Action<A> {
Move(x: Float, y: Float): Action<Unit>; // output
Feed(x: Float, y: Float): Action<Unit>;
ReadPosition: Action<Position>;
PromptPosition: Action<Position>; // input
button("click me")
.large()
.danger()
.disabled()
button([
Content("click me"),
Large,
Danger,
Disabled
@:jsRequire("nano")
extern class Nano {
@:selfCall
public static function create(url: String): Nano;
}