Skip to content

Instantly share code, notes, and snippets.

@deckool
deckool / kutaisi.md
Last active June 19, 2018 08:27
Georgia 2018
@deckool
deckool / Json.hs
Created May 5, 2018 08:15 — forked from soupi/Json.hs
A simple JSON EDSL
{- | An EDSL for defining and printing JSON values
-}
import Data.List (intercalate)
----------------
-- JSON Model --
----------------
-- | The JSONValue data type represents a JSON Value
@deckool
deckool / gist:a914c7e600d37d4fa7ee67df78374fe8
Created May 6, 2017 12:14 — forked from disnet/gist:4973724
sed - convert literate haskell to plain haskell
sed '
s/^>//
t
s/^ *$//
t
s/^/-- /
' in.lhs > out.hs
@deckool
deckool / articlePage.hs
Created July 28, 2016 14:19
article page RDFa ready parsed for blaze-html
{-# LANGUAGE OverloadedStrings #-}
import Prelude
import qualified Prelude as P
import Data.Monoid (mempty)
import Text.Blaze.Html5
import qualified Text.Blaze.Html5 as H
import Text.Blaze.Html5.Attributes
import qualified Text.Blaze.Html5.Attributes as A
@deckool
deckool / itemPage.hs
Created July 28, 2016 13:01
haskell with rich blaze-html parsing for RDF
{-# LANGUAGE OverloadedStrings #-}
import Prelude
import qualified Prelude as P
import Data.Monoid (mempty)
import Text.Blaze.Html5
import qualified Text.Blaze.Html5 as H
import Text.Blaze.Html5.Attributes
import qualified Text.Blaze.Html5.Attributes as A
@deckool
deckool / fullRDFa_artticle.html
Created July 28, 2016 09:08
full and tested rdfa article
<body vocab="http://schema.org/">
...
<div property="breadcrumb">
<a href="http://www.ibm.com/developerworks/">IBM developerWorks</a> >
<a href="http://www.ibm.com/developerworks/web/">Web development</a> >
<a href="http://www.ibm.com/developerworks/views/web/library.jsp"
>Technical library</a>
</div>
<div typeof="Article">
<div property="image" typeof="ImageObject">
@deckool
deckool / testArticle.html
Created July 27, 2016 14:33
rdfa example article from IBM
<body vocab="http://schema.org/">
...
<div property="breadcrumb">
<a href="http://www.ibm.com/developerworks/">IBM developerWorks</a> >
<a href="http://www.ibm.com/developerworks/web/">Web development</a> >
<a href="http://www.ibm.com/developerworks/views/web/library.jsp"
>Technical library</a>
</div>
<div typeof="Article">
@deckool
deckool / snapTest.hs
Created July 4, 2016 14:18
small starter for maybe eventsource on snap framework
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Control.Applicative
import Snap.Core
import Snap.Util.FileServe
import Snap.Http.Server
import Control.Monad.IO.Class
import qualified Data.ByteString.Char8 as BS
@deckool
deckool / node-and-npm-in-30-seconds.sh
Created February 27, 2016 16:01 — forked from isaacs/node-and-npm-in-30-seconds.sh
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
xxx :: Snap ()
xxx = do
req <- getRequest
let a = getHeader "user-agent" req
told <- maybe pass return a
let b = C.pack "Mobile|iP(hone|od|ad)|Android|BlackBerry|IEMobile|Kindle|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|Minimo|Opera M(obi|ini)|Blazer|Dolfin|Dolphin|Skyfire|Zune"
let ii = told =~ b :: Bool
case ii of
True -> writeBS "adevarat"
False -> writeBS "fals"