Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

init

  • Loading branch information...
commit a31176da8e8bf577e111f7e427ce3b1aef34758e 0 parents
Jinjing Wang authored
23 .gitignore
@@ -0,0 +1,23 @@
+*.swp
+*.swo
+*.o
+*.hi
+.searchpath.default.map
+*.pid
+*.fcgi
+
+*.exe
+
+*.log
+
+/public
+/db
+
+/_darcs
+/dist
+
+manifest
+hello
+Main
+
+.nemesis
31 LICENSE
@@ -0,0 +1,31 @@
+Copyright (c) 2009, Jinjing Wang
+
+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.
+
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+ * Neither the name of Jinjing Wang nor the names of other
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 Nemesis
@@ -0,0 +1,30 @@
+nemesis = do
+
+ clean
+ [ "**/*.hi"
+ , "**/*.o"
+ , "manifest"
+ , "main"
+ , "nemesis-tmp.*"
+ ]
+
+
+ desc "prepare cabal dist"
+ task "dist" $ do
+ sh "cabal clean"
+ sh "cabal configure"
+ sh "cabal sdist"
+
+
+ desc "put all .hs files in manifest"
+ task "manifest" $ do
+ sh "find . | grep 'hs$' > manifest"
+
+
+ desc "start console"
+ task "i" (sh "ghci -isrc src/Codec/SnowWhite.hs")
+
+ desc "show sloc"
+ task "stat" $ do
+ sh "cloc -match-f=hs$ --quiet src --no3"
+
4 Setup.lhs
@@ -0,0 +1,4 @@
+#! /usr/bin/env runhaskell
+
+> import Distribution.Simple
+> main = defaultMain
135 changelog.md
@@ -0,0 +1,135 @@
+2009.10.30
+----------
+
+### Feature
+
+* add remoteHost field
+
+2009.7.15
+---------
+
+### Feature
+
+* new hackCache header using strict bytestrings
+
+2009.5.19
+---------
+
+### Feature
+
+* Use lazy bytestring for performance and hinting utf-8 encoding
+* remove some unused fields
+* use haskell naming convention
+
+2009.4.52
+---------
+
+### Feature
+
+* Remove useless type alias
+
+### Fix
+
+* Default error stream should take utf8 string
+
+
+2009.4.51
+---------
+
+### Feature
+
+* add documentation
+
+2009.4.50
+---------
+
+### Feature
+
+* add version info in default
+
+2009.4.30
+----------
+
+### Feature
+
+* seperate handler from core module
+* seperate contrib from Hack.hs
+* now Hack.hs is only an interface file, where everything links to. This allows me to soft link handler in Hack.Contrib and Hack.Handler in development mode :)
+
+2009.4.29
+-----------
+
+### Fix
+
+* -Wall clean
+
+
+2009.4.28
+-----------
+
+### Fix
+
+* File return status code 200 on success
+
+2009.4.27
+---------
+
+### Fix
+
+* hyena handler show real message ( Safari won't work without this fix )
+
+2009.4.26
+---------
+
+### Fix
+
+* add hyena handler
+
+2009.4.25
+---------
+
+### Featuer
+
+* more middleware
+* hyena handler for simple use server
+
+2009.4.23
+---------
+
+### Feature
+
+* more middleware
+ * ContentSize
+ * SimpleAccessLogger
+
+* request helper
+
+2009.4.22
+---------
+
+### Feature
+
+* more middleware
+ * ContentType
+ * RawRouter
+ * SimpleRouter
+
+2009.4.21
+------------
+
+### Feature
+
+* demo SimpleRoute middleware
+
+### Fix
+
+* env for kibro adapter
+* homepage in hack.cabal
+
+2009.4.20
+-----------
+
+### Feature
+
+* raw specification
+* shiny kibro hack handler
1  hello.txt
@@ -0,0 +1 @@
+
0  known-issues.md
No changes.
12 readme.md
@@ -0,0 +1,12 @@
+Snow White
+==========
+
+encode any binary instance to white space
+
+example
+
+ SnowWhite.pack "hello"
+ >
+
+ SnowWhite.unpack " "
+ > hello
31 snow-white.cabal
@@ -0,0 +1,31 @@
+Name: snow-white
+Version: 2009.12.1
+Build-type: Simple
+Synopsis: encode any binary instance to white space
+Description:
+
+
+-- @
+-- SnowWhite.pack "hello"
+-- >
+--
+-- SnowWhite.unpack " "
+-- > hello
+-- @
+
+License: BSD3
+License-file: LICENSE
+Author: Wang, Jinjing
+Maintainer: Wang, Jinjing <nfjinjing@gmail.com>
+Build-Depends: base
+Cabal-version: >= 1.2
+category: Web
+homepage: http://github.com/nfjinjing/snow-white/tree/master
+data-files: readme.md, changelog.md
+
+library
+ ghc-options: -Wall
+ build-depends: base >= 4 && < 5, mps, bytestring, binary
+ hs-source-dirs: src/
+ exposed-modules:
+ Codec.SnowWhite
33 src/Codec/SnowWhite.hs
@@ -0,0 +1,33 @@
+module Codec.SnowWhite (pack, unpack) where
+
+import Data.Binary
+import Numeric
+import MPS.Env hiding (encode, decode)
+import Prelude ()
+import qualified Data.ByteString.Lazy.Char8 as B
+import Data.Char
+
+c2w, w2c :: Char -> Char
+c2w '0' = ' '
+c2w '1' = '\t'
+c2w _ = error "not 0 or 1"
+
+w2c ' ' = '0'
+w2c '\t' = '1'
+w2c _ = error "not 0 or 1"
+
+b2s, pack :: (Binary a) => a -> String
+b2s = encode > B.unpack > map (ord > (base 2) > rjust 8 '0' > map c2w) > concat
+
+base :: Int -> Int -> String
+base p n = showIntAtBase p intToDigit n ""
+
+from_base :: Int -> String -> Int
+from_base p = readInt p (const True) digitToInt > first > fst
+
+s2b, unpack :: (Binary a) => String -> a
+s2b = select (belongs_to " \t") > in_group_of 8 > map (map w2c > from_base 2 > chr) > B.pack > decode
+
+
+pack = b2s
+unpack = s2b
0  src/Main.hs
No changes.
Please sign in to comment.
Something went wrong with that request. Please try again.