Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@mxswd
mxswd / Main.hs
Last active August 29, 2015 13:57
{-# LANGUAGE DataKinds, TemplateHaskell, TypeFamilies, QuasiQuotes #-}
import TICTACTOE
game :: ([tq| x o x
o o x
☐ ☐ x |])
game = (?)
anonymous
anonymous / gist:4269023
Created December 12, 2012 16:07
François Villon
I know when milk does flies contain;
I know men by their bravery;
I know fair days from storm and rain;
And what fruit apple-trees supply;
And from their gums the trees descry;
I know when all things smoothly flow;
I know who toil or idly lie;
All things except myself I know.
@MasseR
MasseR / endotemplates.hs
Created February 10, 2013 12:53
Using endo monoid, writer monad and blaze html combinators for creating a web page
{-# Language GeneralizedNewtypeDeriving #-}
{-# Language OverloadedStrings #-}
import Data.Monoid
import Text.Blaze.Html.Renderer.Text
import qualified Text.Blaze.Html5 as H
import qualified Text.Blaze.Html5.Attributes as A
import Text.Blaze.Html ((!), Html)
import Control.Monad.Writer
import Control.Monad.Identity
@kolen
kolen / gnit.geojson
Created August 8, 2013 09:25
Кладбища Йошкар-Олы
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@simonmichael
simonmichael / gist:8390623
Created January 12, 2014 21:07
some aliases for ~/.gitconfig
[alias]
l = log -10 --pretty=tformat:'%C(yellow)%ad %Cred%h%C(bold blue)%d%Creset %s' --date=short
l2 = log -10 --pretty=tformat:'%C(yellow)%ad %Cred%h%C(bold blue)%d%Creset %s %Cgreen(%an)%Creset' --date=short
l3 = log -10 --pretty=tformat:'%Cred%h%C(bold blue)%d%Creset %s %C(yellow)%cr %Cgreen%an%Creset' --date=relative
l4 = log -10 --pretty=tformat:'%Cred%h %C(yellow)%ad %Cgreen%an%C(bold blue)%d %Creset%s' --date=short
lg = log -10 --graph --pretty=tformat:'%C(yellow)%ad %Cred%h%C(bold blue)%d%Creset %s' --date=short
lg2 = log -10 --graph --pretty=tformat:'%C(yellow)%ad %Cred%h%C(bold blue)%d%Creset %s %Cgreen(%an)%Creset' --date=short
lg3 = log -10 --graph --pretty=tformat:'%Cred%h%C(bold blue)%d%Creset %s %C(yellow)%cr %Cgreen%an%Creset' --date=relative
lg4 = log -10 --graph --pretty=tformat:'%Cred%h %C(yellow)%ad %Cgreen%an%C(bold blue)%d %Creset%s' --date=short
s = status -sb
@hdgarrood
hdgarrood / cookies.hs
Last active February 9, 2018 16:07
Scotty cookies example
{-# LANGUAGE OverloadedStrings #-}
import Control.Monad (forM_)
import Data.Text.Lazy (Text)
import qualified Data.Text.Lazy as T
import qualified Data.Text.Lazy.Encoding as T
import qualified Data.ByteString as BS
import qualified Data.ByteString.Lazy as BSL
import qualified Blaze.ByteString.Builder as B
@cartazio
cartazio / xcode5-haskell-directions.md
Last active May 28, 2019 00:35
xcode 5 + OS X 10.9 mavericks GHC work around nuttiness

PSA :

just use GHC for OSX https://ghcformacosx.github.io

the rest of these directions are preserved for historical purposes

TLDR version, if you have homebrew

xcode-select --install ; brew tap homebrew/versions ;   brew tap homebrew/dupes \
@singpolyma
singpolyma / Cache.hs
Created July 18, 2013 14:34
Simple in-process key/value cache for Haskell
-- | Simple in-process key/value cache
--
-- Of course, for really simple stuff you could probably use unsafeInterleaveIO
module Cache (Cache, newCache, fromCache) where
import Control.Monad (void)
-- Could also use STM instead
import Control.Concurrent (forkIO, Chan, newChan, readChan, writeChan, MVar, newEmptyMVar, putMVar, takeMVar)
@michaelt
michaelt / RedBlackTree.hs
Created May 11, 2012 15:01 — forked from rampion/RedBlackTree.hs
red-black trees in haskell, using GADTs and Zippers (and DataKinds)
{-# LANGUAGE GADTs #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE DataKinds#-}
{-# LANGUAGE KindSignatures#-}
module RedBlackTree where
data Nat = Zero | Succ Nat deriving (Eq, Ord, Show)
type One = Succ Zero
@tonyg
tonyg / README.md
Created January 16, 2013 17:09
Racket custodians and namespaces for rebootable racket programs

Demonstrates the use of Racket's custodians and namespaces to create enough isolation to "reboot" programs without restarting the whole of Racket, including possibly recompiling and reloading code.

To experiment with this:

$ racket ~/src/racket-experiments$ racket
Welcome to Racket v5.3.1.4.
-> (require "reloader.rkt")
-> (load-and-foo)
Starting worker...

test-mod: "foo"