Skip to content

Instantly share code, notes, and snippets.

@manuscrypt
manuscrypt / Tests.elm
Created May 28, 2016 18:31
Testing a Tweet decode
module Tests exposing (..)
import Tweet exposing (..)
import Random exposing (Generator)
import Json.Encode as Encode
import Shrink
import Check exposing (..)
import Check.Test
import Check.Producer exposing (..)
module Tests exposing (..)
import Tweet exposing (..)
import Html exposing (..)
import Json.Encode as Encode
import Random exposing (Generator)
import Shrink
import Check exposing (..)
import Check.Test
@manuscrypt
manuscrypt / Task Basics
Created June 4, 2016 22:46
Shows how to perform a Task when the Success-Handler does not need any payload (empty tuple -> unit)
-- Check out: http://elm-community.github.io/elm-faq/#what-does--mean-1
module Main exposing (..)
import Html exposing (..)
import Html.App as App exposing (..)
import Task exposing (..)
type alias Model =
type alias Cell a =
{ pos: Vec2
, content: VirtualDom.Node a
}
type Cols a
= Cols (List (Cell a)) (Cell a) (List (Cell a))
type Rows a
onKeyUp : Json.Decoder Msg
onKeyUp =
Json.oneOf
[ logged "keyDecoder" keyDecoder
-- , charCodeDecoder -- only on keypress
, logged "keyCodeDecoder" keyCodeDecoder
, logged "whichDecoder" whichDecoder
, logged "keyIdentifierDecoder" keyIdentifierDecoder
, logged "charDecoder" charDecoder
]
cleanInput : List TileDef -> String -> String
cleanInput defs str =
let
validLetters =
List.map .letter defs
in
String.toUpper str
|> String.toList
|> List.filter (containsChar validLetters)
|> String.fromList
module Main exposing (..)
import Html exposing (div, button, ul, Html, li, text)
import Html.Attributes exposing (value, style)
import Html.Events exposing (onClick)
import Html.App as App
import Dict exposing (Dict)
import Random exposing (Seed)
module KellyColors exposing (..)
import Color exposing (..)
import Maybe exposing (..)
import List.Extra as List exposing (..)
type alias KellyDef =
{ isccNbsNr : Int, hexString : String, r : Int, g : Int, b : Int }
module Main exposing (..)
import Dict exposing (Dict)
import Html exposing (Html, div, text)
import Svg exposing (Svg, g)
import Svg.Attributes as SA
import Svg.Events as SE
type alias Idx =