Skip to content

Instantly share code, notes, and snippets.


Ernie Miller ernie

View GitHub Profile
ernie / venture.conf
Created Apr 21, 2016
Sample nginx config for a Venture ( server
View venture.conf
server {
listen 80;
return 301$request_uri;
server {
listen 443 ssl;
ernie / sanity-score
Last active Jul 18, 2020
Here's a little something to run in your Rails app's directory
View sanity-score
echo $(
find app/controllers -path app/controllers/concerns -prune -o -type f | wc -l
) / $((
$(egrep -r -l '<\s*ActiveRecord::Base' app/models | wc -l)
+ $(
[ -d app/models/concerns ] &&
find app/models/concerns -type f | wc -l
ernie / serialization.rb
Created May 29, 2015
Serialization issue with Rails and jsonb
View serialization.rb
#!/usr/bin/env ruby
gem 'activerecord'
gem 'minitest'
require 'active_record'
require 'minitest/autorun'
adapter: 'postgresql',
database: 'playground'
ernie / my_parser.rb
Created Dec 23, 2014
Experiments with non-HTML Kramdown Parser
View my_parser.rb
require 'kramdown'
require 'kramdown/parser'
module Kramdown
module Parser
class MyParser < GFM
def initialize(source, options)
View repo.rb
class PersonRepository < Norm::PostgreSQLRepository
def named(name)
select_records(select_statement.where(:name => name))
def select_statement'people')

Keybase proof

I hereby claim:

  • I am ernie on github.
  • I am ernie ( on keybase.
  • I have a public key whose fingerprint is DE33 68E0 9D43 082C 3145 78E8 4E8C 6B3F EC74 DCB2

To claim this, I am signing this object:

View .inputrc_vi_mode_changed
# ... some resources regarding escape sequences ...
# man console_codes
ernie / delegate.rb
Last active May 31, 2016
An alternate take on the delegation class macro provided by ActiveSupport. Updated with Ruby 2.0's caller_locations.
View delegate.rb
#!/usr/bin/env ruby
class Module
def delegate(*args)
dest, prefix = _extract_valid_delegation_options(args.pop)
_define_delegators(caller_locations.first, prefix, dest, args)
ernie / reorder.rb
Created Sep 6, 2013
So, I was in the process of writing this code today, and went on a wild goose chase due to this weird error message. I'd expected to see the nil come back from String#index, and give a different error, but no NilClass to be found in this error. String isn't even a type that String#index can return. It should only return a Fixnum or nil. Instead:…
View reorder.rb
#!/usr/bin/env ruby
require 'minitest/autorun'
class Reorder
def initialize(word, order)
@word, @order = word, order
ernie / dot_context.rb
Created May 14, 2013
Multistache! A multipass rendering example for Mustache.
View dot_context.rb
class DotContext < String
def initialize(val = '.')
val = '.' # Ensure we're always a dot
def to_s