Skip to content

Instantly share code, notes, and snippets.

-- Ted Wilson
-- August 2015
import Data.Function (on)
import Data.List
import System.IO
import System.Random (randomRIO)
type Card = (Int, Char)
type Deck = [Card]
type Foundations = [Card]
@caldwell
caldwell / .gitconfig
Created February 25, 2013 01:26
Add these config lines to your .gitconfig to use emacs's ediff as git's mergetool.
[merge]
tool = ediff
[mergetool "ediff"]
cmd = emacs --eval \"(ediff-merge-files-with-ancestor \\\"$LOCAL\\\" \\\"$REMOTE\\\" \\\"$BASE\\\" nil \\\"$MERGED\\\")\"
@caldwell
caldwell / .gitconfig
Last active November 22, 2020 20:21
~/.gitconfig snippet for using Emacs ediff with git mergetool via emacsclient.
[merge]
tool = ediff
[mergetool "ediff"]
cmd = emacsclient -c -a \"\" --eval \"(ediff-merge-files-with-ancestor \\\"$LOCAL\\\" \\\"$REMOTE\\\" \\\"$BASE\\\" nil \\\"$MERGED\\\")\"
@caldwell
caldwell / emacs
Created February 25, 2013 00:44
I put this little script my PATH so that I can call emacs from the command line and have it launch Emacs.app and not the built in emacs.
#!/bin/sh
/Applications/Emacs.app/Contents/MacOS/Emacs "$@"
@caldwell
caldwell / ec
Last active June 24, 2018 19:46
I put this in my ~/bin and then `alias emacs='ec'`
#!/bin/sh
which osascript > /dev/null 2>&1 && osascript -e 'tell application "Emacs" to activate'
emacsclient -c "$@"
@caldwell
caldwell / osascript.pl
Created December 14, 2012 20:56
A simple function to call Applescript from Perl
sub osascript($) { system 'osascript', map { ('-e', $_) } split(/\n/, $_[0]); }
@caldwell
caldwell / osascript.rb
Created December 14, 2012 20:52
A simple function to call Applescript from Ruby.
def osascript(script)
system 'osascript', *script.split(/\n/).map { |line| ['-e', line] }.flatten
end