Skip to content

Instantly share code, notes, and snippets.

{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE NamedFieldPuns #-}
module Main where
import Lucid.Base

Wizard

Somebody on reddit asked for a nice way of doing wizards functionally.

At least theoretically you can combine free applicatives with free monads to get a branching wizard.

Let's see how.

Let's start with how to define a form element.

Docker and Kubernetes Workshop

These are the instructions for the docker and kubernetes track of the developer day workshop on Friday W40.

Follow these and everything will be fine.

Preparation

For this Workshop, you'll need the following tools installed:

Keybase proof

I hereby claim:

  • I am masser on github.
  • I am masser (https://keybase.io/masser) on keybase.
  • I have a public key ASAutdO40vxj5Lycbt77OjjxBD39xEpyaDk5Uf4OpSFM8Ao

To claim this, I am signing this object:

{-# LANGUAGE Arrows #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TupleSections #-}
import Control.Applicative ((<|>))
import Control.Arrow
import Control.Category
import Control.Monad (unless)
import Data.Maybe (fromJust)
@MasseR
MasseR / gist:6012478
Created July 16, 2013 20:43
tf-idf test
import Data.Map (Map)
import qualified Data.Map as M
import Data.Monoid
import Data.List (find, sortBy)
import Data.Maybe (fromMaybe)
import Data.Text.Lazy (Text)
import qualified Data.Text.Lazy as T
import qualified Data.Text.Lazy.IO as TI
import Data.Function
import Data.Char
@MasseR
MasseR / gist:5081569
Created March 4, 2013 11:05
Topological sorting
(ns topological.core)
(def testlist
[{:depends #{2} :provides 3}
{:depends #{2} :provides 1}
{:depends #{} :provides 2}
{:depends #{1} :provides 4}
])
(defn free-nodes [xs]
var Node = function(idx, x,y) {
this.idx = idx;
this.xvel = 0;
this.yvel = 0;
this.xforce = 0;
this.yforce = 0;
this.x = x;
this.y = y;
this.dampen = 0.85;
this.color = 'rgb(' + (Math.floor(Math.random() * 255)) + ',' + (Math.floor(Math.random() * 255)) + ',' + (Math.floor(Math.random() * 255)) + ')';
@MasseR
MasseR / endotemplates.hs
Created February 10, 2013 12:53
Using endo monoid, writer monad and blaze html combinators for creating a web page
{-# Language GeneralizedNewtypeDeriving #-}
{-# Language OverloadedStrings #-}
import Data.Monoid
import Text.Blaze.Html.Renderer.Text
import qualified Text.Blaze.Html5 as H
import qualified Text.Blaze.Html5.Attributes as A
import Text.Blaze.Html ((!), Html)
import Control.Monad.Writer
import Control.Monad.Identity
@MasseR
MasseR / teatimer.sh
Created January 7, 2013 06:07
Simple tea timer
#!/bin/bash
start=$1
now=$(date +%s)
remaining=$(($start - ($(date +%s) - $now)))
while [ $remaining -gt 0 ]; do
echo -ne "\r\033[K$remaining"
sleep 1;