Skip to content

Instantly share code, notes, and snippets.

@oxbowlakes
oxbowlakes / 3nightclubs.scala
Created May 13, 2011 15:14
A Tale of 3 Nightclubs
/**
* Part Zero : 10:15 Saturday Night
*
* (In which we will see how to let the type system help you handle failure)...
*
* First let's define a domain. (All the following requires scala 2.9.x and scalaz 6.0)
*/
import scalaz._
import Scalaz._
@simonmichael
simonmichael / gist:1185421
Created September 1, 2011 03:59
ghc-pkg-clean, ghc-pkg-reset
# unregister broken GHC packages. Run this a few times to resolve dependency rot in installed packages.
# ghc-pkg-clean -f cabal/dev/packages*.conf also works.
function ghc-pkg-clean() {
for p in `ghc-pkg check $* 2>&1 | grep problems | awk '{print $6}' | sed -e 's/:$//'`
do
echo unregistering $p; ghc-pkg $* unregister $p
done
}
# remove all installed GHC/cabal packages, leaving ~/.cabal binaries and docs in place.
@hodzanassredin
hodzanassredin / Prolog.hs
Created December 1, 2011 10:59
simple type level predicates in haskell
{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances, UndecidableInstances #-}
module Prolog (Petja, Vasja, Serg, Father) where
data Petja = Petja
data Vasja = Vasja
data Serg = Serg
class Father a b where
isFather :: a -> b -> ()
isFather x y = ()
@cartazio
cartazio / gist:1655271
Created January 22, 2012 03:16
simple directions to install gtk haskell libs on OS X lion so that Everything works
NOTE: on lion (and snow leopard i suppose), make sure you are using a 64 bit install of ghc. Also, unless you are suggesting an edit to these directions, please go ask people on the relevant mailing list or wiki for help :)
NOTE: gtk2hs 0.12.2 won't build with ghc 7.4.1, but the current darcs repo for gtk2hs does build
NOTE: on 7.4 there seems to be a problem when in ghci and drawing to a window, but not when rendering to pdf. I don't know why this is, but if you do, let me know. I'll update this as i have more info
note that these directions probably can use some cleanup, but i'm choosing these steps so that rebuilding any haskell library doesn't require remembering ANYTHING :-)
(tested on ghc 7.2.2, assumes you have standard developer things installed on mac, like x11 and stuff)
1) cabal install gtk2hs-buildtools #(this should work with any haskell platform install)
2) brew install cairo gtk gettext fontconfig
@renz45
renz45 / An_example.markdown
Last active December 4, 2016 21:01
Re-style Sublime Text 2 sidebar to a darker theme

This re-styles your sublime text 2 sidebar to be darker, so it doesn't blind you when using a dark theme.

Dark sublime text 2 sidebar

Save the Default.sublime-theme file into packages/user

@Swind
Swind / unzip.scala
Last active April 22, 2018 08:09
[Unzip in Scala] #Scala #zip
import java.util.zip.ZipFile
import java.io.FileInputStream
import java.io.FileOutputStream
import scala.collection.JavaConversions._
import java.util.zip.ZipEntry
import java.io.InputStream
import java.io.OutputStream
import java.io.File
class ZipArchive {
@alloy-d
alloy-d / Default.sublime-keymap
Created June 11, 2012 16:36
Sublime Text 2 Vintage mode keybindings for Colemak based on my Colemak setup for vim
[
{ "keys": ["escape"], "command": "exit_insert_mode",
"context":
[
{ "key": "setting.command_mode", "operand": false },
{ "key": "setting.is_widget", "operand": false }
]
},
{ "keys": ["escape"], "command": "exit_visual_mode",
@adzenith
adzenith / Default (OSX).sublime-mousemap
Created June 23, 2012 19:28
Sublime Text 2 better mouse handling
[
// Basic drag select
{
"button": "button1", "count": 1,
"press_command": "drag_select_callback"
},
{
// Select between selection and click location
"button": "button1", "modifiers": ["shift"],
"press_command": "drag_select_callback",
@fnurl
fnurl / .latexmkrc
Created July 15, 2012 18:14
my .latexmkrc that I use with MacTex
# Use xelatex instead of pdflatex
$pdflatex = 'xelatex -synctex=1 -interaction=nonstopmode --shell-escape %O %S';
# Always create PDFs
$pdf_mode = 1;
# Use Skim.app to preview generated PDFs
$pdf_previewer = 'open -a Skim.app %S';
# Use continous mode by default