Skip to content

Instantly share code, notes, and snippets.

View main.ts
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')
View action_less.kt
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)
}
View index.ts
import { DOMView, div, up, button, down, when, repeat, Spoon } from './lib'
type State = { value: number }
class Adjust {
kind: 'adjust' = 'adjust'
constructor(
readonly value: number
) {}
}
View keybase.md

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:

View FormData.purs
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 Sep 19, 2017 — forked from mlms13/postgresql_color_adt.sql
Create a sum type for colors in sql
View postgresql_color_adt.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 Sep 19, 2017 — forked from mlms13/postgresql_color_adt.sql
Create a sum type for colors in sql
View postgresql_color_adt.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 Apr 11, 2017
Free Monad in Haxe
View Actions.hx
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
View DoomDSL.hx
button("click me")
.large()
.danger()
.disabled()
button([
Content("click me"),
Large,
Danger,
Disabled
View Nano.hx
@:jsRequire("nano")
extern class Nano {
@:selfCall
public static function create(url: String): Nano;
}
You can’t perform that action at this time.