Skip to content

Instantly share code, notes, and snippets.

View YetAnotherMinion's full-sized avatar

yam YetAnotherMinion

View GitHub Profile
<html>
<head>
<meta charset="UTF-8">
<title>Hacker News</title>
<style>
#header {
background-color: #ff6600;
height: 25px;
width: 100%;
}
@YetAnotherMinion
YetAnotherMinion / lib.rs
Last active June 23, 2019 18:10
naive wadler impl
use std::collections::VecDeque;
#[derive(Clone, Debug)]
pub enum Doc {
Nil,
Concat(Box<Doc>, Box<Doc>),
Nest(i32, Box<Doc>),
Text(String),
Line,
Union(Box<Doc>, Box<Doc>),
@YetAnotherMinion
YetAnotherMinion / kvdb.py
Last active September 13, 2018 19:51
key value db example
#! /usr/bin/env python3
from typing import Dict
from hypothesis import given, assume, reproduce_failure
import hypothesis.strategies as st
import unittest
import logging
class KeyValueStore:
def __init__(self):
self._storage = {}
module LazyMarkdownBugReproduction exposing (main)
import Array exposing (Array)
import Dict exposing (Dict)
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Lazy
import Html.Events exposing (onInput)
import Markdown
@YetAnotherMinion
YetAnotherMinion / main.rs
Created February 19, 2018 01:54
implement Point type for PG
#![feature(custom_attribute)]
#[macro_use]
extern crate diesel;
extern crate byteorder;
use diesel::prelude::*;
use diesel::pg::PgConnection;
//mod points;
@YetAnotherMinion
YetAnotherMinion / main.rs
Created July 1, 2017 17:49
single column foreign key with diesel 0.13.0
#[macro_use]
extern crate diesel;
#[macro_use]
extern crate diesel_codegen;
table! {
// table_a (tennant_id, part_number) {
table_a (tennant_id) {
tennant_id -> Int8,
part_number -> Int8,
@YetAnotherMinion
YetAnotherMinion / main.rs
Last active June 18, 2017 16:35
Composite Foreign Key implementation attempt with Diesel
#[macro_use]
extern crate diesel;
#[macro_use]
extern crate diesel_codegen;
table! {
table_a (tennant_id, part_number) {
tennant_id -> Int8,
part_number -> Int8,
@YetAnotherMinion
YetAnotherMinion / IteratorBench.elm
Created June 10, 2017 15:45
Benchmark mapping over an Array and collecting into a List
module IteratorBench exposing (main)
import Benchmark exposing (Benchmark, benchmark2)
import Benchmark.Runner exposing (BenchmarkProgram, program)
import Time
import Html exposing (Html, div, text)
import Array exposing (Array)
main : BenchmarkProgram
main =
@YetAnotherMinion
YetAnotherMinion / Client.elm
Created May 6, 2017 16:29 — forked from eriklott/Client.elm
Elm Backend Client
module YourAPIClient exposing (Config, otherFunctions)
import Http
import Json.Decode as Decode
import Json.Encode as Encode
-- Config
@YetAnotherMinion
YetAnotherMinion / shake_elm_tree.py
Created May 6, 2017 15:58
Tree shaking POC for Elm
import os
import sys
import re
import string
expressions = []
# elm produces nice output where each complete top level expression starts with
# a line with zero indentation and continues up until the next line with zero
# indentation