Skip to content

Instantly share code, notes, and snippets.

Christophe De Troyer m1dnight

View GitHub Profile
View anf.ex
defmodule Anf do
@moduledoc
"""
Author: Christophe De Troyer
"""
require Logger
##############################################################################
# API #
##############################################################################
@m1dnight
m1dnight / elixir.tex
Last active Aug 15, 2018
Elixir Listings Latex
View elixir.tex
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{listings,xcolor}
\usepackage[T1]{fontenc}
\usepackage{xcolor}
\usepackage[scaled=0.9]{DejaVuSansMono}
\definecolor{commentgreen}{RGB}{2,112,10}
\definecolor{eminence}{RGB}{108,48,130}
\definecolor{weborange}{RGB}{255,165,0}
\definecolor{frenchplum}{RGB}{129,20,83}
@m1dnight
m1dnight / gen_server_tpl.ex
Last active Mar 2, 2018 — forked from ntrepid8/gen_server_tpl.ex
Elixir GenServer Template
View gen_server_tpl.ex
defmodule Server do
@moduledoc """
A GenServer template for a "singleton" process.
"""
use GenServer
require Logger
def start_link(opts \\ []) do
Logger.debug "Started with opts: #{inspect opts}"
GenServer.start_link(__MODULE__, opts, [name: __MODULE__])
View gist:8197009aef479ccad32ff8d55345ea19
(function() {
'use strict';
var globals = typeof global === 'undefined' ? self : global;
if (typeof globals.require === 'function') return;
var modules = {};
var cache = {};
var aliases = {};
var has = {}.hasOwnProperty;
View keybase.md

Keybase proof

I hereby claim:

  • I am m1dnight on github.
  • I am cdetroye (https://keybase.io/cdetroye) on keybase.
  • I have a public key ASCtmf-HaRWcx6ZP3JDcypdFDFn9tCYtdew0riLZLZoe0wo

To claim this, I am signing this object:

@m1dnight
m1dnight / Lexer.x
Created Jun 30, 2016
Monadic Parser and Lexer using Alex and Happy
View Lexer.x
{
module Lexer where
}
%wrapper "monadUserState"
$digit = 0-9 -- digits
$alpha = [a-zA-Z] -- alphabetic characters
-- Each token has a function on the RHS that is a function (String ->
@m1dnight
m1dnight / Main.hs
Created Jun 29, 2016
Session Typed Lambda Calculus (Vasconcelos 2006)
View Main.hs
module Main where
import Control.Arrow
import Debug.Trace
import Control.Monad.State
import Data.List hiding (union)
import Data.Maybe
import Syntax
import Text.Printf
-- ____ _ _____ _
@m1dnight
m1dnight / Main.hs
Created Jun 26, 2016
Simply Typed Lambda Calculus
View Main.hs
module Main where
import Data.Maybe
-- ____ _ _ _____ _
-- / ___|(_)_ __ ___ _ __ | |_ _ |_ _| _ _ __ ___ __| |
-- \___ \| | '_ ` _ \| '_ \| | | | | | || | | | '_ \ / _ \/ _` |
-- ___) | | | | | | | |_) | | |_| | | || |_| | |_) | __/ (_| |
-- |____/|_|_| |_| |_| .__/|_|\__, | |_| \__, | .__/ \___|\__,_|
-- _ |_| _ |___/_ |___/|_| _ _
-- | | __ _ _ __ ___ | |__ __| | __ _ / ___|__ _| | ___ _ _| |_ _ ___
View robinson.fs
module UnificationLearning
// Unification algorithm
//
// Portions Copyright (C) 2012 by Tomas Petricek
// Copyright (C) 2012 by Eric Taucher
// License: Creative Commons BY-SA Version 3.0
//
// This code is derived from a StackOverflow answer by Tomas Petricek
// See: http://stackoverflow.com/a/9525471/1243762
//
View Alex monadUserState example
{
module Main (main) where
}
%wrapper "monadUserState"
$digit = 0-9 -- digits
$alpha = [a-zA-Z] -- alphabetic characters
-- Each token has a function on the RHS that is a function (String ->
You can’t perform that action at this time.