brool

brool \brool\ (n.) : a low roar; a deep murmur or humming

Archive for April, 2009

Recovering From A –hard Reset In Git

Saturday, April 18th, 2009
I was switching between git repositories the other day, and managed to do a “git reset –hard HEAD^” in the wrong repository. Which wasn’t bad, since I had most of the files already open in Emacs… but then Emacs calmly told me that it was re-reading the files from disk. But, git had everything still [...]

Stupid Haskell Tricks

Monday, April 13th, 2009
Let’s say that you really, really want some notion of objected oriented programming. So let’s make a class that represents a name, and some simple method calls on it: [code lang="haskell"] data S = S { name :: String } deriving (Show) firstname s = (words (name s))!!0 lastname s = (words (name s))!!1 [/code] [...]

Haskell To WordPress (Snippet)

Friday, April 10th, 2009
A small snippet of code that demonstrates calling into a WordPress XML-RPC server with Haskell and HaxR. [code lang="haskell"] import qualified Data.Map as Map import Data.Maybe import Network.XmlRpc.Client import Network.XmlRpc.Internals server = "http://yourserver.wordpress.com/xmlrpc.php" -- extract multiple posts from the XML response extract :: Value -> [Map String Value] extract xmlresp = let ValueArray rs = [...]