Skip to content

Instantly share code, notes, and snippets.

@mchaver
mchaver / .tmux.conf
Last active March 11, 2022 14:56
My personal tmux configuration file
##############################################################################
# DON'T USE A LOGIN SHELL
# set -g default-command "${SHELL}"
##############################################################################
# ALWAYS START A SESSION (IF NEEDED)
# new-session
# plugins
set -g @plugin 'thewtex/tmux-mem-cpu-load'
{-# LANGUAGE RankNTypes #-}
import Data.Functor.Const
import Data.Functor.Identity
type SimpleLens s a = forall f. Functor f => (a -> f a) -> s -> f s
view :: SimpleLens s a -> s -> a
view l = getConst . l Const
module Main where
import Data.List (subsequences)
data Subject
= ACTReading
| ACTWriting
| ACTEssay
| ACTScience
| ACTMath
@mchaver
mchaver / git-branch-with-stack-work.sh
Created February 25, 2017 14:07
Help you switch git branches and maintain a .stack-work directory for each branch.
#!/bin/bash
# file: switch-branch.sh
# this program helps you switch between git branches and maintaining a
# stack-work directory for each branch. WARNING: .stack-work dirs may be large
# so its a good idea to occasionally remove them.
# check if you can switch out of the current branch or not
# http://stackoverflow.com/a/3879077
require_clean_work_tree () {
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE TypeSynonymInstances #-}
import Data.Char
import Data.Maybe
import Data.Monoid
import Development.Shake
import Development.Shake.Command
@mchaver
mchaver / tutorial1.hs
Created January 8, 2016 03:34
Short example of how to use IORef. IORef is not a global value, it is a container that must be passed, but its contents can be changed.
module Main where
import Data.IORef
-- runhaskell tutorial1.hs
{-
create IORef with newIORef
newIORef :: a -> IO (IORef a)
IORef is a container that has something of type a
the value in IORef can change
@mchaver
mchaver / php55_brew_error
Created August 7, 2014 08:46
Error reports from building php55 via homebrew
brew --config
HOMEBREW_VERSION: 0.9.5
ORIGIN: https://github.com/Homebrew/homebrew.git
HEAD: a68804192aff87c130df0820592f7b393193bd6c
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: quad-core 64-bit arrandale
OS X: 10.9.4-x86_64
Xcode: 5.1.1
CLT: 5.1.0.0.1.1396320587