Skip to content

Instantly share code, notes, and snippets.

Avatar
:shipit:

Murphy Randle mrmurphy

:shipit:
View GitHub Profile
@mrmurphy
mrmurphy / App.re
Created Feb 26, 2020
egghead-tailwind-reason-react-style-an-input-border-dynamically
View App.re
open React;
let onChangeText = (updator, event) => {
let v = ReactEvent.Form.target(event)##value;
updator(_ => v);
};
[@react.component]
let make = () => {
// State
View Bent.re
[@bs.module] external bent('headers, 'response) : (
~method: @bs.string] [
| `GET
| `POST
| `PUT
| `DELETE
],
~format: [@bs.string] [
| `string
| `buffer
@mrmurphy
mrmurphy / S3Data.re
Last active Aug 29, 2019
Using ADTs to form invariants around application logic.
View S3Data.re
// These types enhance safety around binary data that we want to synthesize onto
// a record, but store in S3 instead of in Postgres. If the encoder for the
// wrapping type requires that a field has a type of `S3Data.Outgoing.t`, then
// the type system will ensure that the data has been loaded up from S3 before
// it gets sent back to the user. In the same way, if the wrapping type uses
// `Incoming.t` at the API layer, and just `t` at the database layer, then the
// type system ensures that some action has been taken to save the binary to S3
// before writing to the database.
module Saved = {
@mrmurphy
mrmurphy / Layer 0.json
Created Aug 27, 2019
Keyboardio Layout Backup
View Layer 0.json
{
"keymap": [
{
"keyCode": 41,
"label": "Esc"
},
{
"keyCode": 30,
"label": "1"
},
@mrmurphy
mrmurphy / File.txt
Created Jun 29, 2019
Bloom Built Upgrade from JSX 2 to JSX 3 (Reason React)
View File.txt
Alternative migration path for JSX 2 to JSX 3 Reason React
https://bloodyowl.github.io/blog/2019-04-19-an-alternative-migration-path-for-reason-react/
https://github.com/bloodyowl/reason-react-update
https://bloodyowl.github.io/blog/2019-01-24-orchestrating-requests-at-component-level/
This migration was really slick. We just ran it on the files we needed migrated (you can’t just pass files as args to the executable, you’ve got to pipe the names in)
View Caller.re
module Gift =
Email_Template.Make({
let name = "gift";
type data = {
quantity: int,
total: string,
year: int,
code: string,
};
View keybase.md

Keybase proof

I hereby claim:

  • I am mrmurphy on github.
  • I am murphyrandle (https://keybase.io/murphyrandle) on keybase.
  • I have a public key whose fingerprint is 3507 3BDF F37D 7B17 C16B B354 2904 F387 57B7 F1BB

To claim this, I am signing this object:

View Handler.re
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 =
View Pom.re
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))
);
@mrmurphy
mrmurphy / ynab_to_db.js
Created Feb 23, 2019
A little program to save your YNAB transactions to a SQLite Database for fast and easy querying
View ynab_to_db.js
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");
You can’t perform that action at this time.