Skip to content

Instantly share code, notes, and snippets.

View mwotton's full-sized avatar

Mark Wotton mwotton

View GitHub Profile
{-# LANGUAGE ScopedTypeVariables #-}
import Data.Monoid
import Data.List
import Debug.Trace
import Data.Maybe (fromMaybe)
dotrace x = trace (show x) x
getPrefs name = (`zip` [1..]) . lines <$> readFile name
git config --global alias.recent "for-each-ref --sort=committerdate refs/heads/ --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))'"
(require 'flycheck-haskell-stack)
(add-hook 'haskell-mode-hook
(lambda ()
(flycheck-select-checker 'haskell-stack)
(flycheck-mode)
(whitespace-mode)
(haskell-mode-stylish-buffer)
))
d <- Data.Map.fromList . Prelude.map (\x -> (sort x,x)) . Prelude.map (Prelude.filter (\x -> x >= 'a' && x <= 'z')) . lines . Prelude.map toLower <$> readFile "/home/mark/wlist_match10.txt"
Data.Map.lookup (sort "ducrletde") d
> Nothing
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
module Leadstage.API
where
"did you put the bins out Tony love?"
"What's important and what I think the Australian people think is important is that I stopped the boats"
*internal sigh* "is the dog fed?"
"If by dog you mean boats, and by fed you mean stopped, then by jingo yes"
"I'm leaving you, Tony"
"Not by boat you're not"
csvs = lapply(list.files(pattern="headed$"), read.csv)
r=Reduce(function(x,y) {merge(x,y, by="key",all=TRUE)}, csvs[-1], csvs[[1]])
write.csv(r, file="final.csv")
(defun ghc-display-errors-to-minibuf ()
(let ((file-msgs (ghc-get-errors-over-warnings)))
(if (null file-msgs)
(message "No errors or warnings")
(let* ((file (ghc-file-msgs-get-file file-msgs))
(msgs (ghc-file-msgs-get-msgs file-msgs))
(errmsg (mapconcat 'identity msgs "\n"))
(buffile buffer-file-name))
(if (string-equal buffile file)
orb ➜ ~/Downloads cat enwiki-latest-all-titles-in-ns0| time ag tennis > /dev/null
ag tennis > /dev/null 1.03s user 0.04s system 99% cpu 1.066 total
orb ➜ ~/Downloads cat enwiki-latest-all-titles-in-ns0| time grep tennis > /dev/null
grep --color=auto --exclude-dir={.bzr,.cvs,.git,.hg,.svn} tennis > /dev/null 0.19s user 0.02s system 98% cpu 0.219 total
orb ➜ ~/Downloads
orb ➜ ~ curl http://localhost:3000/12
<h1>accessed 12 times!</h1>% orb ➜ ~ curl http://localhost:3000/12
<h1>accessed 24 times!</h1>% orb ➜ ~
orb ➜ ~ curl http://localhost:3000/12
<h1>accessed 36 times!</h1>%