Skip to content

Instantly share code, notes, and snippets.

View zporter's full-sized avatar
👨‍💻

Zach Porter zporter

👨‍💻
View GitHub Profile
@zporter
zporter / peak_notes.md
Created February 25, 2020 13:01
Book Club: Peak: Secrets from the New Science of Expertise

Purposeful practice has well-defined, specific goals.

You seldom improve much without giving the task your full attention.

Purposeful practice involves feedback.

Purposeful practice requires getting out of one’s comfort zone.

Recent studies have shown that learning a new skill is much more effective at triggering structural changes in the brain than simply continuing to practice a skill that one has already learned. On the other hand, pushing too hard for too long can lead to burnout and ineffective learning. The brain, like the body, changes most quickly in that sweet spot where it is pushed outside—but not too far outside—its comfort zone.

@zporter
zporter / github_pr.plugin.zsh
Created June 28, 2019 16:17
Oh-my-zsh plugin for opening a Github PR
function github_repo_path() {
git remote -v | egrep -io -m 1 "github.com[:/]([a-z/-]+)" | sed 's/github.com[:\/]//'
}
function ggpr {
open "https://github.com/$(github_repo_path)/pull/new/$(git_current_branch)"
}
@zporter
zporter / iex
Created September 12, 2018 10:08
Elixir: Parsing initials of a given name
iex(2)> c "name.ex"
[Name]
iex(3)> Name.initials("Cher")
"C"
iex(4)> Name.initials("Barry Bluejeans")
"BB"
iex(5)> Name.initials("Jean-Claude Van Damme")
"JVD"
Verifying my Blockstack ID is secured with the address 19UwLitPtt5ATRM9S15SWGapysWpoH2FkG https://explorer.blockstack.org/address/19UwLitPtt5ATRM9S15SWGapysWpoH2FkG
@zporter
zporter / fibonacci.ex
Created January 29, 2018 16:06
Elixir: Fibonacci
defmodule Fibonacci do
@moduledoc """
In mathematics, the Fibonacci numbers are the numbers in the following
integer sequence, called the Fibonacci sequence, and characterized by the
fact that every number after the first two is the sum of the two preceding
ones.
"""
@doc """
Finds the nth fibonacci number.

Keybase proof

I hereby claim:

  • I am zporter on github.
  • I am zporter (https://keybase.io/zporter) on keybase.
  • I have a public key ASDF_VC9qoitBmHWspNxiCHDK5xSnpiD9wRHKM7UrNbvtAo

To claim this, I am signing this object:

@zporter
zporter / .spacemacs
Created May 26, 2017 21:08
Spacemacs config
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
@zporter
zporter / address.ex
Last active May 17, 2017 02:00
Ecto: Embedded Schemas
use Ecto.Schema
import Ecto.Changeset
@type t :: module
# A required field for all embedded documents
@primary_key {:id, :binary_id, autogenerate: true}
schema "" do
@zporter
zporter / form_helpers.ex
Created March 6, 2017 16:15
Simple Form example for Phoenix
defmodule AppName.FormHelpers do
@doc """
Generates a form input tag
Example:
<%= input f,
:name,
input: [
placeholder: gettext("What should we call you?"),
],
@zporter
zporter / parsing.lhs
Created December 3, 2015 19:57
EDX: FP 101 Parser
> module Parsing where
>
>
> import Data.Char
> import Control.Monad
> import Control.Applicative
>
> infixr 5 +++
The monad of parsers