Skip to content

Instantly share code, notes, and snippets.

View chrisbuttery's full-sized avatar
🏠
Working from home

Chris Buttery chrisbuttery

🏠
Working from home
View GitHub Profile
@chrisbuttery
chrisbuttery / Main.elm
Created May 18, 2016 06:54
Elm 0.17. A simple filtering digits from Keyboard.presses example
import Html exposing (Html, text, div)
import Html.App as Html
import Keyboard exposing (..)
import Char exposing (..)
main =
Html.program
{ init = init
, view = view
, update = update
@chrisbuttery
chrisbuttery / Main.elm
Last active May 18, 2016 05:51
Elm 0.17. A simple Window.resizes example.
import Html exposing (Html, text, div)
import Html.App as Html
import Window exposing (..)
main =
Html.program
{ init = init
, view = view
, update = update
, subscriptions = subscriptions
@chrisbuttery
chrisbuttery / Main.elm
Last active May 18, 2016 05:51
Elm 0.17. A simple 'mouse clicks' example
import Html exposing (Html, text, div)
import Html.App as Html
import Mouse exposing (..)
main =
Html.program
{ init = init
, view = view
, update = update
, subscriptions = subscriptions
@chrisbuttery
chrisbuttery / introrx.md
Created January 19, 2016 22:07 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@chrisbuttery
chrisbuttery / Main.elm
Last active March 18, 2016 12:04
ELM: Prevent ships from positioning over each other
module Game (..) where
import Graphics.Element exposing (..)
import Graphics.Collage exposing (..)
import Color exposing (red, blue, gray, green)
import Keyboard
import Window
-- ALIAS
type Action
= Updated Response
| APIError Error
update : Action -> Model -> ( Model, Effects Action )
update action model =
case action of
Updated response -> -- do things
APIError error ->
let
@chrisbuttery
chrisbuttery / Main.elm
Created March 4, 2016 06:28
Fun with Signals
module Main (..) where
import Graphics.Element exposing (..)
import Time exposing (Time, second)
import Effects exposing (Effects)
import Keyboard
type alias DebounceState =
Maybe
@chrisbuttery
chrisbuttery / CustomStartApp.elm
Created March 4, 2016 01:51 — forked from danyx23/CustomStartApp.elm
Use ports with customized StartApp and "PortActions"
module CustomStartApp (start, App, Config) where
import Html exposing (Html)
import Effects exposing (Effects, Never)
import Task
type alias Config model action portAction =
{ init : ( model, Effects action, portAction )
, update : action -> model -> ( model, Effects action, Maybe portAction )
@chrisbuttery
chrisbuttery / elm-package.json
Created March 4, 2016 01:51 — forked from danyx23/elm-package.json
Simple example of using Ports in Elm
{
"version": "1.0.0",
"summary": "helpful summary of your project, less than 80 characters",
"repository": "https://github.com/user/project.git",
"license": "BSD3",
"source-directories": [
"."
],
"exposed-modules": [],
"dependencies": {
@chrisbuttery
chrisbuttery / Main.elm
Created February 13, 2016 11:32 — forked from mkulke/Main.elm
Elm: simple rest call
module Main where
import Html exposing (Html, text, p)
import Signal exposing (Address)
import Effects exposing (Effects, Never)
import Json.Decode as Json exposing ((:=))
import StartApp exposing (start)
import Task
import Http