Skip to content

Instantly share code, notes, and snippets.

Working from home

Chris Buttery chrisbuttery

Working from home
Block or report user

Report or block chrisbuttery

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View main.elm
module Main exposing (..)
import Html exposing (..)
depth : number
depth =
chrisbuttery /
Created Oct 23, 2016 — forked from yang-wei/
Elm Destructuring (or Pattern Matching) cheatsheet

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 !


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

  (a,b,c) = myTuple
chrisbuttery / Main.elm
Last active Oct 20, 2016
elm-lang equivalent of 2 second SetTimeout.
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

Keybase proof

I hereby claim:

  • I am chrisbuttery on github.
  • I am 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
chrisbuttery / PascalsTriangles.js
Created Jun 30, 2016 — forked from kgates-github/PascalsTriangles.js
Two ways to create a Pascal's Triangle in JavaScript.
View PascalsTriangles.js
var numTiers = 100,
* First version uses recursion
chrisbuttery / index.js
Last active Jun 30, 2016
requirebin sketch
View index.js
const choo = require('choo')
const app = choo()
function init (send) {
function decrement (state) {
if (state.count === 0) {
// implode
chrisbuttery / A.elm
Last active Jun 16, 2016
Elm 0.17: Experimenting with patterns to update a model
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 }
chrisbuttery / Main.elm
Created May 23, 2016
Elm: Split List into a List of Lists
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)
You can’t perform that action at this time.