This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings #-} | |
module Splices.MongoDB where | |
import Prelude | |
import qualified Prelude as P | |
import Control.Monad | |
import Control.Monad.Trans | |
import Data.Maybe (fromJust) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FLASK: | |
#!/usr/bin/env python | |
# A github post-receive hook handler, runs some shell command on each HTTP POST to PORT. | |
# github-listener.py PORT 'SOME SHELL COMMAND' | |
import sys | |
from subprocess import * | |
from flask import Flask |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
------------------------------------------------------------------------------ | |
-- | Renders the child nodes only if the request comes from an authenticated | |
-- user. | |
ifLoggedIn :: Splice Application | |
ifLoggedIn = do | |
node <- getParamNode | |
res <- lift $ requireUser (return []) (return $ childNodes node) | |
return res | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
------------------------------------------------------------------------------ | |
-- | Runs the parameter node's children and returns the resulting node list. | |
-- By itself this function is a simple passthrough splice that makes the | |
-- spliced node disappear. In combination with locally bound splices, this | |
-- function makes it easier to pass the desired view into your splices. | |
runChildren :: Monad m => Splice m | |
runChildren = runNodeList . X.childNodes =<< getParamNode | |
------------------------------------------------------------------------------ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
struct node { | |
char c; | |
node * left; | |
node * right; | |
}; | |
OlderNewer