Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Haskell test

View gist:1400123
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
module Main where
 
import Text.HTML.SanitizeXSS
import System.IO
import Data.Text (pack, unpack)
 
import Data.Binary.Get
import Data.Binary.Put
import Data.Binary
import Data.Word
import qualified Data.ByteString.Lazy as B
import qualified Data.ByteString.Lazy.UTF8 as BU
import Control.Monad
 
main = do
i <- B.hGet stdin 4
let len = runGet getWord32be i
content <- B.hGet stdin (fromIntegral len)
let sanitized = BU.fromString . unpack . sanitizeBalance . pack $ BU.toString content
let result = runPut $ putWord32be (fromIntegral $ B.length sanitized)
B.hPut stdout result
B.hPut stdout sanitized
hClose stdin
hClose stdout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.