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 November 14, 2016 05:21
elm-pascal
module Main exposing (..)
import Html exposing (..)
depth : number
depth =
10
@chrisbuttery
chrisbuttery / destructuring.md
Created October 23, 2016 23:45 — forked from yang-wei/destructuring.md
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 !

Tuple

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

let
  (a,b,c) = myTuple
@chrisbuttery
chrisbuttery / Main.elm
Last active October 20, 2016 10:59
elm-lang equivalent of 2 second SetTimeout.
module Main exposing (..)
import Html exposing (..)
import Html.Events exposing (..)
import Html.App as App
import Task
import Process
import Time
module Main exposing (..)
import Html exposing (Html, button, div, text)
import Html.App
import Widget
import Ports
-- MODEL

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:

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
chrisbuttery / PascalsTriangles.js
Created June 30, 2016 12:37 — forked from kgates-github/PascalsTriangles.js
Two ways to create a Pascal's Triangle in JavaScript.
var numTiers = 100,
triangle,
start,
stop;
/**
*
* First version uses recursion
*
*/
@chrisbuttery
chrisbuttery / index.js
Last active June 30, 2016 11:57
requirebin sketch
const choo = require('choo')
const app = choo()
function init (send) {
send('start')
}
function decrement (state) {
if (state.count === 0) {
// implode
@chrisbuttery
chrisbuttery / A.elm
Last active June 16, 2016 11:54
Elm 0.17: Experimenting with patterns to update a model
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
chrisbuttery / Main.elm
Created May 23, 2016 01:09
Elm: Split List into a List of Lists
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)