Skip to content

Instantly share code, notes, and snippets.

Steve Purcell purcell

Block or report user

Report or block purcell

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
@purcell
purcell / iosevka
Last active Aug 17, 2017
Mac custom-build of Iosevka with Pragmata-like features
View iosevka
#!/bin/sh -e
# https://github.com/be5invis/Iosevka#build-your-own-style
DIR=~/Projects/External/iosevka
if [ -d "$DIR" ]; then
(cd $DIR && git pull)
else
git clone --depth 1 https://github.com/be5invis/Iosevka $DIR
fi
View Puzzle.hs
module Puzzle where
import Data.List (permutations)
import Control.Monad (guard)
solution = do
[a,b,c,d,e,f] <- permutations "123456"
guard $ multiple 6 [a,b,c,d,e,f]
guard $ multiple 5 [a,b,c,d,e]
guard $ multiple 4 [a,b,c,d]
View Main.hs
module Main where
import Text.Parsec
import Text.Parsec.String
main :: IO ()
main = do
input <- getLine
View Classifier.hs
module Classifier
( Classifier(..)
, empty
, update
, union
, classify
, singleton
, scaled
, test
) where
View puzzle.hs
module Puzzle where
valid :: Integer -> Bool
valid abcde = divisibleBy bcde && divisibleBy cde && divisibleBy de && divisibleBy e
where divisibleBy n = n /= 0 && ((abcde `mod` n) == 0)
bcde = abcde `mod` 10000
cde = bcde `mod` 1000
de = cde `mod` 100
e = de `mod` 10
View FizzBuzz.hs
module FizzBuzz where
fizzbuzz :: (Show a, Integral a) => a -> String
fizzbuzz n = case (n `rem` 3, n `rem` 5) of
(0, 0) -> "FizzBuzz"
(0, _) -> "Fizz"
(_, 0) -> "Buzz"
_ -> show n
main = mapM_ (putStrLn . fizzbuzz) [1..50]
View FizzBuzz.hs
module FizzBuzz where
import Data.Maybe
data FizzBuzz = Fizz | Buzz deriving Show
whenDivisible :: Integral a => a -> b -> a -> Maybe b
whenDivisible d x n = if n `rem` d == 0 then Just x else Nothing
fizzbuzz :: (Show a, Integral a) => a -> String
fizzbuzz n = if null tags then show n else concatMap show tags
View FizzBuzz.hs
module FizzBuzz where
data FizzBuzz = Fizz | Buzz | FizzBuzz deriving Show
fizzbuzz :: Integral a => a -> Either FizzBuzz a
fizzbuzz n = case (n `rem` 3, n `rem` 5) of
(0, 0) -> Left FizzBuzz
(0, _) -> Left Fizz
(_, 0) -> Left Buzz
_ -> Right n
@purcell
purcell / console.log
Created Apr 11, 2014
iStat Menus breakage - console log
View console.log
11/04/2014 10:49:11.070 SystemUIServer[10295]: Could not load menu extra NSBundle </Library/Application Support/iStat Menus 4/extras/iStatMenusMemory.menu> (not yet loaded) for Class (null)
11/04/2014 10:49:11.071 SystemUIServer[10295]: Cannot find executable for CFBundle 0x7f9bf255df80 </Library/Application Support/iStat Menus 4/extras/iStatMenusDrives.menu> (not loaded)
11/04/2014 10:49:11.071 SystemUIServer[10295]: Could not load menu extra NSBundle </Library/Application Support/iStat Menus 4/extras/iStatMenusDrives.menu> (not yet loaded) for Class (null)
11/04/2014 10:49:11.463 iStatMenusAgent[10329]: Loading istat menus agent
11/04/2014 10:49:11.463 iStatMenusAgent[10329]: iStat Menus Agent version 4.21 (450)
11/04/2014 10:49:11.514 iStatMenusAgent[10329]: iStat Menus Agent - Update checker enabled
11/04/2014 10:49:54.681 SystemUIServer[160]: Cannot find executable for CFBundle 0x7f8dca5181d0 </Library/Application Support/iStat Menus 4/extras/MenuCracker.menu> (not loaded)
11/04/2014 10:49:54.682 SystemU
@purcell
purcell / .slate
Last active Feb 7, 2018
Slate config
View .slate
# See https://github.com/jigish/slate#readme
config defaultToCurrentScreen true
config nudgePercentOf screenSize
config resizePercentOf screenSize
config focusPreferSameApp false
config focusCheckWidthMax 3000
config checkDefaultsOnLoad true
config windowHintsShowIcons true
config windowHintsSpread true
You can’t perform that action at this time.