Skip to content

Instantly share code, notes, and snippets.

View agius's full-sized avatar
goat rodeo

Andrew Evans agius

goat rodeo
View GitHub Profile
agius /
Created October 20, 2017 17:26
Proof of identity on Keybase

Keybase proof

I hereby claim:

  • I am agius on github.
  • I am agius ( on keybase.
  • I have a public key ASCg_5QsCmV8z2ofsrvRmoaigJgOsgFcL4erYY4kzr7ViAo

To claim this, I am signing this object:

agius /
Last active July 7, 2017 19:17
Learning Elixir: Key-Value Server
layout title
A stateful key/value server in Elixir

I wanted to make a simple key-value server in Elixir - json in, json out, GET, POST, with an in-memory map. The point is to reinvent the wheel, and learn me some Elixir. My questions were: a) how do I build this without Phoenix and b) how do I persist state between requests in a functional language?

Learning new stuff is always painful, so this was frustrating at points and harder than I expected. But I want to emphasize that I did get it working, and do understand a lot more about how Elixir does things - the community posts and extensive documentation were great, and I didn't have to bug anyone on StackOverflow or IRC or anything to figure all this out.

Here's what the learning & development process sounded like from inside my head.

agius / planckjs.rb
Created January 12, 2016 19:03
Scan your node_modules directory and report on how many Planck-scale JS libraries you have
PlanckJS - or: why the FUCK do you have 700+ dependencies?
Planck-scale libraries are not just microlibraries, they're even BETTER! They're so micro
they're beyond nanolibraries. They have _more boilerplate code than actual code!_ So composable.
Such Unix philosophy. Wow.
Back in my day, we called these things "functions" and put them in our code, rather than
descending into package-management hell with a broken tool like npm.
# Your init script
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
# An example hack to log to the console when each text editor is saved.
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
agius / my_controller.rb
Created April 18, 2015 01:32
Sometimes, controllers just suck. Time to extract.
class MyController < ApplicationController
def create
@model =
# we have to call this here, to populate
# errors on any other fields that might
# be invalid
if @model.model_attr == 'invalid' && !@model.in_state(:dont_care)
agius / Cheffile
Last active August 29, 2015 14:06 — forked from jkarmel/Cheffile
#!/usr/bin/env ruby
site ''
cookbook 'sprout-rbenv',
:github => 'pivotal-sprout/sprout-rbenv'
cookbook 'sprout-ruby',
:github => 'pivotal-sprout/sprout-ruby'
agius / deploy.log
Created August 27, 2014 23:02
Strange heroku deploy failure
This file has been truncated, but you can view the full file.
Fetching repository, done.
-----> Node.js app detected
PRO TIP: Specify a node version in package.json
-----> Defaulting to latest stable node: 0.10.31
-----> Downloading and installing node
-----> Exporting config vars to environment
agius / get_abbr.js
Last active August 29, 2015 14:03
Output timezone select in Rails with some data attrs for JS
var d = new Date();
var tz_offset = d.getTimezoneOffset(); // seconds, not ms, because Javascript
var tz_select = $('#tz-select');
var abbr = tz_select.find("option[data-offset='" + tz_offset + "']").data('abbreviation');
agius / find.rake
Created November 1, 2013 04:32
Find and replace rake task
namespace :find do
desc "Find and replace"
task :replace, :find, :replace do |t, args|
find = args[:find]
replace = args[:replace]
`egrep -lRZ "#{find}" --exclude-dir='.git' --exclude-dir='db' --exclude-dir='tmp' --exclude-dir='images' --exclude-dir='fonts' --exclude-dir='vendor' . | xargs -I {} sed -i '' -e 's/#{find}/#{replace}/g' {}`
agius / jekyll.rake
Created October 18, 2013 05:48
Generate static error pages and upload to S3
namespace :static do
desc "Generate and upload static pages"
task :generate do
`jekyll build -s jekyll -d jekyll/_site`
`cp -r jekyll/_site/* public/`
config = YAML.load(, '..', '..', 'config', 'keys.yml')))
config = config['production']['amazon']
AWS.config(:access_key_id => config['key'], :secret_access_key => config['secret'])
s3 =