Skip to content

Instantly share code, notes, and snippets.

Evan Czaplicki evancz

Block or report user

Report or block evancz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@evancz
evancz / Preferences.sublime-settings
Created Aug 22, 2019
my settings for Sublime Text
View Preferences.sublime-settings
{
"color_scheme": "Monokai.sublime-color-scheme",
"ensure_newline_at_eof_on_save": true,
"fold_buttons": false,
"font_face": "Inconsolata",
"font_size": 16,
"ignored_packages":
[
"Vintage"
],
View labor-force-participation.md

Project Idea

I think it would be really interesting to do some data visualizations with the Labor Force Participation Rate.

If you go to this Labor Fource Participation graph and change the range to 1948 to 2018. You will see:

  1. Millions of women joining the labor force starting in the 60s. (source)
  2. Of the 11 recessions that occurred in that time, only 2008 caused such a big downward swing. About 10 million people stopped working since then! Why? Did two-income households become single-income? And wait, isn't the unemployment rate really low right now?
  3. The unemployment rate only counts people who are looking for work (by some definition of looking) and different governments count that different! So what about discouraged workers? And what happens whe
@evancz
evancz / font-face.md
Last active Mar 14, 2019
It seems really complicated to use custom fonts well. This explores some ideas of how to make it easier.
View font-face.md

Making it easier to load fonts

I have been doing a lot of work on making Elm assets really tiny. As part of some exploratory research I did ages ago, I read this document on font loading. It is a super helpful resource, but I was confused by all the different terms: FOIT, FOUT, FOFT, etc. It reminded me of the old "how do you center things?" blog posts from before flexbox. So my instinct was that probably lots of folks are confused about how to do it well, and maybe there is a better way!

So brainstormed some some ideas to:

  1. Save even more bits.
  2. Have an ideal visual experience.
  3. Be really easy to set up.
@evancz
evancz / cron.md
Last active Nov 7, 2019
Cron job to remind myself to stretch
View cron.md

Type crontab -l to see your cron jobs. Type crontab -e to edit them. You have to use Vim apparently.

Add a line like this:

0,30	*	*	*	*	/Users/YOURNAME/Documents/scripts/stretch.sh

That is on every 0th and 30th minute of the hour. Make sure all the separators in there are tabs!

@evancz
evancz / data-interchange.md
Last active Nov 28, 2019
Why do I have to write JSON decoders in Elm?
View data-interchange.md

A vision for data interchange in Elm

How do you send information between clients and servers? What format should that information be in? What happens when the server changes the format, but the client has not been updated yet? What happens when the server changes the format, but the database cannot be updated?

These are difficult questions. It is not just about picking a format, but rather picking a format that can evolve as your application evolves.

Literature Review

By now there are many approaches to communicating between client and server. These approaches tend to be known within specific companies and language communities, but the techniques do not cross borders. I will outline JSON, ProtoBuf, and GraphQL here so we can learn from them all.

@evancz
evancz / recursive-values.md
Last active Oct 24, 2019
Recursive values in Elm
View recursive-values.md

Recursive Values

In a functional language, writing recursive functions is common, but it is also possible to write recursive values. Here is a simple example of a recursive value:

ones = 1 :: ones

This is an infinite loop. We just keep growing the ones list to infinity. So #873 logged folks running into this and made it an error. This was especially nice for cases like x = x + 1 where folks were expecting Elm to allow mutation.

View Spelling.elm
port module Spelling exposing (..)
import Html exposing (..)
import Html.App as App
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import String
main =
View chess.elm
import Dict exposing (Dict)
import Html exposing (..)
type Rank = King | Queen | Bishop | Knight | Rook | Pawn
type Color = Black | White
type alias Piece =
{ rank : Rank
View Chat.elm
import Dom
import Dom.Scroll
import Html exposing (..)
import Html.App as App
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import Process
import Task
import WebSocket
View elm-0.17.1.md

Elm 0.17.1

Install

This is a patch release. Everything is the same, just slightly better!

The main changes are:

  • Default dependencies in elm-package.json are elm-lang/core and elm-lang/html.
  • Error messages for elm-package are improved (e.g. this and this)
You can’t perform that action at this time.