Skip to content

Instantly share code, notes, and snippets.

namespace :dependencies do
task :pre_task do
puts "pre-task"
end
task task1: :pre_task do
puts "task1"
end
task task2: :pre_task do
@JoelQ
JoelQ / Main.elm
Created October 27, 2016 18:40
Simple ports example
port module Main exposing (..)
import Html.App
import Html exposing (..)
import Html.Attributes exposing (id)
type alias Row =
List String
@JoelQ
JoelQ / Shuffle.elm
Created November 21, 2016 21:05
Mapping a list to a shuffled version of itself
module Main exposing (..)
import Array
import Tuple
import Dict exposing (Dict, get)
import Random exposing (Generator, map)
-- RANDOM
@JoelQ
JoelQ / 1-README.md
Last active December 16, 2016 02:38
What's up with Html a ?

What's up with Html a?

Ever wonder why sometimes the compiler yells at you for using type Html a ? Why is a ok some times but not others?

It's not unique to Html a. Look at the same problem using a simpler type we all understand: List a.

Here are a few questions and thoughts to ponder:

  • Compare the myList and myHtml functions. How are they similar? How are they different?
  • Why do you think these functions will compile or not compile?
@JoelQ
JoelQ / monoid_builder.rb
Created February 24, 2017 19:23
Builders as monoids
User = Struct.new(:name, :age, :profession)
class MonoidBuilder
def initialize(name: nil, age: nil, profession: nil)
@name = name
@age = age
@profession = profession
end
def self.empty

Mapping the world

Abstract

Provide a concise description for the program limited to 600 characters or less.

From the earliest cave paintings to today's GPS-assisted smartphone apps, maps have been an important part of we have described the world around us. But what goes into turning the life-size 3d world into a 2d image that fits in your

Modeling Data with Algebraic Data Types

Abstract

Provide a concise description for the program limited to 600 characters or less.

What is "good code"? You've probably heard something like "readable, easy to change, modular, and correct". But what does that look like in practice?

@JoelQ
JoelQ / README.md
Last active June 2, 2017 19:56
Script to generate domain-specific Elm types wrapping primitives (see https://robots.thoughtbot.com/lessons-learned-avoiding-primitives-in-elm for why this is a good idea)
@JoelQ
JoelQ / MUTATION.md
Last active July 14, 2017 18:55
Proposed Weekly Iteration on mutation in Ruby

Weekly Iteration - Mutation

Outline

  • Intro
  • Explain mutation vs re-assignment
  • Discuss Gotchas
    • Mutating a value in a list
    • Array constructor
    • Hash constructor
@JoelQ
JoelQ / ENUM.md
Created August 4, 2017 14:31
Proposed Weekly Iteration on Enums with examples in Elm

Weekly Iteration - Enums

Outline

  • 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