Skip to content

Instantly share code, notes, and snippets.

View cannikin's full-sized avatar
🔨
Woodworking

Rob Cameron cannikin

🔨
Woodworking
View GitHub Profile
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}"
}
# app/views/posts/show.html.erb
<article id="post-<%= @post.id %>" class="post">
<h1><%= @post.title %></h1>
<%= @post.body %>
<small><%= @post.author %></small>
<section class="comments">
<h2>Comments</h2>
<%= render @post.comments %>
</section>
</article>

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!

@cannikin
cannikin / gist:de18c08eab69e03da44ae8faf7388e60
Created April 18, 2016 17:51
Ruby Sublime style settings
{
"binary_file_patterns":
[
"log/",
"tmp/"
],
"ensure_newline_at_eof_on_save": true,
"rulers":
[
80
@cannikin
cannikin / Packages\User\RubyTest-Twilight.tmTheme
Last active December 8, 2015 18:15
Sublime Text Settings
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>TestConsoleTheme</string>
<key>settings</key>
<array>
<dict>
<key>settings</key>