Skip to content

Instantly share code, notes, and snippets.


Rob Cameron cannikin

Block or report user

Report or block cannikin

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
cannikin / epub_cover_fixer.rb
Created Mar 31, 2019
Fixes cover images for IDW's Transformers Humble Bundle epub:
View epub_cover_fixer.rb
# Fixes cover images in epub files
# Run this file wherever you want, just change the path in the last line to a directory containing all your epub files.
class EpubCoverFixer
class MetaTagNotFound < StandardError; end
attr_reader :starting_dir
def initialize(dir)
cannikin / rails_version.rb
Last active Feb 16, 2018
Two different forms of `include` in Ruby, only one of which works as expected
View rails_version.rb
class BustedInclude
include ActiveModel::Validations, ActiveModel::Validations::Callbacks
before_validation { puts 'Callback!' }
# outputs only `true`
instance =
class WorkingInclude
cannikin / email.txt
Created Jul 19, 2017
ComicCon 2017 Registration Email
View email.txt
Comic-Con 2017 Open Registration launches shortly after 9:00 AM Pacific Daylight Time (PDT) on April 8, 2017! Below you will find the link to the Expo Logic waiting room and your personal registration code. The waiting room will open at 8:00 AM PDT for registration code authorization. Comic-Con 2017 Open Registration will begin shortly after 9:00 AM PDT. The Expo Logic waiting room will close for entry at 9:00 AM PDT sharp.
Expo Logic Waiting Room:
Registration Code: JKRR6VZF246XNTL
Please click the link above to access the Expo Logic waiting room on April 8, 2017. You must authorize your registration code for entry prior to 9:00 AM PDT.
There is no need to rush to the landing page at 8:00 AM PDT! Attendees will be randomly selected for badge purchase. There is no advantage in arriving early. We suggest that you arrive 10 – 15 minutes before 9:00 AM PDT to avoid unnecessary waiting time.
View output.html
<div class="field">
<header class="field-header">
<label class="field-label" for="wnw_form_builder_test_model_name">
Name <small>(required)</small>
<div class="field-feedback">
<span class="field-errors"></span>
<span class="field-success"></span>
<span class="field-warning"></span>
cannikin / form.html.erb
Created Nov 16, 2016
Standardizing forms
View form.html.erb
<%# currently on signup form %>
<%= f.label :first_name, :class => 't2 medium mb3 block grow' do %>
First Name
<%= f.text_field :first_name, :class => 'field-text mt1', :placeholder => 'No need for formalities' %>
<% end %>
One potential custom form helper. How many of the classes that are set above
should be defaults?
View leia.rb
class Leia
@boyfriend = "Han Solo"
class << self
attr_reader :boyfriend
def boyfriend
cannikin / bug.rb
Last active Oct 6, 2016
PaperTrail accepts_nested_attributes_for bug
View bug.rb
# Use this template to report PaperTrail bugs.
# Please include only the minimum code necessary to reproduce your issue.
require "bundler/inline"
# STEP ONE: What versions are you using?
gemfile(true) do
ruby "2.3.1"
source ""
gem "activerecord", "5.0.0"
gem "minitest", "5.9.0"
View gist:0a0c10198bc0bf2c9fd46f05cd6bc7c3
"run_ruby_unit_command": "source /usr/local/opt/chruby/share/chruby/ && chruby `cat .ruby-version` && bundle exec ruby -Itest {relative_path}",
"run_single_ruby_unit_command": "source /usr/local/opt/chruby/share/chruby/ && chruby `cat .ruby-version` && bundle exec ruby -Itest {relative_path} -n '{test_name}'",
"run_rspec_command": "source /usr/local/opt/chruby/share/chruby/ && chruby `cat .ruby-version` && bin/rspec {relative_path}",
"run_single_rspec_command": "source /usr/local/opt/chruby/share/chruby/ && chruby `cat .ruby-version` && bin/rspec {relative_path}:{line_number}"

Consider this. Imagine there is an online dating site that works nearly perfectly. It was coded in a garage by a couple of college dropouts. You open an account, you answer some questions, and within three days it matches you with the love of your life. It is amazing!

It is so amazing that it attracts investors. The garage becomes an office. Now the coders are surrounded by men in suits. Now the service that was once free requires a subscription; now the terms of service are quietly altered, and the data the site gathers is sold to corporations that do who knows what with it. Money changes everything!

You can’t perform that action at this time.