This file contains hidden or 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 BangPatterns #-} | |
module FastParse (parseInts) where | |
import Prelude hiding (length) | |
import Control.Applicative hiding (empty) | |
import Control.Monad | |
import Data.Char | |
import Data.Maybe | |
import Data.Sequence |
This file contains hidden or 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 BangPatterns #-} | |
{-# OPTIONS_GHC -Odph #-} | |
import qualified Data.ByteString.Char8 as S | |
import qualified Data.Vector as U | |
-- Read ints from stdin into a vector then print the length. | |
main = S.getContents >>= print . U.length . parse | |
-- Fill a new vector from a file containing a list of numbers. |
This file contains hidden or 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 BangPatterns #-} | |
{-# OPTIONS_GHC -Odph #-} | |
import Prelude hiding (map, sum) | |
import qualified Data.ByteString.Char8 as S | |
import Data.List.Stream | |
main = S.getContents >>= print . sumOfSquares . parse | |
where sumOfSquares = sum . map (\x -> x * x) |
This file contains hidden or 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 ParseUriQuery where | |
import Control.Applicative | |
import Data.Attoparsec.ByteString.Char8 | |
import Data.ByteString.Char8 (ByteString, pack, unpack) | |
import Data.Either | |
data QueryTerm = QueryTerm { termName :: ByteString | |
, termValue :: Maybe ByteString | |
} deriving (Eq, Read, Show) |
This file contains hidden or 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
set bind-tty-special-chars off | |
Control-h: backward-char | |
"\eh": backward-word | |
Control-t: previous-history | |
Control-n: next-history | |
Control-s: forward-char | |
"\es": forward-word |
This file contains hidden or 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
;;; Ergonomic changes. | |
;;; These are for the Dvorak keyboard layout. | |
(defvar mrenaud-ergo-minor-mode-map (make-keymap) "mrenaud-ergo-minor-mode keymap.") | |
;; Movement commands: | |
;; Now lie on right hand homerow. | |
;; h t n s | |
;; < ^ v > | |
(define-key mrenaud-ergo-minor-mode-map (kbd "C-h") 'backward-char) |
This file contains hidden or 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
{- | Based on http://www.osl.iu.edu/publications/prints/2005/garcia05:_extended_comparing05.pdf -} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE TypeFamilies #-} | |
import Data.Array | |
---------------------------------------- | |
-- Typeclass definitions. |
This file contains hidden or 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/bash | |
# Save the current branch. | |
previous_branch=`git rev-parse --abbrev-ref HEAD` | |
# Switch to generated code branch and pull in any changes from the working branch. | |
git checkout generated-code | |
git merge --no-edit $previous_branch | |
# <Build generated files> |
This file contains hidden or 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
customDecoder decoder toResult = | |
Json.andThen | |
(\a -> | |
case toResult a of | |
Ok b -> Json.succeed b | |
Err err -> Json.fail err | |
) | |
decoder |
This file contains hidden or 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
(require 'helm-config) | |
(require 'helm-ls-git) | |
(require 'helm-swoop) | |
(helm-mode) | |
;; Interactive buffer rebindings. | |
(define-key helm-map (kbd "<tab>") 'helm-execute-persistent-action) | |
(define-key helm-map (kbd "C-i") 'helm-execute-persistent-action) | |
(define-key helm-map (kbd "C-z") 'helm-select-action) |