Skip to content

Instantly share code, notes, and snippets.


Terkwood Terkwood

  • Salesforce
  • Indiana, USA
View GitHub Profile

Keybase proof

I hereby claim:

  • I am terkwood on github.
  • I am terkwood ( on keybase.
  • I have a public key ASCBCEmPEZhERf6TRBFM_Ed-SX-sLAVcOEHquPb0nT0Mvgo

To claim this, I am signing this object:

Terkwood / after-note.tpl
Created Oct 2, 2021
show timestamp in emanote
View after-note.tpl
<!-- templates/hooks/after-note.tpl -->
<span class="mr-2 text-right text-gray-600">
<value var="date" />
View gist:b29cae052322706b3272748f7fe50974
# Controller option 1, implicit render selected based on format
defmodule MyApp.UserController do
use Phoenix.Controller
def show(conn, %{"id" => id}) do
render conn, :show, user: Repo.get(User, id)
# Controller option 2, explicit render with format pattern match
Terkwood /
Created Jul 12, 2021 — forked from rubencaro/
Elixir installation guide

Elixir installation guide

Version numbers should be the ones you want. Here I do it with the last ones available at the moment of writing.

The simplest way to install elixir is using your package manager. Sadly, at the time of writing only Fedora shows the intention to keep its packages up to date. There you can simply sudo dnf install erlang elixir and you are good to go.

Anyway, if you intend to work with several versions of erlang or elixir at the same time, or you are tied to a specific version, you will need to compile it yourself. Then asdf is your best friend.

Terkwood / Lambda.scala
Created Mar 8, 2021 — forked from RaasAhsan/Lambda.scala
Type-level, untyped lambda calculus in Scala 3
View Lambda.scala
object Lambda extends App {
sealed trait Term
sealed trait Var[I <: Index] extends Term
sealed trait App[T1 <: Term, T2 <: Term] extends Term
sealed trait Abs[T1 <: Term] extends Term
sealed trait If[T1 <: Term, T2 <: Term, T3 <: Term] extends Term
sealed trait Bool[T1 <: Boolean] extends Term
sealed trait Index

There are certain files created by particular editors, IDEs, operating systems, etc., that do not belong in a repository. But adding system-specific files to the repo's .gitignore is considered a poor practice. This file should only exclude files and directories that are a part of the package that should not be versioned (such as the node_modules directory) as well as files that are generated (and regenerated) as artifacts of a build process.

All other files should be in your own global gitignore file. Create a file called .gitignore in your home directory and add anything you want to ignore. You then need to tell git where your global gitignore file is.


git config --global core.excludesfile ~/.gitignore


git config --global core.excludesfile %USERPROFILE%\.gitignore
View Inject javascript into HTML pages from

#Inject javascript into HTML pages from console

An easy way to inject Javascripts into the current loaded dom using the developer console in chrome.


var script = document.createElement('script');
script.src = '';
Terkwood / gist:89348347bb11ed58d7b38c1d5217de67
Created Jan 17, 2021 — forked from danking/gist:1068185
A very simple example showing how to use Racket's lexing and parsing utilities
View gist:89348347bb11ed58d7b38c1d5217de67
#lang racket
(require parser-tools/lex
(prefix-in re- parser-tools/lex-sre)
(provide (all-defined-out))
(define-tokens a (NUM VAR))
(define-empty-tokens b (+ - EOF LET IN))
(define-lex-trans number
(syntax-rules ()
Terkwood /
Created Nov 30, 2020 — forked from edmundsmith/
Method for Emulating Higher-Kinded Types in Rust

Method for Emulating Higher-Kinded Types in Rust


I've been fiddling about with an idea lately, looking at how higher-kinded types can be represented in such a way that we can reason with them in Rust here and now, without having to wait a couple years for what would be a significant change to the language and compiler.

There have been multiple discussions on introducing higher-ranked polymorphism into Rust, using Haskell-style Higher-Kinded Types (HKTs) or Scala-looking Generalised Associated Types (GATs). The benefit of higher-ranked polymorphism is to allow higher-level, richer abstractions and pattern expression than just the rank-1 polymorphism we have today.

As an example, currently we can express this type:

Terkwood / sccache-trimmed.txt
Created May 12, 2020
sccache example (trimmed)
View sccache-trimmed.txt
Compile requests 5063
Compile requests executed 971
Cache hits 558
Cache misses 410
Compilation failures 3
Non-cacheable calls 4092
Average cache write 0.002 s
Average cache read miss 2.511 s
Average cache read hit 0.007 s