This file contains hidden or 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
#[macro_use] extern crate serde_derive; | |
extern crate rustc_serialize; | |
extern crate openssl; | |
extern crate dotenv; | |
extern crate serde; | |
extern crate serde_json; | |
use rustc_serialize::base64::{self, ToBase64}; | |
use std::path::Path; |
This file contains hidden or 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
{ stdenv, lib, fetchzip, zlib }: | |
# rustc and cargo nightly binaries | |
let | |
target = if stdenv.system == "i686-linux" | |
then "i686-unknown-linux-gnu" | |
else if stdenv.system == "x86_64-linux" | |
then "x86_64-unknown-linux-gnu" | |
else if stdenv.system == "i686-darwin" |
This file contains hidden or 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
{ stdenv, lib, fetchzip, zlib }: | |
# rustc and cargo nightly binaries | |
let | |
target = if stdenv.system == "i686-linux" | |
then "i686-unknown-linux-gnu" | |
else if stdenv.system == "x86_64-linux" | |
then "x86_64-unknown-linux-gnu" | |
else if stdenv.system == "i686-darwin" |
This file contains hidden or 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
{ mkDerivation, acid-state, aeson, base, base64-bytestring | |
, bytestring, conduit-extra, containers, diagrams | |
, diagrams-rasterific, directory, haskell-qrencode, heist | |
, JuicyPixels, lens, MonadCatchIO-transformers, mtl, Rasterific | |
, regex-tdfa, resourcet, safecopy, shell-conduit, snap, snap-core | |
, snap-loader-static, snap-server, snaplet-acid-state, snaplet-sass | |
, stdenv, text, time, uuid, xmlhtml | |
}: | |
mkDerivation { | |
pname = "packagename"; |
This file contains hidden or 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
{ pkgs ? (import <nixpkgs> {}), | |
haskellPackages ? (import <nixpkgs> { }).haskellPackages, | |
stdenv ? (import <nixpkgs> { }).stdenv }: | |
let | |
inherit (haskellPackages) | |
base bytestring heist lens MonadCatchIO-transformers mtl snap | |
snap-core snap-loader-static snap-server text time xmlhtml | |
snaplet-sass snaplet-acid-state acid-state safecopy uuid | |
containers aeson base64-bytestring directory Rasterific | |
JuicyPixels haskell-qrencode regex-tdfa shell-conduit |
This file contains hidden or 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
-- qrcMapD :: Dynamic t [ImageInfo] -> Dynamic t (Map Int ImageInfo) | |
addQRCodeMapD <- mapDyn numberList qrcListD | |
-- eventMapD :: Dynamic t (Map String (Event t String)) | |
rec eventMapD <- listWithKey updateMapD $ \k _ -> do | |
clickE <- bsButtonStatic "icon minus" "Delete" | |
return $ fmap (const k) clickE | |
-- eventListD :: Dynamic t [Event t String] | |
eventListD <- mapDyn Map.elems eventMapD |
This file contains hidden or 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 TemplateHaskell #-} | |
{-# LANGUAGE DeriveDataTypeable #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
module Scorch.Acid.Ticket | |
( | |
Tickets | |
, Ticket | |
, allTicketBatches | |
, insertKey |
This file contains hidden or 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
templateRenderImages cnvRef qrcInfoD imgInfo = do | |
qrcInfo <- sample $ current qrcInfoD | |
imgRef <- liftIO $ canvasDisplay cnvRef imgInfo | |
qrcRef <- liftIO $ canvasDisplay cnvRef qrcInfo | |
liftIO $ canvasAddChild cnvRef imgRef | |
liftIO $ imageAddChild imgRef qrcRef | |
templateRenderCanvas tf cnvRef = do | |
baseImgD <- mkImageInfo (fileInfo tf) defaultImageInfo |
This file contains hidden or 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
templateRenderImages cnvRef qrcInfoD imgInfo = do | |
qrcInfo <- sample $ current qrcInfoD | |
imgRef <- liftIO $ canvasDisplay cnvRef imgInfo | |
qrcRef <- liftIO $ canvasDisplay cnvRef qrcInfo | |
liftIO $ canvasAddChild cnvRef imgRef | |
liftIO $ imageAddChild imgRef qrcRef | |
templateRenderCanvas qrcInfoD baseImgD cnvRef = do | |
widgetHold (text "Creating base image ...") $ do |
This file contains hidden or 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
templateCanvas :: (MonadWidget t m) => TemplateForm t -> m () | |
templateCanvas tf = do | |
baseImgD <- mkImageInfo (fileInfo tf) defaultImageInfo | |
qrcImgD <- mkQRImageInfo (updated baseImgD) | |
display baseImgD | |
display qrcImgD | |
-- Only ever fire cnvInfo once | |
cnvInfoE <- onceE $ tag (constant defaultCanvasInfo) (updated baseImgD) |