Skip to content

Instantly share code, notes, and snippets.

@mightybyte
mightybyte / gist:3f7dfd8b20b45bdc9dd9
Last active August 29, 2015 14:02
TODO list for snap and heist 1.0
  • Move Heist.SpliceAPI to map-syntax (https://github.com/mightybyte/map-syntax)

  • Add namespace support to heist

    This means that users will be able to specify a namespace under which Heist will operate. If the user specifies a namespace of "h", then the splice '"foo" ## fooSplice' will match the tag <h:foo>. This alone doesn't give us much benefit. But on top of that we will add checking so Heist will throw an error if it encounters any <h:...> tag that does not have a splice bound for it. This will be a big help in finding bugs caused by not having a splice bound.

@mightybyte
mightybyte / gist:2472faa614fde892afae
Last active August 29, 2015 14:17
diagrams metafont problem
-- image: http://i.imgur.com/567RLZ2.png
squiggle :: Path V2 Double
squiggle = rotate ((-1)/4 @@ turn) $ metafont $
(4 ^& 1) .--.
(10 ^& 4) .--.
(15 ^& 5.2) .--.
(20 ^& 5) .--.
(25 ^& 3) .--.
(30 ^& 1.5) .--.

Keybase proof

I hereby claim:

  • I am mightybyte on github.
  • I am mightybyte (https://keybase.io/mightybyte) on keybase.
  • I have a public key whose fingerprint is E354 4097 9E03 BC59 CC6F 444A 0272 6879 EA3E 9B28

To claim this, I am signing this object:

@mightybyte
mightybyte / gist:753e2d5dea800b2eb0cc
Last active August 29, 2015 14:27
gen-bounds output
$ dist/build/cabal/cabal gen-bounds
Resolving dependencies...
The following packages need bounds and here is a suggested starting point.
You can copy and paste this into the build-depends section in your .cabal
file and it should work (with the appropriate removal of commas).
Note that version bounds are a statement that you've successfully built and
tested your package and expect it to work with any of the specified package
versions (PROVIDED that those packages continue to conform with the PVP).
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE NoMonomorphismRestriction #-}
-- | This module contains convenience functions for helping render
-- Heist templates from Snap.
module Snap.Heist where
------------------------------------------------------------------------------
import Control.Applicative
{-# LANGUAGE OverloadedStrings #-}
module Splices.MongoDB where
import Prelude
import qualified Prelude as P
import Control.Monad
import Control.Monad.Trans
import Data.Maybe (fromJust)
@mightybyte
mightybyte / local.js
Created January 3, 2011 06:34
Javascript for digestive-functors massInput
inputHidden = flip inputRead "Error reading hidden" $ \id' inp ->
createFormHtml $ \cfg -> applyClasses' [htmlInputClasses] cfg $
H.input ! A.type_ "hidden"
! A.name (H.stringValue $ show id')
! A.id (H.stringValue $ show id')
! A.value (H.stringValue $ fromMaybe "" inp)
massInputHtml s d = mapView (fmap addControls) $ massInput inputHidden s d
where
addControls form = do
@mightybyte
mightybyte / MassInputDemo.hs
Created January 4, 2011 03:15
Full massInput example
-- This code uses the convenience code I added to digestive-functors-blaze.
-- http://bit.ly/hjGRXl
{-# LANGUAGE OverloadedStrings, TypeSynonymInstances,
NoMonomorphismRestriction #-}
import Control.Applicative
import Data.String
import Snap.Types
import Snap.Http.Server (httpServe, defaultConfig)
@mightybyte
mightybyte / Instances.hs
Created January 5, 2011 00:30
Working on HasFormlet type class
{-# LANGUAGE TypeSynonymInstances #-}
module Text.Digestive.Blaze.Instances where
import Data.Maybe
import Text.Digestive.Blaze.Html5 (inputText, inputCheckBox, inputTextRead)
import Text.Digestive.Forms (FormInput)
import Text.Digestive.Types (Form)
class HasFormlet a where
formlet :: (Monad m, Functor m, FormInput i f) => e -> Maybe a -> Form m i e v a
@mightybyte
mightybyte / passdepth.patch
Created January 19, 2011 14:32
Passes a depth to addItem
diff --git a/digestive-functors-blaze/src/Text/Digestive/Blaze/Html5.hs b/digestive-functors-blaze/src/Text/Digestive/Blaze/Html5.hs
index 88b5510..4d647af 100644
--- a/digestive-functors-blaze/src/Text/Digestive/Blaze/Html5.hs
+++ b/digestive-functors-blaze/src/Text/Digestive/Blaze/Html5.hs
@@ -41,6 +41,7 @@ import Text.Digestive.Forms (FormInput (..))
import qualified Text.Digestive.Forms as Forms
import qualified Text.Digestive.Common as Common
import Text.Digestive.Forms.Html
+import Text.Digestive.Result
import Text.Digestive.Transform