Skip to content

Instantly share code, notes, and snippets.

View cmoore's full-sized avatar
🆑

Clint Moore cmoore

🆑
View GitHub Profile
@cmoore
cmoore / gist:784949
Created January 18, 2011 19:08
web-mongrel2 example
module Main where
import Web.Mongrel2
import Control.Monad (forever)
import Text.Groom (groom)
import Data.Default (def)
main :: IO ()
main = do
let b = def { m2_publish = "tcp://127.0.0.1:9996"
@cmoore
cmoore / oxymoron.css
Created October 26, 2010 06:23
oxymoron
body {
width: 960px;
margin-left: auto;
margin-right: auto;
}
.oxymoron {
display:table;
width: 100%;
border-collapse:collapse;
Copyright (c)2011, Clint Moore
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
{-
CouchDB 0.11.0:
[error] [<0.95.0>] attempted upload of invalid JSON undefined
[info] [<0.95.0>] 127.0.0.1 - - 'PUT' /honks/cmoore? 400
CouchDB Trunk as of 5/28 - 10:26 PST:
[info] [<0.95.0>] 127.0.0.1 - - 'PUT' /honks? 201
[debug] [<0.114.0>] 'PUT' /honks/cmoore? {1,1}
Headers: [{'Connection',"keep-alive"},
import Hack
import qualified Web.Encodings as Web
import Data.ByteString.Lazy.Char8 as BS
galleryDispatch ai@(\x -> head (pElements x) -> "u") =
case requestMethod (a_env ai) of
POST -> do
dbg "galleryDispatch: POST on /upload."
let env = a_env ai
case ((,) <$> lookup "Content-Type" (http env)
galleryDispatch ai@(\x -> head (pElements x) -> "u") =
case requestMethod (a_env ai) of
POST -> do
dbg "galleryDispatch: POST on /upload."
let env = a_env ai
case ((,) <$> lookup "Content-Type" (http env)
<*> lookup "Content-Length" (http env)) of
Nothing -> do
dbg "Ack!"
redirect' "/profile"
import Hack
import qualified Web.Encodings as Web
galleryDispatch ai@(\x -> head (pElements x) -> "u") =
case requestMethod (a_env ai) of
POST -> do
dbg "galleryDispatch: POST on /upload."
let env = a_env ai
case ((,) <$> lookup "Content-Type" (http env)
<*> lookup "Content-Length" (http env)) of
{- No, it's not live. Just testing. :) -}
{-# LANGUAGE ViewPatterns #-}
galleryDispatch ai@(\x -> head (pElements x) -> "u") =
case requestMethod (a_env ai) of
POST -> do
let env = a_env ai -- Hack's Env
case ((,) <$> lookup "Content-Type" (http env)
<*> lookup "Content-Length" (http env)) of
Nothing -> do
{- Types.hs -}
{-# LANGUAGE DeriveDataTypeable #-}
module Brazil.Types where
import Data.Typeable ()
import Data.Generics
import Text.StringTemplate.GenericStandard ()
for f in `cabal list | grep \* | cut -f 2 -d \ `; do cabal fetch $f; done