Skip to content

Instantly share code, notes, and snippets.

View kvanbere's full-sized avatar
:octocat:
We write and test real time control software. @cuedo

Kyle Van Berendonck kvanbere

:octocat:
We write and test real time control software. @cuedo
View GitHub Profile
@eligrey
eligrey / object-watch.js
Created April 30, 2010 01:38
object.watch polyfill in ES5
/*
* object.watch polyfill
*
* 2012-04-03
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
@dtjm
dtjm / subversion-prompt.sh
Created August 19, 2010 18:13
Subversion PS1 prompt functions for bash
#
# If you want to see svn modifications:
# export SVN_SHOWDIRTYSTATE=1
#
# Put this in your PS1 like this:
# PS1='\u@\h:\W\[\033[01;33m\]$(__git_svn_ps1)\[\033[00m\]$ '
# Git/Subversion prompt function
__git_svn_ps1() {
@alanbriolat
alanbriolat / default.conf
Created September 28, 2011 14:01
nginx userdir + PHP-FPM
server {
listen 80;
server_name localhost;
# ... other default site stuff, document root, etc. ...
location ~ ^/~(?<userdir_user>.+?)(?<userdir_uri>/.*)?$ {
alias /home/$userdir_user/public_html$userdir_uri;
index index.html index.htm index.php;
autoindex on;
typedef void* function_t;
typedef void* prev_closure_t;
union arg_t {
void* box; // Pointer to a boxed thing (or closure)
int val; // Byval if it fits in 8 bytes
};
// foo a b c d e = ...
@gelisam
gelisam / Main.hs
Last active August 22, 2022 18:18
IndexedMonad example
-- in reply to http://www.reddit.com/r/haskell/comments/21mja6/make_lllegal_state_transitions_unrepresentable/
--
-- We implement a tiny language with three commands: Open, Close, and Get.
-- The first Get after an Open returns 1, the second Get returns 2, and so on.
--
-- Get is only valid while the state is open, and
-- Open must always be matched by a Close.
-- We enforce both restrictions via the type system.
--
-- There are two valid states: Opened and Closed.
@kvanbere
kvanbere / Main.hs
Created March 30, 2014 02:24 — forked from gelisam/Main.hs
-- in reply to http://www.reddit.com/r/haskell/comments/21mja6/make_lllegal_state_transitions_unrepresentable/
--
-- We implement a tiny language with three commands: Open, Close, and Get.
-- The first Get after an Open returns 1, the second Get returns 2, and so on.
--
-- Get is only valid while the state is open, and
-- Open must always be matched by a Close.
-- We enforce both restrictions via the type system.
--
-- There are two valid states: Opened and Closed.
{-# LANGUAGE OverloadedStrings, TemplateHaskell, QuasiQuotes #-}
import Data.Aeson
import Data.Monoid
import Data.Text (Text, unpack)
import Control.Monad.Writer
import qualified Data.Map as M
import qualified Data.Vector as V
import qualified Data.HashMap.Strict as H
import Language.Haskell.TH
@joehillen
joehillen / server.hs
Last active June 1, 2022 17:56
A re-implementation of Simon Marlow's Async Haskell Chat Server using Conduits
{-# LANGUAGE OverloadedStrings, RecordWildCards, LambdaCase #-}
import Conduit
import Data.Conduit
import Data.Conduit.Network
import qualified Data.ByteString.Char8 as BS
import Data.Conduit.TMChan
import Text.Printf (printf)
import Control.Concurrent.STM
import qualified Data.Map as Map
@CasperPas
CasperPas / Material-Design-Spinner.markdown
Created September 12, 2014 17:11
Polymer element of "Material Design Spinner"
@nkpart
nkpart / Yolo.hs
Last active September 5, 2018 13:50
{-# LANGUAGE GADTs #-}
module Yolo where
import System.IO.Unsafe
class Yolo f where
yolo :: f a -> a
instance Yolo Maybe where
yolo (Just x) = x