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
import Text.VCard | |
vc = VCard "Frank Dawson" | |
(IndividualNames ["Dawson"] ["Frank"] [] [] []) | |
[ Organization ["Lotus Development Corporation"] | |
, Address [AddrWork, AddrPostal, AddrParcel] "" "" | |
"6544 Battleford Drive" | |
"Raleigh" "NC" "27613-3502" "U.S.A" | |
, Telephone [TelVoice, TelMessage, TelWork] "+1-919-676-9515" | |
, Telephone [TelFax, TelWork] "+1-919-676-9564" |
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
BEGIN:vCard | |
VERSION:3.0 | |
FN:Frank Dawson | |
N:Dawson;Frank;;; | |
ORG:Lotus Development Corporation | |
ADR;TYPE=WORK,POSTAL,PARCEL:;;6544 Battleford Drive;Raleigh;NC;27613-3502;U.S.A | |
TEL;TYPE=VOICE,MSG,WORK:+1-919-676-9515 | |
TEL;TYPE=FAX,WORK:+1-919-676-9564 | |
EMAIL;TYPE=INTERNET,PREF:[email protected] | |
EMAIL;TYPE=INTERNET:[email protected] |
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
<!--[if lt IE 7 ]><html class="ie ie6" lang="en"> <![endif]--> | |
<!--[if IE 7 ]><html class="ie ie7" lang="en"> <![endif]--> | |
<!--[if IE 8 ]><html class="ie ie8" lang="en"> <![endif]--> | |
<!--[if (gte IE 9)|!(IE)]><html lang="en"><![endif]--> |
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
{- These imports will serve us for the remainder of the post -} | |
import Text.Blaze.Internal | |
import Text.Blaze.Html5 | |
import Text.Blaze.Html5.Attributes | |
import qualified Data.ByteString.Char8 as C8 | |
import qualified Data.Text as T | |
-- | HTML tag with no closing. | |
html' :: Html -> Html | |
html' = Parent "html" "<html" "" |
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
-- | Comment combinator. `if` is included, so only condition is needed. E.g., | |
-- | |
-- > comment "lt IE 7" | |
comment :: String -> Html -> Html | |
comment cond = Parent "comment" (ss cond') "<![endif]-->" | |
where cond' = "<!--[if " ++ cond ++ " ]" | |
ss s = StaticString (s ++) (C8.pack s) (T.pack s) |
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
-- | Special set of conditionals for the HTML tag to make Skeleton compatible | |
-- with all browsers. | |
htmlTag :: Html | |
htmlTag = do | |
comment "lt IE 7" $ htmlEn ! class_ "ie ie6" | |
comment "IE 7" $ htmlEn ! class_ "ie ie7" | |
comment "IE 8" $ htmlEn ! class_ "ie ie8" | |
comment "(gte IE 9)|!(IE)" $ htmlEn | |
where htmlEn = html' ! lang "en" $ "" |
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
skeletonBase :: String -> String -> Html -> AttributeValue -> AttributeValue | |
-> Html -> Html | |
skeletonBase cssDir iconDir title desc author content = do | |
docType | |
htmlTag | |
htmlBody $ 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
import Control.Monad ( liftM ) | |
import Web.JonathansCard ( latest ) | |
main :: IO () | |
main = putStrLn . show =<< latest | |
{- Outputs: | |
Right (Balance {balAmount = 28.08, balBalanceId = 25573, balCreated = Just | |
2011-08-08 00:56:03 UTC, balMessage = "My balance is $28.08 as of Aug 7th at |
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
<?php | |
require 'path-to-Stripe.php'; | |
if ($_POST) { | |
Stripe::setApiKey("YOUR-API-KEY"); | |
$error = ''; | |
$success = ''; | |
try { | |
if (!isset($_POST['stripeToken'])) | |
throw new Exception("The Stripe Token was not generated correctly"); |
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
<?php | |
require 'path-to-Stripe.php'; | |
if ($_POST) { | |
Stripe::setApiKey("YOUR-API-KEY"); | |
$error = ''; | |
$success = ''; | |
try { | |
if (!isset($_POST['stripeToken'])) | |
throw new Exception("The Stripe Token was not generated correctly"); |