Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍💻

Zach Porter zporter

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

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 Jun 28, 2019
Oh-my-zsh plugin for opening a Github PR
View github_pr.plugin.zsh
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 Sep 12, 2018
Elixir: Parsing initials of a given name
View iex
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"
View gist:5f01506a25eead8e9da5dfaae0d572a5
Verifying my Blockstack ID is secured with the address 19UwLitPtt5ATRM9S15SWGapysWpoH2FkG https://explorer.blockstack.org/address/19UwLitPtt5ATRM9S15SWGapysWpoH2FkG
@zporter
zporter / fibonacci.ex
Created Jan 29, 2018
Elixir: Fibonacci
View fibonacci.ex
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.
View keybase.md

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
Spacemacs config
View .spacemacs
;; -*- 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
Ecto: Embedded Schemas
View address.ex
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 Mar 6, 2017
Simple Form example for Phoenix
View form_helpers.ex
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 Dec 3, 2015
EDX: FP 101 Parser
View parsing.lhs
> module Parsing where
>
>
> import Data.Char
> import Control.Monad
> import Control.Applicative
>
> infixr 5 +++
The monad of parsers