Skip to content

Instantly share code, notes, and snippets.

Christian Bankester cmbankester

Block or report user

Report or block cmbankester

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
cmbankester /
Created Apr 3, 2017
GitHub Verification for Keybase

Keybase proof

I hereby claim:

  • I am cmbankester on github.
  • I am cmbankester ( on keybase.
  • I have a public key ASCyTmwo_SDYj2aJwZ4mrlYFnknPoxzR4gkAndEh77DMqQo

To claim this, I am signing this object:

cmbankester / bug.rb
Last active Oct 5, 2016
Ruby file showing a potential bug with using scoped+argumented has_many :through in Rails 5
View bug.rb
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source ''
gem 'rack', github: 'rack/rack'
gem 'rails', github: 'rails/rails'
gem 'sqlite3'
system 'bundle'
cmbankester /
Last active Jan 8, 2016
Rails Validator for Uniqueness Among Records Unmarked for Destruction
class Foo < ActiveRecord::Base
  belongs_to :bar, inverse_of: :foos
  validates :some_attribute,
            unmarked_for_destruction_uniqueness: {
                parent: :bar
              , children: :foos
              # , message: "Some message"
cmbankester /
Last active Jan 5, 2016
Fish Shell Function Description Function
> ~ func-description func-description
Gets the description of a function> ~ 
cmbankester / homebrew.mxcl.nginx.plist
Last active Oct 18, 2019
NGINX startup on Mac OSX El Capitan
View homebrew.mxcl.nginx.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
cmbankester / desk.rb
Last active Nov 24, 2015
Desk Homebrew Installer
View desk.rb
class Desk < Formula
desc "Lightweight workspace manager for the shell"
homepage ""
url ""
sha256 "b687e2cfa742f763d689391f67a5b5225324e282a0fed100487b1570988d7758"
def install
bin.install "desk"



    • BR/NO/LA metal scene
      • Bands
      • Events
      • Blog?
cmbankester /
Created May 21, 2015
Filter fswatch events by type
# Usage:
# file-event-watch command-to-run path1 [path2, ...]
# TODO: Add fswatch event option to enable/disable different event types
$cmd && fswatch -0 -x -r $files | {
cmbankester /
Last active Jun 18, 2018
Sync a directory into a CoreOS node using the unison container
# add `export COREOS_DOCKER_HOST_IP=some-ip-address` to your .bashrc or .zshrc
function echo_usage_and_exit()
echo "Usage: coreos-sync local_path_to_sync remote_dir_to_sync_into [options]"
echo "Options:"
echo "\t-w\t\t(watches/resyncs on changes)"
echo "\t-v\t\t(enable verbose mode)"
View gist:6eaa6588f030fc9ae5ea
function scanRemove(cursor, prefix, count) {
return redis
.scan(cursor, 'MATCH', `${prefix}*`, 'COUNT', count)
.then(([cur, keys]) => redis.del(keys).then(() => Promise.resolve(cur)))
.then(cur => (cur !== 0 && cur !== '0') ? scanRemove(cur, prefix, count) : Promise.resolve());
function removeAllMatching(prefix, count=10) {
return scanRemove(0, prefix, count)
.catch(err => {throw new Error(`Scan-remove failed: ${err.message}`);});
You can’t perform that action at this time.