Skip to content

Instantly share code, notes, and snippets.

@pdamoc
pdamoc / ZipCodes.elm
Created September 8, 2015 07:59
ZipCodes demo updated to user the Elm Architecture
module ZipCodes where
import Effects exposing (Effects, map, batch, Never)
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import Json.Decode as Json exposing ((:=))
import Task
import String
import Char
@pdamoc
pdamoc / SlideShow.elm
Last active September 9, 2015 07:29
SlideShow delayed action
module SlideShow where
import StartApp
import Time exposing (second, Time)
import Html exposing (Html, Attribute, div, text)
import Html.Attributes exposing (style)
import Effects exposing (Effects, map, batch, Never)
import Array exposing (get, fromList)
import Task
import Mouse
@pdamoc
pdamoc / StartApp.elm
Created September 26, 2015 11:04
Agnostic StartApp
module StartApp ( start, Config, App ) where
{-| This module helps you start your application in a typical Elm workflow.
It assumes you are following [the Elm Architecture][arch] and using
[elm-effects][]. From there it will wire everything up for you!
**Be sure to [read the Elm Architecture tutorial][arch] to learn how this all
works!**
[arch]: https://github.com/evancz/elm-architecture-tutorial
[elm-effects]: http://package.elm-lang.org/packages/evancz/elm-effects/latest
@pdamoc
pdamoc / README.md
Last active March 26, 2016 18:11
Integrating ports with Elm Architecture

Instructions

  • compile the SendToPort.elm to elm.js
    elm-make SendToPort.elm --output elm.js
  • open SendToPort.html

Observations

@pdamoc
pdamoc / MockRequests.elm
Created October 29, 2015 11:46
A strategy to decouple the requests from the rest o the app in order to facilitate mock results.
import Html exposing (..)
import Html.Attributes exposing (style, id, type', src)
import Html.Events exposing (onClick)
import Task exposing (Task, succeed)
import StartApp
import Effects exposing (Never)
import Json.Decode exposing ( (:=), string )
import Http exposing (send, Request, empty, defaultSettings, fromJson )
import Task exposing (andThen)
@pdamoc
pdamoc / Tangram.elm
Created December 6, 2015 16:12
Tangram Animation
import Svg exposing (svg, path, g, text, text', rect)
import Svg.Attributes exposing (width, height, viewBox, fill, transform, d, x, y, rx, ry, style, textAnchor)
import Easing exposing (ease, easeOutElastic, float)
import Effects exposing (Effects)
import Html exposing (Html)
import Svg.Events exposing (onClick)
import Time exposing (Time, second)
import StartApp
import Task
@pdamoc
pdamoc / TurnBase.elm
Created December 7, 2015 08:30
Turn Base Demo
module TurnBase (Model, Action, init, update, view, main) where
import Effects exposing (Effects)
import Html exposing (Html)
import Svg exposing (svg, rect, g, text, text')
import Svg.Attributes exposing (..)
import Svg.Events exposing (onClick)
import Time exposing (Time, second)
import StartApp
import Task exposing (Task)
@pdamoc
pdamoc / Components.elm
Created December 8, 2015 13:02
Alternative Component Architecture
import Html exposing (..)
import Html.Attributes exposing (width, style)
import StartApp
import Effects exposing (Effects)
import Task exposing (Task)
import Time exposing (Time)
type MainAction = Sidebar Html | Content Html
@pdamoc
pdamoc / RandomDemo.elm
Created February 5, 2016 11:04
RandomDemoPair
module RandomDemo where
import Html exposing (..)
import Html.Events exposing (onClick)
import Random exposing (int, generate)
import StartApp
import Effects exposing (Effects)
@pdamoc
pdamoc / Game.elm
Created February 9, 2016 08:05
Guessing Game
module Game where
import Effects exposing (Effects, Never)
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import String
import Time
import Task
import Random exposing (generate, int, initialSeed)