Skip to content

Instantly share code, notes, and snippets.

View nudded's full-sized avatar

Toon Willems nudded

View GitHub Profile
{-# LANGUAGE GADTs, FlexibleInstances, MultiParamTypeClasses #-}
import Control.Monad.State.Class
import Control.Monad.Trans.Class
data StateD s m a where
Get :: StateD s m s
Put :: s -> StateD s m ()
Return :: a -> StateD s m a
Bind :: StateD s m a -> (a -> StateD s m b) -> StateD s m b
Lift :: m a -> StateD s m a
@nudded
nudded / gist:2864553
Created June 3, 2012 18:40
W3C validator for css and html
require 'rest_client'
require 'nori'
Nori.configure do |config|
config.strip_namespaces = true
config.convert_tags_to { |tag| tag.snakecase.to_sym }
end
module W3C
data Protocol
= Hybi00
| Hybi01
sendMessage :: Protocol -> Message -> IO ()
sendMessage HybiOO (Text text) = putStrLn $ "[Hybi00] " ++ text
sendMessage HybiOO (Binary _) = error "LOL"
sendMessage Hybi01 (Text text) = ..
def raise_error(error_name, superclass = Exception)
raise self.class.const_get error_name
rescue NameError
self.class.const_set error_name, Class.new(superclass)
retry
end
#!/usr/bin/env ruby
require "net/http"
require "uri"
require "json"
require "base64"
class Imgur
API_KEY = "15a6efd29935f62ea87579a8325d945a"