Skip to content

Instantly share code, notes, and snippets.


Joël Quenneville JoelQ

  • Thoughtbot
  • Boston
View GitHub Profile
JoelQ /
Last active Jul 28, 2021
List of helpful Ellie's I've written
JoelQ /
Last active Oct 29, 2020
What does `x :: xs` pattern matching mean in Elm?

What does x :: xs pattern matching mean in Elm?

:: is the list prepend operator in Elm.

3 :: 2 :: 1 :: []

is equivalent to


Mutation in Ruby

Mutation-related bugs are some of the most common in the Ruby world. Joël and German explore many of the gotchas related to mutation, how to avoid them, and discuss when mutation might not be necessary at all.

Mutation vs Reassignment

In mutation, the value of an object changes but its identity remains the same:


Thoughtbot's Approach to Ruby

We've been writing Ruby for years on lots of different projects and in many different environments. This has led to thoughtbot's Ruby style to be somewhat different to the rest of the community's. In particular, we tend to focus on a sub-set of Ruby's features. Derek and Joël some of those differences and the reasoning behind them.

Style guide:

JoelQ / RandomToTask.elm
Last active Sep 30, 2021
Turn an Elm random generator into task, allowing it to be chained with other side effects.
View RandomToTask.elm
-- 0.19
randomToTask : Generator a -> Task x a
randomToTask generator =
|> (Tuple.first << Random.step generator << Random.initialSeed << Time.posixToMillis)
-- 0.18
View suggestion.elm
delay : Time -> a -> Cmd a
delay t x =
Task.perform (always x) <| Process.sleep t
cmd : msg -> Cmd msg
cmd msg =
Task.perform (always msg) (Task.succeed msg)
initSeed = 100
JoelQ /
Created Aug 4, 2017
Proposed Weekly Iteration on Enums with examples in Elm

Weekly Iteration - Enums


  • Intro
  • Describe Enums as a concept
  • Look some Enum refactorings in Elm
  • Enums vs strings
  • Compare with Enums in other languages (Swift, C)
  • Discuss mapping to numbers
JoelQ /
Last active Oct 5, 2017
Wrapping primitives in custom types in Elm

Domain-Specific Types in Elm

Compilers are powerful helpers but they can only do so much with primitives. Joël and Stephanie fix a bug by introducing domain-specific types. Learn about how these encode real-world context, what are the downsides, and how some functional programming concepts can make those downsides go away.

Primitive Obsession

Previously discussed, don't depend too heavily on low-level constructs.


JoelQ /
Last active Sep 14, 2017
Weekly Iteration - Primitive Obsession

Weekly Iteration - Primitive Obsession

Our languages give us great tools in the form of primitives: things like integers, strings, and arrays. However, over-relying on these leads to problems. This practice even has it's own fancy code smell name: Primitive Obssession. In this video, Derek and Joël take a look at Primitive Obsession and the various abstraction tools languages provide to deal with it.

What does it look like in Ruby?

Over relying on hashes/arrays

Representing dollars/cents as an two-element array:

JoelQ /
Last active Jul 14, 2017
Proposed Weekly Iteration on mutation in Ruby

Weekly Iteration - Mutation


  • Intro
  • Explain mutation vs re-assignment
  • Discuss Gotchas
    • Mutating a value in a list
    • Array constructor
    • Hash constructor