Skip to content

Instantly share code, notes, and snippets.

@melbourne2991
melbourne2991 / Redux.re
Created May 13, 2020 22:45
React-redux reasonml bindings
module type ReduxParams = {
type state;
type action;
};
module Make = (Params: ReduxParams) => {
type state = Params.state;
type action = Params.action;
type reducer = (state, action) => state;
type store('r);
import React, { useState, useMemo, useCallback } from "react";
import Autosuggest from "react-autosuggest";
import {
fetchSuggestions,
clearSuggestions,
setCommandInput,
selectSuggestions,
} from "./state";
import { useDispatch, useSelector } from "react-redux";
FROM ubuntu:18.04
RUN apt-get update -y
RUN apt-get upgrade -y
RUN apt-get install curl -y
RUN apt-get install xz-utils -y
RUN apt-get install build-essential -y
ENV LLVM_NAME clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-18.04
RUN curl http://releases.llvm.org/9.0.0/${LLVM_NAME}.tar.xz -o ./llvm.tar.xz
name = "Will Chale"
email = "fake@gmail.com"
phone = "0405000000"
address = '''
10 Some Street, Melbourne 3000
Australia'''
website = "https://www.wasab.ai"
profession = "Software Engineer"
@melbourne2991
melbourne2991 / responsive.ts
Last active May 22, 2019 08:41
Responsive utilities styled components
import { CSSObject } from "styled-components"
export type BreakPointStyles<B> = { [K in keyof B]: CSSObject }
const breakpoints = {
sm: "768px",
md: "992px",
}
const responsive = (styles: BreakPointStyles<typeof breakpoints>) => {
@melbourne2991
melbourne2991 / DDBKeyValueStore.ts
Created March 22, 2019 06:08
DDB key value store
import { DocumentClient } from "aws-sdk/clients/dynamodb";
export interface AsyncKeyValueStore<K> {
set<V>(key: K, value: V): Promise<void>;
get<V>(key: K): Promise<V>;
remove(key: K): Promise<void>;
}
export class DynamoDBKeyValueStore<K> implements AsyncKeyValueStore<K> {
docClient: DocumentClient;
@melbourne2991
melbourne2991 / levenshtein.kt
Created March 16, 2019 16:35
Levenshtein Kotlin Implementation
package madu.ezsug
import kotlin.math.min
fun calcDistance(source: String, target: String): Int {
println("(Source: $source) -> (Target: $target)")
val rowCount = target.length + 1 // add one for empty string
val columnCount = source.length + 1 // // add one for empty string
let x = Renderer.positionGet(Renderer.stageGet(renderer));
let x2 = renderer->Renderer.stageGet->Renderer.positionGet;
@melbourne2991
melbourne2991 / gist:082609f3b51933c4bc1de1c3091ee319
Created January 4, 2019 13:41
Add reason-cli to path (nvm/yarn)
# Add reason utils to path
export PATH=$PATH:"$HOME/.config/yarn/global/node_modules/reason-cli/bin"
@melbourne2991
melbourne2991 / Rex.re
Last active August 5, 2020 08:51
ReasonML Observables Implementation
type observer('a, 'e) = {
.
next: 'a => unit,
complete: unit => unit,
error: 'e => unit,
};
type subscription = {
.
unsubscribe: unit => unit