Skip to content

Instantly share code, notes, and snippets.

class Renderable a where
render :: a -> IO ()
newtype Rectangle = Rectangle { width :: Double, height :: Double }
instance Renderable Rectangle where
render = undefined
newtype Circle = Circle { radius :: Double }
@reinh
reinh / tmp.hs
Last active August 29, 2015 14:03
data Thing = Thing
{ _foo :: Int
, _bar :: String }
buildFoo :: Other -> Thing
buildfoo = Thing <$> buildFoo
<*> buildBar
where buildFoo :: Other -> Int
buildFoo = undefined
buildBar :: Other -> String
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
-- |
module Data.Torrent where
import Control.Applicative
import Control.Lens
import Data.AttoBencode
[1,2,3] [] []
[2,3] [1] []
[3] [1] [2]
[3] [] [1,2]
[] [3] [1,2]
[1] [3] [2]
[1] [2,3] []
[] [1,2,3] []
@reinh
reinh / solarized.css
Created July 15, 2014 22:32
Updated Solarized style that justifies nicks and messages
span.messageRow {
}
span.messageRow span.date {
}
span.messageRow span.message {
}
span.message span.authorWrap {
foo = bar
. bizz
. bazz
foo = bar
<> bizz
<> bazz
expr = term
// Convert to jQuery please...
var field = $('password_confirmation_field');
field.hide();
$('user_password').observe('focus', field.show.bind(field));
// This the best?
var confirmation = $('#password_confirmation_field').hide();
$('#user_password').focus(function () {
confirmation.show();
});
_______________
< PLAY [gitlab] >
---------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
{-# LANGUAGE OverloadedStrings #-}
module CommandParser where
import Data.Attoparsec.ByteString.Char8
import Data.Attoparsec.Combinator
import Control.Applicative
import Data.ByteString
data Command = Retrieve | Delete | New deriving Show
// Examples:
//
// HTML:
// <form action='messages/1/mark_unread'><input type='submit' class='button_to_link' value='Mark Unread'/></form>
//
// Rails:
// button_to "Mark as unread", mark_as_unread_message_path(message), :method => :put, :class => "button_to_link"
//
// jQuery:
// $(document).ready(function() {