Mark Grealish

the life and code of a crazy cat man

Vanilla JavaScript method to map an array to a callback

in code

I am being so productive today.

function map(arr, callback) {
    return !arr.length ? [] : [].concat(callback(arr[0]), map(arr.slice(1), callback));

Spanish Point Eadaoin

in family

Taken at Maria and Adrian’s wedding in September 2016. :)

Hotness Incarnate

Disapproving Cookie

in animals

I don’t know why I feel so judged, but I do.

Unhappy Cookie on a window sill

“Hello world!” from elm

in code

I am teaching myself functional programming and MV JavaScript applications by way of Elm. Although Elm has so far managed to wreck my head, parts of it have begun to be less opaque.

/tooting intensifies

import Html exposing (Html, text, div, button, h3)
import Html.App exposing (beginnerProgram)
import Html.Events exposing (onClick)

main =
  beginnerProgram { model = model, view = view, update = update }

-- Model

type alias Model = { content: String }

model : Model
model = { content = "Click a button to see a message!" }

-- Update

type Msg = Hello | Goodbye

update : Msg -> Model -> Model
update msg model =
  case msg of
    Hello -> { model | content = "Hello world!" }
    Goodbye -> { model | content = "Goodbye world!" }

-- View

view : Model -> Html Msg
view model =
  div [] 
    [ h3 [] [ text model.content ]
    , button [ onClick Hello ] [ text "Hello" ]
    , button [ onClick Goodbye ] [ text "Goodbye" ]

To be honest, we’re hot shit

in family

Yeah, look at us.

Hot _as_

Literally Markour

in me

Eadaoin asked for urban exploration, for parkour and excitement. I have no idea why she giggled at me when I delivered.

Markouring Mark