This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* @flow */ | |
type NonNegativeInt = number | |
type PositiveNumber = number | |
type Regex = string | |
type SchemaType = { | |
description?: string, | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @flow | |
import type { $Request, $Response, Middleware, NextFunction, Router } from 'express' | |
type Path = express$Path | express$Path[] | |
export type TypedMiddleware<A> = | |
| ((req: $Request & A, res: $Response, next: NextFunction) => mixed) | |
| ((error: Error, req: Request & A, res: $Response, next: NextFunction) => mixed) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[@bs.module "formik"] | |
[@react.component] | |
external make: ( | |
~initialValues: Js.t('a), | |
~validate: (. Js.t('a)) => Js.Dict.t(string), | |
~onSubmit: (. Js.t('a), {. "setSubmitting": [@bs.meth] bool => unit }) => unit, | |
~children: (. {. "isSubmitting": bool }) => React.element, | |
) => React.element = "Formik"; | |
module Form = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* Good morning everyone, I'm currently learning ocaml for one of my CS class and needed to implement | |
an avl tree using ocaml. I thought that it would be interesting to go a step further and try | |
to verify the balance property of the avl tree using the type system. Here's the resulting code | |
annotated for people new to the ideas of type level programming :) | |
*) | |
(* the property we are going to try to verify is that at each node of our tree, the height difference between | |
the left and the right sub-trees is at most of 1. *) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
usage() { | |
cat <<EOF | |
USAGE | |
$(basename $0) FILENAME [COMMENT] | |
Get or set file comment. | |
ARGUMENTS |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Run with: | |
-- $ sqlite3 ecb_rates.db | |
-- sqlite> .read ecb_rates.sql | |
drop table if exists eurofxref_hist; | |
drop table if exists ecb_rates; | |
create table ecb_rates ( | |
date text not null, | |
curr text not null, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* Re: https://twitter.com/llaisdy/status/1558536851560054786?s=20&t=us8J3LvoJTlwVwod5bOqeQ *) | |
(* Use this if using the REPL, otherwise use dune to build with the library dependency *) | |
#require "uutf";; | |
(* Converts an array of ints (Unicode graphemes) into a UTF-8 encoded string. *) | |
let utf8_to_string uchars = | |
let buf = Buffer.create (2 * Array.length uchars) in | |
Array.iter (fun uchar -> Uutf.Buffer.add_utf_8 buf (Uchar.of_int uchar)) uchars; | |
Buffer.contents buf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Bindings for OpenAPI 3.0.0 - https://swagger.io/specification/#schema-object | |
ℹ️ JSON Schema validation for OpenAPI 3.0.0 must conform to this version: | |
https://datatracker.ietf.org/doc/html/draft-wright-json-schema-validation-00 | |
""" | |
schema Ref: | |
$ref: str |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create table if not exists note ( | |
id integer not null primary key autoincrement, | |
created_at timestamp not null default current_timestamp, | |
modified_at timestamp not null default current_timestamp, | |
starred_at timestamp, | |
title varchar(1024) not null, | |
content text not null default '' | |
); | |
create table if not exists note_tag ( |
OlderNewer