Skip to content

Instantly share code, notes, and snippets.

View nicklawls's full-sized avatar

Nick Lawler nicklawls

  • ExtraHop
  • Somerville, MA
View GitHub Profile
module View exposing (..)
import Html exposing (Html, text, div)
type alias View model msg = { view : model -> Html msg }
contramap : (model -> b) -> View b msg -> View model msg
@nicklawls
nicklawls / Main.elm
Last active April 17, 2017 20:14
Fancy Docs with pablohirafuji/elm-markdown, bulma, and highlight.js. Running at: http://elm-docs-example.surge.sh/
port module Main exposing (..)
import Html exposing (..)
import Html.Attributes exposing (class, classList, hidden)
import Html.Events exposing (onClick)
import Http exposing (..)
import Markdown.Block as Block exposing (Block(..), CodeBlock, CodeBlock(..))
import Maybe.Extra as Maybe
import Regex exposing (HowMany(..))
import Result.Extra as Result
@nicklawls
nicklawls / Dashboard.elm
Last active December 4, 2017 17:09
Regular TEA style elm application
module Pages.Dashboard exposing (Model, Msg, init, update, view)
@nicklawls
nicklawls / Dashboard.elm
Last active December 27, 2017 02:37
Vanilla TEA "component" style
module Dashboard exposing (Model, Msg, init, update, view, Modal, viewModal, Modal(..))
import Dialog
import Html exposing (..)
import Html.Attributes exposing (class, type_, value)
import Html.Events exposing (onClick, onInput)
type alias Model =
{ fruits : List Fruit
@nicklawls
nicklawls / Main.elm
Created December 27, 2017 02:39
"Vanilla" Main.elm
module Main exposing (..)
import Dashboard exposing (Modal(..))
import Html exposing (..)
import Html.Attributes exposing (class)
import OrderFruit
main : Program Never Model Msg
main =
@nicklawls
nicklawls / Dashboard.elm
Created December 27, 2017 02:51
After adding modal
module Dashboard exposing (Model, Msg, init, update, view, Modal, viewModal, Modal(..))
import Dialog
import Html exposing (..)
import Html.Attributes exposing (class, type_, value)
import Html.Events exposing (onClick, onInput)
type alias Model =
{ fruits : List Fruit
@nicklawls
nicklawls / Main.elm
Created December 27, 2017 02:52
Before adding messages
module Main exposing (..)
import Dashboard exposing (Modal(..))
import Html exposing (..)
import Html.Attributes exposing (class)
import OrderFruit
main : Program Never Model Msg
main =
@nicklawls
nicklawls / Dashboard.elm
Created December 27, 2017 02:55
Exposed Guts
module Dashboard exposing (Model, Msg(..), init, update, Fruit)
type alias Model =
{ fruits : List Fruit
, selectedFruit : Maybe String
}
type alias Fruit =
@nicklawls
nicklawls / Dashboard.elm
Created December 28, 2017 05:50
Deferred view
module Dashboard exposing (Model, State, Msg, init, update, view, Fruit)
import Html exposing (Html)
type alias State =
{ fruits : List Fruit
, selectedFruit : Maybe String
}
@nicklawls
nicklawls / Main.elm
Created December 28, 2017 05:55
Deferred view
module Main exposing (..)
import Dashboard exposing (Fruit)
import Dialog
import Html exposing (..)
import Html.Attributes exposing (class)
import Html.Events exposing (onClick)
import OrderFruit