Instantly share code, notes, and snippets.

View main.elm
module Main exposing (..)
import Html exposing (..)
depth : number
depth =
10
View destructuring.md

Destructuring(or pattern matching) is a way used to extract data from a data structure(tuple, list, record) that mirros the construction. Compare to other languages, Elm support much less destructuring but let's see what it got !

Tuple

myTuple = ("A", "B", "C")
myNestedTuple = ("A", "B", "C", ("X", "Y", "Z"))

let
  (a,b,c) = myTuple
View Main.elm
module Main exposing (..)
import Html exposing (..)
import Html.Events exposing (..)
import Html.App as App
import Task
import Process
import Time
View Main.elm
module Main exposing (..)
import Html exposing (Html, button, div, text)
import Html.App
import Widget
import Ports
-- MODEL
View keybase.md

Keybase proof

I hereby claim:

  • I am chrisbuttery on github.
  • I am chrisbuttery (https://keybase.io/chrisbuttery) on keybase.
  • I have a public key ASBkVZkZ0a3Mww6WQEqB1QFM7xrR5sNAHIaTebBDiggjRwo

To claim this, I am signing this object:

View gist:e062faec6063c87baad356548f3bbdf2

Use these rapid keyboard shortcuts to control the GitHub Atom text editor on Mac OSX.

Key to the Keys

  • ⌘ : Command key
  • ⌃ : Control key
  • ⌫ : Delete key
  • ← : Left arrow key
  • → : Right arrow key
  • ↑ : Up arrow key
View PascalsTriangles.js
var numTiers = 100,
triangle,
start,
stop;
/**
*
* First version uses recursion
*
*/
View index.js
const choo = require('choo')
const app = choo()
function init (send) {
send('start')
}
function decrement (state) {
if (state.count === 0) {
// implode
View A.elm
import Html exposing (..)
import Html.App as Html
import Html.Attributes exposing (..)
import Html.Events exposing (onInput)
import String
type alias Model =
{ topic : String }
View Main.elm
import Html exposing (..)
import List
split : Int -> List a -> List (List a)
split i list =
case List.take i list of
[] -> []
listHead ->
-- [1,2] (listHead)