Skip to content

Instantly share code, notes, and snippets.

Jerel Unruh jerel

Block or report user

Report or block jerel

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
jerel / genserver_test.ex
Last active May 16, 2019
Test code that a GenServer calls by injecting a mock client that sends a message to a named test process
View genserver_test.ex
defmodule Example.Server do
use GenServer
defmodule Data do
defstruct client: Example.Client
def init(%{client: client}), do: {:ok, %Data{client: client}, 500}
def init(_), do: {:ok, %Data{}, 500}
### Keybase proof
I hereby claim:
* I am jerel on github.
* I am jerel ( on keybase.
* I have a public key ASCJUGUw8Ek_glkidrXcFXY-GmF5awcOn7IwVuDINk34sAo
To claim this, I am signing this object:
jerel / it-doesn'
Last active Sep 24, 2019
Some of my favorite quotes from "It Doesn't Have To Be Crazy At Work" by Jason Fried and David Heinemeier Hansson
View it-doesn'

Any mistakes are my own. Basecamp is a modern software company that (by many estimates) generates millions of dollars in profit each month.

Promise not to promise

Since the beginning of Basecamp, we've been loath to make promises about future product improvements. We've always wanted customers to judge the product they could buy and use today, not some imaginary version that might exist in the future.

The wrong time for real-time

Chat puts conversations on conveyor belts that are perpetually moving away from you. If you're not at your station when the conversation rolls by, you'll never get a chance to put in your two cents. This means if you want to have your say, you need to be paying attention all day (and often to multiple rooms/channels). ... Chat is great for hashing stuff our quickly when speed truly is important. ... It's also great for watercooler-like banter ... building a camaraderie among people during gaps in the workday.

jerel /
Created Jun 9, 2017
Easily export a massive dataset from Django to the browser as a streaming CSV file
import csv
from StringIO import StringIO
from django.http import StreamingHttpResponse
class StreamCSV(object):
def __init__(self):
self._buffer = StringIO()
self._writer = csv.writer(self._buffer)
jerel / seed.ex
Created Dec 19, 2016
Run seeds in an Elixir Distillery app
View seed.ex
defmodule :release_tasks do
def seed do
:ok = Application.load(:myapp)
[:postgrex, :ecto, :logger]
|> Enum.each(&Application.ensure_all_started/1)
jerel / soft-delete.ex
Last active Nov 1, 2016
In Elixir soft delete records immediately followed by a real delete a day later. (untested example)
View soft-delete.ex
defmodule User do
def all do
from(u in UserSchema, where: is_nil(u.deleted_at)) |> Repo.all
def delete(user_id) do
user = Repo.get!(UserSchema, user_id)
changeset = Ecto.Changeset.change(user, deleted_at: Ecto.DateTime.utc)
jerel /
Created Oct 6, 2016
A bash function I use to force me to do pushups every 30 minutes throughout the work day.
work() {
while true; do
sleep 1800 #30 min
espeak "$1 pushups"
xinput set-prop 14 'Device Enabled' 0 #disable keyboard
xinput set-prop 16 'Device Enabled' 0 #disable mouse
xset dpms force off #disable monitors
sleep 15
xinput set-prop 14 'Device Enabled' 1
xinput set-prop 16 'Device Enabled' 1
jerel / application.controller.js
Last active Jan 28, 2016
Ember unloadRecord doesn't remove observers
View application.controller.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
jerel / elixir.exs
Last active Oct 5, 2015
This is a rough list of things that might initially be confusing to a non-rubyist trying to learn Elixir
View elixir.exs
# implicit return is fairly obvious but foreign to most languages
def foo(arg) do
# foo/2 is the notation for a function that takes two arguments
# optional parenthesis
def foo arg, arg2 do
jerel /
Created Apr 13, 2015
Bash script to clear watchman roots to solve Error: watch EMFILE
watchman watch-list | tr -d '[:space:]' | grep -Po '(?<="roots":\[).*?(?=\])' | grep -Po '(?<=").*?(?="?,)' | while read path; do watchman watch-del "$path"; done
You can’t perform that action at this time.