This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data Protocol | |
= Hybi00 | |
| Hybi01 | |
sendMessage :: Protocol -> Message -> IO () | |
sendMessage HybiOO (Text text) = putStrLn $ "[Hybi00] " ++ text | |
sendMessage HybiOO (Binary _) = error "LOL" | |
sendMessage Hybi01 (Text text) = .. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require "net/http" | |
require "uri" | |
require "json" | |
require "base64" | |
class Imgur | |
API_KEY = "15a6efd29935f62ea87579a8325d945a" | |
NewerOlder