Skip to content

Instantly share code, notes, and snippets.

View lonnelars's full-sized avatar

Lars Lønne lonnelars

View GitHub Profile
module Main exposing (..)
import Browser
import Html exposing (..)
import Html.Attributes exposing (value)
import Html.Events exposing (onInput)
type Msg
= NewInput String
@lonnelars
lonnelars / list-npm-tasks.sh
Created June 9, 2017 06:46
List available npm tasks. Assumes package.json exists in cwd. Assumes jq is installed (https://stedolan.github.io/jq/)
#!/usr/bin/env bash
jq '.scripts | keys' package.json
@lonnelars
lonnelars / delete-merged-branches.sh
Last active June 9, 2017 06:48
Delete merged branches
git branch --merged | egrep -v "(^\*|master|development|merged-branch-youd-like-to-keep)" | xargs git branch -d
import javaslang.Function1;
import javaslang.Function2;
import javaslang.Tuple;
import javaslang.Tuple2;
import javaslang.collection.List;
public class Knight {
static final Function1<Tuple2<Integer, Integer>, List<Tuple2<Integer, Integer>>> moveKnight = (start) -> {
// c,r = column,row
int c = start._1;
@lonnelars
lonnelars / phoneList.hs
Created June 25, 2016 19:40
Solution in haskell for the phone list problem from open.kattis.com
import Control.Monad (replicateM)
data Tree a = EmptyTree | Node a [Tree a] deriving (Show, Eq)
label :: Tree a -> a
label (Node a _) = a
subforest :: Tree Char -> [Tree Char]
subforest (Node _ subforest) = subforest
@lonnelars
lonnelars / read-write.clj
Created November 29, 2015 19:58
Read lines from stdin and print to stdout in clojure
(doseq [line (line-seq (java.io.BufferedReader. *in*))]
(println line))