Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View AlistairB's full-sized avatar

Alistair Burrowes AlistairB

View GitHub Profile
@AlistairB
AlistairB / dropbox-setup.sh
Last active November 28, 2015 23:20 — forked from jbhannah/dropbox-setup.sh
Dropbox setup on a headless Ubuntu Server (http://wp.me/pnbL6-5F)
#!/bin/sh
# Dropbox setup on a headless Ubuntu Server
# Script written by Jesse B. Hannah (http://jbhannah.net) <jesse@jbhannah.net>
# Based on http://wiki.dropbox.com/TipsAndTricks/UbuntuServerInstall
###
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@AlistairB
AlistairB / interesting-monad.hs
Created April 22, 2017 00:03
I found it surprising how this worked :) But it helped me understand monads and do
twiceWhenEven :: [Integer] -> [Integer]
twiceWhenEven xs = do
x <- xs
if even x
then [x*x, x*x]
else [x*x]
-- Prelude> twiceWhenEven [1..3]
-- [1,4,4,9]
@AlistairB
AlistairB / 1-before-refactor.hs
Last active November 27, 2017 00:11
Xml Error Refactor
-- a huge number of imports above
main :: IO ()
main = do
createDirectoryIfMissing True "output"
env <- getAppEnv
let connInfo = dbConnectInfo env
db <- dbConnection connInfo
queryText <- BS.readFile "db/errors.sql"
results <- query_ db (Query queryText)
@AlistairB
AlistairB / TypeclassStuff.hs
Created June 2, 2018 12:15
Haskell Learnings
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE KindSignatures #-}
class Zomg a where
zomg :: a -> String
data Errr a = Errr a
instance Zomg (Errr a) where
zomg a = "ROckin"