Skip to content

Instantly share code, notes, and snippets.

View eborden's full-sized avatar
💙

Evan Rutledge Borden eborden

💙
View GitHub Profile
@eborden
eborden / MontyHall.hs
Last active April 14, 2016 03:24
Various evaulation strategies for the Monty Hall problem with good and bad performance.
{-# LANGUAGE BangPatterns #-}
module Main (main) where
import Control.Concurrent.Async (mapConcurrently)
import Control.Monad.Writer (Writer, runWriter, execWriter, tell)
import Control.Parallel (pseq, par)
import Data.Foldable (foldl', fold)
import Data.Monoid ((<>))
import Data.Vector (Vector)
import Data.Vector.Generic ((!))
@eborden
eborden / Main.hs
Last active August 29, 2015 14:21
Rust's "Dining Philosophers" solution reimplemented in unidiomatic Haskell
module Main where
import Prelude hiding (sequence)
import Control.Concurrent
import Data.Foldable
import Data.Traversable
data Philosopher = Philosopher
{ name :: String
, left :: Int
@eborden
eborden / gist:e69054ec4c463bfd2f9a
Last active August 29, 2015 14:04
Node server to test whether chunked resources are loaded if the head element is partial. Should log: "title: " and "title: stuff"
const http = require('http');
http.createServer(function (req, res) {
if (req.url == '/script.js') {
res.writeHead(200, {'Content-Type': 'text/javascript'});
res.end('console.log("title: " + document.title);'
+ 'setTimeout(function() {'
+ ' console.log("title:" + document.title);'
+ '}, 300);'