Skip to content

Instantly share code, notes, and snippets.

Evan Borden eborden

Block or report user

Report or block eborden

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@eborden
eborden / stack-ghcid.sh
Last active May 16, 2019
Run ghcid in a monorepo via stack
View stack-ghcid.sh
project=$(basename "$(pwd)")
# build dependencies
build_deps="stack build $project --fast --pedantic --dependencies-only --interleaved-output"
# restart on changes in other packages
restarts=$(find ../. -maxdepth 1 -type d \
-not -name "$project" \
-not -name .stack-work \
-not -name . \
View take-throw-test.hs
$ ./take-throw-test.hs
with
m
...
with
m
with
m
with
m
@eborden
eborden / AVerbalArithmetic.hs
Last active Mar 9, 2018
A brute force solution to verbal arithmetic
View AVerbalArithmetic.hs
import Control.Monad (guard)
import Data.Bifunctor (second)
import Data.Foldable (for_, traverse_)
import Data.List (nub, permutations, unwords)
import Data.Map (Map)
import qualified Data.Map as Map
import Data.Maybe (fromMaybe)
test :: IO ()
@eborden
eborden / stretch.service
Last active Nov 8, 2017
Insecure stretching reminder using giphy, jq and systemd timers
View stretch.service
[Unit]
Description=Stretching Reminder
[Service]
User=username
Environment=DISPLAY=:0
Type=oneshot
ExecStart=/path-to/stretch.sh
@eborden
eborden / Chans.hs
Created Oct 13, 2017
Immortal chans
View Chans.hs
#!/usr/bin/env stack
-- stack --resolver lts-9.8 script
module Main where
import Data.Functor (void)
import Data.Foldable (traverse_, for_)
import Data.Traversable (for)
import Control.Concurrent (forkIO, readChan, writeChan, newChan, getNumCapabilities)
import Control.Immortal (create, wait, Thread)
@eborden
eborden / Main.hs
Last active Sep 26, 2017
Benchmark various folding averages
View Main.hs
module Main (main) where
import qualified Control.Foldl as Fold
import Criterion.Main
import qualified Data.List
import Data.Maybe
import Data.Semigroup
naiveAvg, foldMapAvg, foldlAvg, foldAvg :: [Float] -> Float
naiveAvg xs = Prelude.sum xs / fromIntegral (Prelude.length xs)
@eborden
eborden / CompactFail.hs
Created Aug 24, 2017
Compaction failing on an existential type carrying a type class dict
View CompactFail.hs
#!/usr/bin/env stack
-- stack --resolver nightly-2017-08-20 --install-ghc runghc --package compact
{-# LANGUAGE ExistentialQuantification #-}
module Main where
import Data.Compact
class SomeClass a where
someId :: a -> a
View diagnostic_and_session.json
{
"adaptiveLowestDomain": "aengesha",
"adaptiveLevelsPassed": 0,
"domainDetails": [
{
"adaptiveStandardProgression": [
{
"changeDate": "2017-08-02T16:03:46.936525Z",
"standardId": "ohbeecei"
}
@eborden
eborden / TestWithMTL.hs
Last active Jun 7, 2017
An example of using MTL and "mock" interpretation.
View TestWithMTL.hs
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Main where
import Prelude hiding (readFile, writeFile)
import Control.Monad.Trans
import Control.Monad.State
import qualified System.IO as SIO
import Data.Map (Map)
import qualified Data.Map as Map
import Data.Maybe
@eborden
eborden / javascript.vim
Created Mar 20, 2017
Enable Neomake eslint per buffer per project
View javascript.vim
" Enable eslint for given project buffer
" Store current cwd
let s:prev_cwd = getcwd()
" change path to project root for current buffer
let s:project_cwd = split(expand('%:p:h'), "js")[0]
lcd `=s:project_cwd`
" Assign proper eslint vars for this buffer
let s:eslint_path = system('PATH=$(npm bin):$PATH && which eslint')
You can’t perform that action at this time.