% mkdir example && cd example && yesod init --bare
name: Example
type: simple
% curl "https://gist.githubusercontent.com/pbrisbin/448f31288d1ebb4435d6/raw/e49cd961eee825ec35a5332472b210d1b0bbfce1/b-patch.diff" | patch
% yesod test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ -z "$1" ]; then | |
printf "usage: hdocs <identifier>\n" | |
exit 64 | |
fi | |
package="$(printf "%s" "$*" | sed 's/[ .]/-/g; s/.*/\L&/g')" | |
package_glob="*/$package-*/html/index.html" | |
if [ -e "$PWD/.cabal-sandbox" ]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am pbrisbin on github. | |
* I am pbrisbin (https://keybase.io/pbrisbin) on keybase. | |
* I have a public key whose fingerprint is 7A4F 38C2 01F4 3F11 1C95 A9E5 7548 1C55 CEC8 925D | |
To claim this, I am signing this object: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
import Control.Monad.State | |
import Data.List | |
data Dotfile = Dotfile | |
{ dfSource :: FilePath | |
, dfPath :: FilePath | |
, dfTag :: Maybe String | |
, dfHost :: Maybe String |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
instance Aeson.FromJSON User where | |
parseJSON (Object u) = User | |
<$> fmap read (u .: "id") | |
<*> u .: "username" | |
<*> u .: "full_name" | |
<*> u .: "bio" | |
<*> u .: "profile_picture" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module DFA where | |
import Control.Monad.State | |
type DFAState = Int | |
data Rule = Rule | |
{ fromState :: DFAState | |
, inputChars :: [Char] | |
, nextStates :: [DFAState] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Uses xdotool and slock. | |
# | |
# Note: relies on your client being in a terminal with the title/name "chat", e.g. | |
# | |
# $ urxvtc -title chat -n chat -e weechat-curses | |
# | |
### | |
set_away() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Usage: xdg-send ./some_file.pdf | |
# | |
# Requirements on Local, | |
# | |
# - Running sshd on port 2222 | |
# - ssh -R 2222:localhost:2222 remote.com | |
# | |
# Requirements on Remote, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Within an implementation of the TODO app from LYAH, there was something like | |
-- this... | |
data Todo = Todo | |
newtype Add = Add (Either String Todo) | |
newtype Remove = Remove (Either String ()) | |
newtype Complete = Complete (Either String Todo) | |
class Respond a where |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.Monoid | |
-- A validated record is either errors or it | |
type Validated a = Either [String] a | |
-- A validation is the process of taking a record and returning a validated one | |
newtype Validation a = Validation { runValidation :: (a -> Validated a) } | |
-- Validation processes are composable as monoids | |
instance Monoid (Validation a) where |
OlderNewer