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
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)
@chrisbuttery
chrisbuttery / Main.elm
Last active May 20, 2016 05:23 — forked from hoelzro/Shuffle.elm
List shuffle implementation in Elm
import Html exposing (..)
import Html.App as Html
import Html.Events exposing (..)
import Random exposing (Generator)
import List
users =
[ {name = "one", username = "@one"}
, {name = "two", username = "@two"}
, {name = "three", username = "@three"}
@chrisbuttery
chrisbuttery / shuffle.elm
Created May 19, 2016 05:08 — forked from AlexNisnevich/shuffle.elm
Shuffling a list in Elm
import List
import Random
without : Int -> [a] -> [a]
without i arr =
let before = take i arr
after = drop (i+1) arr
in
before ++ after