Skip to content

Instantly share code, notes, and snippets.

View hallettj's full-sized avatar

Jesse Hallett hallettj

View GitHub Profile
Hello, world!
import Control.Applicative ((<$>), (<*>))
import Control.Concurrent.Async (Concurrently(..), runConcurrently)
import Data.Monoid (Monoid, (<>), mappend, mempty)
instance (Monoid a) => Monoid (IO a) where
mappend x y = runConcurrently $ (<>) <$> Concurrently x <*> Concurrently y
mempty = return mempty
-- example:
action = getLine <> getLine
@hallettj
hallettj / tmux.conf .sh
Last active August 29, 2015 13:57
tmux key bindings to run common git commands in a new split
# open vim in a new split
bind e split-window -h -c "#{pane_current_path}" sensible-editor
# shortcuts for common git operations
bind g split-window -h -c "#{pane_current_path}" 'GIT_PAGER="less -+F" git lg'
bind D split-window -h -c "#{pane_current_path}" 'GIT_PAGER="less -+F" git diff'
bind C split-window -h -c "#{pane_current_path}" 'GIT_PAGER="less -+F" git diff --cached'
bind A split-window -h -c "#{pane_current_path}" 'git add -p'
@hallettj
hallettj / array_monad.js
Created March 28, 2014 08:03
Trying to apply ES6 generators to create monad comprehensions. Unfortunately it looks like this will not work with monads that contain multiple values, such as arrays.
/*
* The implementation
*/
function du(comprehension) {
return function(/* args */) {
var gen = comprehension.apply(null, arguments)
return next();
function next(v) {

Keybase proof

I hereby claim:

  • I am hallettj on github.
  • I am hallettj (https://keybase.io/hallettj) on keybase.
  • I have a public key whose fingerprint is A378 B079 9F05 93C0 B499 DD02 8FB4 E35F E86B 913B

To claim this, I am signing this object:

@hallettj
hallettj / Logic.idr
Created April 18, 2014 20:56
basic mathematical logic in Idris
module Logic
infixr 1 ==>
(==>) : Bool -> Bool -> Bool
False ==> _ = True
True ==> x = x
data Exists : (A : Type) -> (P : A -> Bool) -> Type where
exists : {A : Type} -> {P : A -> Bool} -> (a : A) -> so (P a) -> Exists A P
@hallettj
hallettj / quickstart.markdown
Last active August 29, 2015 14:17
JavaScript development quickstart

Quickstart

Get a development environment and project scaffold set up in a jiffy.

Development environment

First install node and npm. There are instructions here:

# My bash prompt. Displays the currently checked out git
# branch and the exit status of the last command.
#
# This is adapted from various sources, including colors
# from Lifehacker and exit status and git branch indicators
# from Igal Koshevoy <http://gist.github.com/109520>.
#
# To use copy and paste this code into your .bashrc file.
function prompt {
...
Loading package cgi-3001.1.7.1 ... linking ... done.
Loading package ansi-terminal-0.5.0 ... linking ... done.
Loading package ansi-wl-pprint-0.5.0 ... linking ... done.
[24 of 25] Compiling Hack.Contrib.Middleware.Lucky ( src/Hack/Contrib/Middleware/Lucky.hs, dist/build/Hack/Contrib/Middleware/Lucky.o )
[25 of 25] Compiling Hack.Contrib.Middleware.ShowStatus ( src/Hack/Contrib/Middleware/ShowStatus.hs, dist/build/Hack/Contrib/Middleware/ShowStatus.o )
src/Hack/Contrib/Middleware/ShowStatus.hs:56:53:
Couldn't match expected type `String -> String'
against inferred type `[Char]'
# Command to transcode HD video for upload to Vimeo. This assumes that the video started with appropriate dimensions and frame rate.
ffmpeg -i bdd.MP4 -an -pass 1 -vcodec libx264 -vpre fastfirstpass -b 5000k -bt 5000k -g 30 -threads 0 -y -f null /dev/null && ffmpeg -i bdd.MP4 -acodec libfaac -ab 128k -pass 2 -vcodec libx264 -vpre hq -b 5000k -bt 5000k -g 30 -threads 0 -y -f mp4 bdd.prepared.mp4