Skip to content

Instantly share code, notes, and snippets.

View cannikin's full-sized avatar
🔨
Woodworking

Rob Cameron cannikin

🔨
Woodworking
View GitHub Profile
diff --git a/yarn.lock b/yarn.lock
index e8c899e..0592224 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -907,7 +907,7 @@
pirates "^4.0.0"
source-map-support "^0.5.16"
-"@babel/runtime-corejs3@^7.8.3", "@babel/runtime-corejs3@^7.8.4":
+"@babel/runtime-corejs3@^7.7.4", "@babel/runtime-corejs3@^7.8.3", "@babel/runtime-corejs3@^7.8.4":
@cannikin
cannikin / epub_cover_fixer.rb
Created March 31, 2019 18:08
Fixes cover images for IDW's Transformers Humble Bundle epub: https://www.humblebundle.com/books/transformers-2019-idw-books
# 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
cannikin / rails_version.rb
Last active February 16, 2018 19:10
Two different forms of `include` in Ruby, only one of which works as expected
class BustedInclude
include ActiveModel::Validations, ActiveModel::Validations::Callbacks
before_validation { puts 'Callback!' }
end
# outputs only `true`
instance = BustedInclude.new
instance.valid?
class WorkingInclude
@cannikin
cannikin / email.txt
Created July 19, 2017 02:06
ComicCon 2017 Registration Email
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: http://oorel17cci.cloudapp.net/
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.
This file has been truncated, but you can view the full file.
#<ActionDispatch::Request::Session:0x007fd9f3829810 @by=#<ActionDispatch::Session::CookieStore:0x007fd9eea64d78 @app=#<MessageBus::Rack::Middleware:0x007fd9ef811430 @app=#<Rack::Head:0x007fd9ef811458 @app=#<Rack::ConditionalGet:0x007fd9ef811480 @app=#<Rack::ETag:0x007fd9ef8114a8 @app=#<OmniAuth::Builder:0x007fd9ef8121c8 @options=nil, @warmup=nil, @run=#<ActionDispatch::Routing::RouteSet:0x007fd9ee963d48>, @map=nil, @use=[#<Proc:0x007fd9ef811d90@/Users/rob/.gem/ruby/2.4.1/gems/rack-2.0.1/lib/rack/builder.rb:86>, #<Proc:0x007fd9ef811a20@/Users/rob/.gem/ruby/2.4.1/gems/rack-2.0.1/lib/rack/builder.rb:86>, #<Proc:0x007fd9ef8116b0@/Users/rob/.gem/ruby/2.4.1/gems/rack-2.0.1/lib/rack/builder.rb:86>, #<Proc:0x007fd9ef8114d0@/Users/rob/.gem/ruby/2.4.1/gems/rack-2.0.1/lib/rack/builder.rb:86>]>, @cache_control="max-age=0, private, must-revalidate", @no_cache_control="no-cache">>>, @bus=MessageBus, @connection_manager=#<MessageBus::ConnectionManager:0x007fd9ef8113e0 @clients={}, @subscriptions={}, @bus=MessageBus, @mon_ow
<div class="field">
<header class="field-header">
<label class="field-label" for="wnw_form_builder_test_model_name">
Name <small>(required)</small>
</label>
</header>
<div class="field-feedback">
<span class="field-errors"></span>
<span class="field-success"></span>
<span class="field-warning"></span>
@cannikin
cannikin / form.html.erb
Created November 16, 2016 19:53
Standardizing forms
<%# 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?
%>
@cannikin
cannikin / leia.rb
Last active October 27, 2016 16:07
class Leia
@boyfriend = "Han Solo"
class << self
attr_reader :boyfriend
end
def boyfriend
self.class.boyfriend
@cannikin
cannikin / bug.rb
Last active October 6, 2016 19:07
PaperTrail accepts_nested_attributes_for bug
# 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 "https://rubygems.org"
gem "activerecord", "5.0.0"
gem "minitest", "5.9.0"
@cannikin
cannikin / gist:0a0c10198bc0bf2c9fd46f05cd6bc7c3
Created September 21, 2016 20:46
RubyTest.sublime-settings
{
"run_ruby_unit_command": "source /usr/local/opt/chruby/share/chruby/chruby.sh && chruby `cat .ruby-version` && bundle exec ruby -Itest {relative_path}",
"run_single_ruby_unit_command": "source /usr/local/opt/chruby/share/chruby/chruby.sh && chruby `cat .ruby-version` && bundle exec ruby -Itest {relative_path} -n '{test_name}'",
"run_rspec_command": "source /usr/local/opt/chruby/share/chruby/chruby.sh && chruby `cat .ruby-version` && bin/rspec {relative_path}",
"run_single_rspec_command": "source /usr/local/opt/chruby/share/chruby/chruby.sh && chruby `cat .ruby-version` && bin/rspec {relative_path}:{line_number}"
}