Skip to content

Instantly share code, notes, and snippets.

View cobalamin's full-sized avatar
👾

Simon Welker cobalamin

👾
View GitHub Profile
module AudioControl exposing (..)
import Html exposing (Attribute, Html, audio, div, text, button)
import Html.Attributes exposing (class, controls, type', src, id, property)
import Html.App as App
import Html.Events exposing (on, onClick)
import Json.Decode as Json
import Json.Encode as Enc
import Debug
@cobalamin
cobalamin / LetShadowing.elm
Last active August 3, 2016 14:34
Odd Elm compiler behaviour for shadowed mutual dependencies in `let` blocks
module LetShadowing exposing (..)
type alias TestModel = { dependency : String, id : Char }
borkMe : TestModel -> TestModel
borkMe model =
let
dep : String
dep =
Debug.log (toString model.id) model.dependency
@cobalamin
cobalamin / ParseStopwatch.elm
Created August 5, 2016 15:06
Parsing a stopwatch-like time string format in Elm
module ParseStopwatch exposing (..)
import Parser exposing (..)
import Parser.Char exposing (..)
import Parser.Number exposing (digit)
import Char
import Time exposing (..)
twoDigitInt : Parser Int
module Codec exposing (..)
import Json.Encode as Encode
type alias Listy =
{ a : List Int, b : Maybe String }
encodeListy : Listy -> Encode.Value
module Temp exposing (..)
import Html exposing (..)
import Html.App as App
import Html.Events exposing (..)
import List
import Json.Decode as Json
join : List String -> String
join list = (List.foldr (++) "" list)
module FetchParallel exposing (..)
import Html exposing (Html, div, text, ul, li)
import Html.App exposing (program)
import Task
import Http
import Json.Decode as Json
import Json.Decode exposing ((:=))
import Dict exposing (Dict, fromList, toList)
import ZZZFetchJSON exposing (..)
module FetchParallel2 exposing (..)
import Html exposing (Html, div, text, ul, li)
import Html.App exposing (program)
import Task
import Http
import Json.Decode as Json
import Json.Decode exposing ((:=))
import Dict exposing (Dict, fromList, toList)
import ZZZFetchJSON exposing (..)
module Stuff exposing (..)
import UrlParser exposing (..)
import String
import Erl
import Dict exposing (Dict)
type alias Params =
Dict String String
range : number -> number -> List number
range s e =
if s < e then
rangeWith (-) (<) e s []
else
rangeWith (+) (>) e s []
rangeWith : (number -> number -> number) -> (number -> number -> Bool) -> number -> number -> List number -> List number
rangeWith modifyCount compare s e acc =
if compare s e then
@cobalamin
cobalamin / SafeInt.elm
Last active September 23, 2016 08:47
playing around with making invalid Ints represented explicitly
module SafeInt exposing (SafeInt, fromInt, get, map, map2, andThen, (+!), (-!), (*!), (//!), (%!), (^!))
type SafeInt
= Safe Int
| Invalid
fromInt : Int -> SafeInt
fromInt i =