I hereby claim:
- I am corajr on github.
- I am corajr (https://keybase.io/corajr) on keybase.
- I have a public key whose fingerprint is 7A74 15B8 979D 1B45 754E 3CDD EF47 4C72 E512 368D
To claim this, I am signing this object:
| module Data.List.Permute where | |
| permute :: [a] -> [[a]] | |
| permute [] = [[]] | |
| permute xs = let picks = pick xs | |
| f (x, xs') = map (x:) (permute xs') | |
| in concatMap f picks | |
| pick :: [a] -> [(a, [a])] | |
| pick [] = [] |
| { | |
| "latitude": 42.3212, | |
| "longitude": -71.1103, | |
| "timezone": "America\/New_York", | |
| "offset": -4, | |
| "currently": { | |
| "time": 1460238221, | |
| "summary": "Mostly Cloudy", | |
| "icon": "partly-cloudy-day", | |
| "nearestStormDistance": 8, |
| #!/bin/bash | |
| # from https://github.com/depy/my-git-hooks/blob/master/run-rspec-test-pre-commit | |
| # usage: copy me to .git/hooks/pre-commit | |
| # chmod +x .git/hooks/pre-commit | |
| # Stash unstaged changes before running tests | |
| git stash -q --keep-index | |
| # Run tests |
| #!/bin/bash | |
| # usage: copy me to .git/hooks/pre-commit | |
| # chmod +x .git/hooks/pre-commit | |
| # Stash unstaged changes and untracked files before running tests | |
| git stash -q --keep-index -u | |
| # Run non-feature tests | |
| rspec --format progress --tag ~type:feature |
| #!/bin/bash | |
| # usage: copy me to .git/hooks/pre-commit | |
| # chmod +x .git/hooks/pre-commit | |
| # Stash unstaged changes and untracked files before running tests | |
| git stash -q --keep-index -u | |
| # Run non-feature tests | |
| rspec --format progress --tag ~type:feature |
| module Data.Integer.EveryOther where | |
| genericEveryOther :: Monoid a => [a] -> [a] | |
| genericEveryOther [] = [] | |
| genericEveryOther xs = zipWith mappend (scanl mappend mempty (init xs)) (scanr mappend mempty (tail xs)) | |
| everyOther :: [Int] -> [Int] | |
| everyOther [] = [] | |
| everyOther xs = zipWith (*) (scanl (*) 1 (init xs)) (scanr (*) 1 (tail xs)) |
| module Data.Vector.FindMax where | |
| import Data.Vector (Vector, (!), (!?)) | |
| import qualified Data.Vector as V | |
| import Data.Maybe (fromMaybe) | |
| findMax :: Vector Int -> Maybe Int | |
| findMax v | |
| | V.null v = Nothing | |
| | pivotValue > leftValue && pivotValue > rightValue = Just pivotValue |
| {-# LANGUAGE TemplateHaskell #-} | |
| module Data.Integer.FibonacciStack where | |
| import Control.Monad.State | |
| import Control.Lens | |
| naiveFib :: Int -> Integer | |
| naiveFib 0 = 0 | |
| naiveFib 1 = 1 | |
| naiveFib n = naiveFib (n-1) + naiveFib (n-2) |
I hereby claim:
To claim this, I am signing this object:
| #!/usr/bin/env stack | |
| -- stack --resolver lts-8.0 --install-ghc runghc --package hspec --package lens | |
| import Test.Hspec | |
| import Data.List (sort) | |
| import Control.Lens (_init, _tail, (%~)) | |
| listScrambler :: String -> String | |
| listScrambler = unwords . map f . words | |
| where f (x:xs@(_:_)) = x:(sort (init xs)) ++ [last xs] | |
| f xs = xs |