Skip to content

Instantly share code, notes, and snippets.

@mrmurphy
mrmurphy / Select.elm
Last active September 19, 2016 17:55
A bug in the select
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import Html.App exposing (beginnerProgram)
type alias Model =
{ showSelect : Bool
, selectVal : Maybe String
module Model.Lenses exposing (..)
-- other imports omitted
import Monocle.Optional as MO
import RemoteData
entryInList : String -> MO.Optional (List Entry) Entry
entryInList id =
{ getOption = List.Extra.find (\entry -> entry.id == id)

dayone.me

  • Log in to dayone.me
  • Log in to dayone.me with apple auth
  • Forgot password?
  • Create account
  • Link Apple ID
  • Unlink Apple ID
  • Change Password
  • Change Email Address
  • Add email address (apple only accounts)
Verifying my Blockstack ID is secured with the address 18Fj9tXaLucYW57miX6oteLJaN8AHcgDkq https://explorer.blockstack.org/address/18Fj9tXaLucYW57miX6oteLJaN8AHcgDkq
type queryBuilder;
type t = (. string) => queryBuilder;
type querySql('options) = {
.
"method": string,
"options": 'options,
"bindings": array(string),
"sql": string,
@mrmurphy
mrmurphy / Handler.re
Created August 7, 2018 17:04
Type Safe Reason Express Handlers
/* Prom is a library that provides
<$> (map)
and
>>= (bind, or flatMap)
for promises.
*/
open Prom;
/*
A Handler is a more functional and type-safe way of dealing with composable "middleware" in the express chain.
@mrmurphy
mrmurphy / ynab_to_db.js
Created February 23, 2019 05:10
A little program to save your YNAB transactions to a SQLite Database for fast and easy querying
const ynab = require("ynab");
const SQL = require("sql-template-strings");
const sqlite = require("sqlite");
let personalAccessToken = process.env.YNAB_ACCESS_TOKEN;
let client = new ynab.API(personalAccessToken);
async function go() {
const db = await sqlite.open("./transactions.sqlite");
type pomWithError('data, 'err) = Js.Promise.t(Result.t('data, 'err));
type pom('data) = pomWithError('data, unit);
module JsPromise = {
let make = () => {
let resolver = ref(ignore);
let p =
Js.Promise.make((~resolve, ~reject as _) =>
resolver := (a => resolve(. a))
);
open Pom;
type middleware('context, 'result) =
(Express.Request.t, Express.Response.t, 'context) =>
pomWithError('result, Express.complete);
type handler('context) =
(Express.Request.t, Express.Response.t, 'context) => pom(Express.complete);
let _onError500 =