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 OverloadedStrings #-} | |
{-# LANGUAGE DeriveGeneric #-} | |
import System.Environment | |
import GHC.Generics | |
import Data.Aeson | |
import Data.Text (Text) | |
import Data.List (intersperse) |
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
data MyMaybe a = | |
MyNothing | |
| MyJust a | |
deriving (Show) | |
instance Functor MyMaybe where | |
fmap _ MyNothing = MyNothing | |
fmap f (MyJust a) = MyJust (f a) | |
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
data MyMaybe a = | |
MyNothing | |
| MyJust a | |
deriving (Show) | |
instance Functor MyMaybe where | |
fmap _ MyNothing = MyNothing | |
fmap f (MyJust a) = MyJust (f a) | |
instance Applicative MyMaybe |
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 OverloadedStrings, GeneralizedNewtypeDeriving #-} | |
module Text.Fractions where | |
import Control.Applicative | |
import Data.Ratio ((%)) | |
import Text.Trifecta | |
import Test.Hspec | |
badFraction = "1/0" | |
alsoBad = "10" | |
shouldWork = "1/2" |
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
Developer Certificate of Origin | |
Version 1.1 | |
Copyright (C) 2004, 2006 The Linux Foundation and its contributors. | |
1 Letterman Drive | |
Suite D4700 | |
San Francisco, CA, 94129 | |
Everyone is permitted to copy and distribute verbatim copies of this | |
license document, but changing it is not allowed. |
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
-- new library function for using a FileReader contains this function: | |
readAsText : FileRef -> Task Error String | |
-- new helper to render HTML input with type set to "file" and a built-in decoder for a getting a List of FileRefs out. | |
-- I think this will be less prone to abuse than exposing the decoder and letting the user create the input herself | |
fileInput : (List FileRef -> msg) -> List (Attribute msg) -> List (Html msg) -> Html msg | |
type Model | |
= Empty |
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
-- this is early brainstorm stage. Writing to arraybuffers is a mutation and we don't have those in Elm atm | |
-- aside from via Tasks/Cmds. Can we model mutations as something you build up and then "perform" all at once? | |
-- I'm not sure we could keep all of Elms guarantees (debugging, replay of actions, ...), but at least this API | |
-- would try to make the mutations happen in a single place? Or maybe performMutations will have to be a Cmd | |
-- even though it is all native JS code to satisfy the self imposed Elm constraints? | |
-- new library functions: | |
createArrayBuffer : Int -> ArrayBufferMutation | |
toFloat32Array : ArrayBufferMutation -> Float32ArrayMutation -- creates a typed float32 array | |
float32map : (Float -> Int -> Float) -> Float32ArrayMutation -> Float32ArrayMutation |
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
-- This is a naive brainstorm draft for a binary parser for an imaginary binary image format. | |
-- The image format is assumed to be: | |
-- Little endian | |
-- 4 bytes: magic identifier 0x23 0x23 0x23 0x23 | |
-- 2 bytes: width of image in pixels | |
-- 2 bytes: height of image in pixels | |
-- (width * height * 3) bytes: R G B values stored for each pixel (unsigned int) | |
import Binary.DataView.UInt8 exposing (uint8ViewLittleEndian, getBytes, getUInt16) |
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
// This script will insert images for all the inchis it finds | |
// in a google document | |
//How to use this scipt: | |
// Go to a google document where you want this script to work | |
// Choose from the Menu: Tools -> Script editor | |
// Delete everything in the editor that opens | |
// Paste in this entire script | |
// Save it and close the window | |
// |
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
java -jar swagger-codegen-cli.jar generate -l python-flask -i SWAGGER-YAML-FILE -o api | |
git add api | |
git commit ... | |
# this is just a convienience for the first time you change your api | |
git tag -a initial-api-scaffold -m "Initial swagger scaffold. Base point for future api changes" | |
# work on implementation, then: | |
git add, commit |