Skip to content

Instantly share code, notes, and snippets.

@newlandsvalley
newlandsvalley / TunnelBinary17.elm
Created November 14, 2016 15:30
Tunnel binary through http using elm 0.17
module TunnelBinary17 exposing (..)
import Html exposing (..)
import Html.Events exposing (onClick)
import Html.App as Html
import Http exposing (..)
import Task exposing (..)
import List exposing (..)
import String exposing (..)
import Result exposing (Result)
@newlandsvalley
newlandsvalley / TunnelBinary18.elm
Created November 14, 2016 15:22
Tunnel binary through http using elm 0.18
module TunnelBinary18 exposing (..)
import Html exposing (..)
import Html.Events exposing (onClick)
import Http exposing (..)
import List exposing (..)
import String exposing (..)
import Result exposing (Result)
import Char exposing (fromCode, toCode)
import Bitwise exposing (and)
@newlandsvalley
newlandsvalley / Checks.elm
Created August 12, 2016 13:55
elm-check Producers and recursive data structures
module Checks exposing (..)
import Producers exposing (..)
import Mus exposing (..)
import Check exposing (..)
import Check.Producer exposing (..)
import Check.Test
import ElmTest
@newlandsvalley
newlandsvalley / index.scala.html
Created March 7, 2016 19:18
Simple integration of elm with the Play Framework (Scala)
@*
* This template takes a single argument, a String containing a
* message to display.
*@
@(message: String)
@main("The Interactive ABC Tutorial", "abc", "Main") {
<h1>The Interactive ABC Tutorial</h1>
@newlandsvalley
newlandsvalley / Disable.elm
Created March 2, 2016 12:30
Disable a button in elm whilst the task which it kicks off is in flight
module Disable where
{-
This gist shows one method of temporarily disabling a button whilst a task (which it has kicked off)
is in flight. My need to do this comes from an audio 'play' button which kicks of an audio
'play sounds' task. Although the task returns immediately, I know the duration of the sound clip
so I suspend the UI whilst the clip is played. The trick is to split the 'play' task into two parts
so that the view has the chance to update in between them. The first action (Play) disables the button
and plays the clip, the second action (ShowButton) re-enables the button.
@newlandsvalley
newlandsvalley / Recurse.elm
Created January 31, 2016 10:34
Elm runtime error - caused by mutual recursion?
import Combine exposing (..)
import Combine.Char exposing (..)
import Combine.Infix exposing (..)
import Graphics.Element exposing (..)
{- dependencies
"elm-lang/core": "3.0.0 <= v < 4.0.0",
"Bogdanp/elm-combine": "2.0.0 <= v < 3.0.0"
-}