Skip to content

Instantly share code, notes, and snippets.

@qoelet
Created August 14, 2013 17:19
Show Gist options
  • Save qoelet/6233242 to your computer and use it in GitHub Desktop.
Save qoelet/6233242 to your computer and use it in GitHub Desktop.
{-# LANGUAGE OverloadedStrings #-}
import Prelude
import qualified Prelude as P
import Data.Monoid (mempty)
import Web.Scotty
import qualified Web.Scotty as S
import Text.Blaze.Html5
import qualified Text.Blaze.Html5 as H
import Text.Blaze.Html5.Attributes
import qualified Text.Blaze.Html5.Attributes as A
-- required to render blaze
import Text.Blaze.Html.Renderer.Text
-- required for static serving, but doesn't work? (.cabal/.../scotty/) doesn't have Network module,
-- haskell looks up wai-extras but doesn't find it and throws an error.
-- the Network/Static module does appear in Scotty's Github repo though?
-- Quick fix: single route -> file approach (helps that I only have 1 image and 2 css files to deal with)
-- import Network.Wai.Middleware.Static
template :: Html
template = do
-- boilerplate: 4.2.0
docType
-- [if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]
-- [if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]
-- [if IE 8]> <html class="no-js lt-ie9"> <![endif]
-- [if gt IE 8]><!
H.html ! class_ "no-js" $ do
-- <![endif]
H.head $ do
meta ! charset "utf-8"
meta ! httpEquiv "X-UA-Compatible" ! content "IE=edge,chrome=1"
H.title "northpole.sg : kenny shen"
meta ! name "description" ! content "digital home of kenny shen, a django and python web developer / programmer based in singapore."
meta ! name "viewport" ! content "width=device-width"
link ! rel "stylesheet" ! href "css/normalize.css"
link ! rel "stylesheet" ! href "css/main.css"
H.body $ do
-- [if lt IE 7]>
-- <p class="chromeframe">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to improve your experience.</p>
-- <![endif]
-- Add your site or application content here
h1 $ img ! src "/images/shishi.jpg"
p "Kenny Shen, Singapore."
p $ em "\"Simplicity is prerequisite for reliability.\" - Edsger W.Dijkstra"
hr
p "Current adventure - Head of Marketing Systems & Developement @ Zalora Singapore"
p "Past adventures include (developer, engineer, lead tech) at TUS, JamiQ, Tripvillas, Fairfax Business Media."
p $ do
"Skills largely revolve around "
a ! href "http://www.python.org" $ "Python"
" and its ecosystem. Now expanding to include Haskell."
p $ do
"Github: "
a ! href "https://github.com/qoelet/" $ "@qoelet"
p $ do
"Random tech notes: "
a ! href "http://manwithhiskeyboard.tumblr.com/" $ H.span ! A.style "font-style: italic;" $ "A man and his keyboard."
hr
p "Also a handyman, avid bookworm, cyclist, crafter and guitarist."
p $ do
"Workshop diaries: "
a ! href "http://manwithhishands.tumblr.com/" $ H.span ! A.style "font-style: italic;" $ "A man and his hands."
hr
p "Email: kenny [@] northpole [dot] sg"
script "var _gaq=[['_setAccount','UA-7105486-8'],['_trackPageview']];\n (function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];\n g.src='//www.google-analytics.com/ga.js';\n s.parentNode.insertBefore(g,s)}(document,'script'));"
p $ do
"Powered by "
a ! href "https://github.com/jaspervdj/blaze-html" $ "BlazeHtml"
" and "
a ! href "https://github.com/xich/scotty" $ "Scotty"
". Warp FTW!"
main = do
scotty 3000 $ do
-- middleware $ staticPolicy (noDots >-> addBase "static")
get "/" $ do
S.html . renderHtml $ do
template
get "/images/shishi.jpg" $ file "static/images/shishi.jpg"
get "/css/normalize.css" $ file "static/css/normalize.css"
get "/css/main.css" $ file "static/css/main.css"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment