Skip to content

Instantly share code, notes, and snippets.

View fredcy's full-sized avatar

Fred Yankowski fredcy

View GitHub Profile
@fredcy
fredcy / elm-http-string-response.elm
Created March 8, 2016 16:15
Example of elm-http-extra getting HTTP response as a String
module Main (..) where
import Html
import Html.Events
import Http.Extra
import Task
import Effects
import StartApp
@fredcy
fredcy / keybase.md
Created February 2, 2016 02:23
keybase proof

Keybase proof

I hereby claim:

  • I am fredcy on github.
  • I am fredcy (https://keybase.io/fredcy) on keybase.
  • I have a public key ASDaqzdEQzsRRt-VbmDXscGVjQ8suYzQuPbdzfou3dPsYQo

To claim this, I am signing this object:

@fredcy
fredcy / elm-records.elm
Last active January 25, 2016 19:34
Elm record usage example
import Graphics.Element exposing (show)
type Foo = A { x : Int, y : String }
| B { x : Int, m : Float }
f : Foo -> Foo
f foo =
let
incr v = { v | x = v.x + 1 }
in
import Graphics.Element exposing (..)
main2 =
let
me = you
you = "Jane"
in
show (me, you)
main3 =
@fredcy
fredcy / selected-problem.elm
Created December 21, 2015 21:10
Elm example of Html.Attributes.selected problem
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import StartApp.Simple as StartApp
options : List (String)
options = [ "one", "two", "three", "four", "five" ]
type alias Model = String
type alias Action = String
@fredcy
fredcy / elm-onkeypress.elm
Last active December 17, 2015 20:05
Elm onKeyPress event
import Char
import Html exposing (..)
import Html.Events exposing (..)
import StartApp.Simple as StartApp
import String
main =
StartApp.start { model = model, view = view, update = update }
type alias Model = String
@fredcy
fredcy / elm-window-dimensions.elm
Created December 10, 2015 16:06
Example getting initial window.dimensions value in Elm app using StartApp
import Effects exposing (Effects)
import Html exposing (..)
import StartApp
import Task exposing (Task)
import Window
type alias Model = (Int, Int)
type Action = Update (Int, Int) | NoOp
@fredcy
fredcy / elm-http-get-example.elm
Last active December 10, 2015 20:57
Example using Elm Http.get
import Effects
import Html exposing (..)
import Http
import StartApp
import Task
app : StartApp.App String
app =
StartApp.start
@fredcy
fredcy / date-display.elm
Created December 8, 2015 17:25
Show how Elm displays time and date values as strings
import Date
import Effects
import Html exposing (li, text, ul)
import StartApp
import Time
app =
StartApp.start
{ init = (0, Effects.none)
, inputs = [Time.every Time.second]
#!/bin/bash
SITEHOME=/home/fred/elm/platform/Elm-Platform/master/elm-lang.org
PROG=dist/build/run-elm-website/run-elm-website
NAME=elm-website
PATH=/usr/local/bin:/home/fred/.cabal/bin:$PATH
LOGFILE=/var/log/${NAME}.log
# need this to avoid error about "hGetContents: invalid argument