Doesn't GitHub render smart quotes?
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 | |
# | |
# pbrisbin 2015 - look for markdown links to local images, move them to S3 then | |
# update the markdown to link to it. | |
# | |
# Things to tweak: | |
# | |
# - Processes posts/*.md | |
# - Looks for "/img/image.ext" | |
# - Puts img/image.ext to s3://$bucket/$(prefix $post)image.ext |
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 Test where | |
import Control.Applicative | |
data EitherX a b = LeftX a | RightX b deriving (Eq, Show) | |
instance Functor (EitherX a) where | |
fmap f (RightX x) = RightX $ f x | |
fmap _ (LeftX e) = LeftX e |
Default behavior dictates the following order for ZSH startup files:
/etc/zshenv
~/.zshenv
/etc/zprofile
(if login shell)~/.zprofile
(if login shell)/etc/zshrc
(if interactive)~/.zshrc
(if interactive)/etc/zlogin
(if login shell)~/.zlogin
(if login shell)
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
# Connect to a server | |
redis-cli server | |
# Make an insert | |
set key value | |
# Make multiple insert |
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
{-# LANGUAGE OverloadedStrings #-} | |
module Main where | |
import Network.Mail.Mime | |
import Network.Mail.SMTP | |
import qualified Data.Text.Lazy as TL | |
-- Get from e.g. `heroku config` | |
username = "" |
Prerequisites: GHC + cabal-install
Setup project skeleton using hi and my template:
% cabal update
% cabal install hi
% hi \
--module-name "Foo.Bar" \
--package-name "foo" \
--author 'Your Name' \
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
2014-07-17 15:05:03 darthdeus guys I'm getting No instance for (Text.Julius.ToJavascript …Data.ByteString.Lazy.Internal.ByteString) when using aeson's encode ... how should I convert things to json so that I can interpolate them in julius? | |
2014-07-17 15:05:38 darthdeus should i unpack the bytestring and pack it into Text? (seems inefficient) | |
2014-07-17 15:09:25 darthdeus hmm seems lazy Text doesn't work either | |
2014-07-17 15:16:40 darthdeus aaargh, string doesn't work either | |
2014-07-17 15:16:55 brisbin String and Text should both be interpolatable | |
2014-07-17 15:17:10 darthdeus No instance for (Text.Julius.ToJavascript String) … arising from a use of ‘Text.Julius.toJavascript’ | |
2014-07-17 15:17:18 darthdeus after doing this | |
2014-07-17 15:17:25 darthdeus let json = TL.unpack $ decodeUtf8 $ encode reports :: String | |
2014-07-17 15:17:32 darthdeus inside the .julius file just #{json} | |
2014-07-17 15:21:52 brisbin |
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 |
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 |