Skip to content

Instantly share code, notes, and snippets.

Avatar

Lyndon Maydwell sordina

View GitHub Profile
View GraphqlWebsockets.hs
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeApplications #-}
-- | Small demonstration of GraphQL subscriptions over websockets as per https://github.com/apollographql
--
-- * Intended to be a convention over configuration approach.
-- * Retries subscription on failures.
-- * Provides callbacks for success and errors.
View RunEverything.hs
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE ApplicativeDo #-}
{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE TypeApplications #-}
import Control.Applicative
import Control.Exception
import Control.Monad
View arity.hs
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
-- Wrong!
View mergesorts.hs
{-# LANGUAGE DeriveFunctor #-}
module Main where
-- see https://jtobin.io/sorting-with-style
import Control.Arrow ((***))
import Data.Function ((&))
View fun_mergesort.hs
{-# LANGUAGE DeriveFunctor #-}
module Main where
-- see https://jtobin.io/sorting-with-style
import Control.Arrow ((***))
import Data.Function ((&))
View envrace.hs
{-# LANGUAGE BlockArguments #-}
module Main where
import System.Environment
import Control.Monad
import Control.Concurrent
import Control.Exception.Base
{- Inspiration:
View voronoi_indexed.hs
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE FlexibleInstances #-}
-- See also: https://github.com/sordina/non-orthogonal-kd-trees#non-orthogonal-kd-trees
module Main where
import Graphics.Gloss
import Graphics.Gloss.Raster.Field
import System.Random
View lispgraph.hs
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE LambdaCase #-}
module Main where
import Data.AttoLisp
import Data.Graph.Inductive.Graph
import Data.Graph.Inductive.PatriciaTree
import Data.GraphViz
View patchbay.hs
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE BlockArguments #-}
-- From: https://patchbay.pub
--
-- Normal Usage:
-- Shell 1: curl localhost:9000/test1
-- Shell 2: curl -s localhost:9000/test1 -X POST -T /dev/stdin
--
-- Pub-Sub Usage:
@sordina
sordina / gc.c
Last active Nov 15, 2019
Implementation of Baby's first Garbage Collector from http://journal.stuffwithstuff.com/2013/12/08/babys-first-garbage-collector
View gc.c
// http://journal.stuffwithstuff.com/2013/12/08/babys-first-garbage-collector/
//
#define STACK_MAX 256
#define INITIAL_GC_THRESHOLD 2
#include <stdio.h>
#include <stdlib.h>
void gc(); // Pre-Declared for co-recursive usage