Skip to content

Instantly share code, notes, and snippets.

View danieljsummers's full-sized avatar
😸
purrin' right along

Daniel J. Summers danieljsummers

😸
purrin' right along
View GitHub Profile
@danieljsummers
danieljsummers / ReaderMonad.fs
Created September 30, 2016 03:34
My first attempt at a reader monad to provide the equivalent of DI; pretty sure this isn't right
namespace ReaderMonad
// -- begin code lifted from #er demo --
type ReaderM<'d, 'out> = 'd -> 'out
module Reader =
// basic operations
let run dep (rm : ReaderM<_,_>) = rm dep
let constant (c : 'c) : ReaderM<_,'c> = fun _ -> c
// lifting of functions and state
@danieljsummers
danieljsummers / Program.fs
Created April 28, 2017 02:37
Suave userData persisting with keep-alive
open Suave
open Suave.Filters
open Suave.Operators
open System
module View =
let page (data : Map<string, obj>) =
match data |> Map.tryFind "messages" with
| Some x ->
x :?> string list |> List.reduce (+)
@danieljsummers
danieljsummers / hexo-install-global.sh
Last active November 3, 2017 02:37
A script to install hexo-cli globally on Linux without changing filesystem permissions (workaround for issue 2698)
#!/bin/bash
INSTALL_DIR=/usr/lib/node_modules
SUB_DIR=$INSTALL_DIR/hexo-cli/node_modules
echo Getting root privileges...
sudo echo Done.
echo Installing in a temp directory...
mkdir tmp
cd tmp
npm install hexo-cli
echo "Done; moving to global NPM directory..."