Skip to content

Instantly share code, notes, and snippets.

Jared Beck jaredbeck

Block or report user

Report or block jaredbeck

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
View rails_issue_33429.rb
# frozen_string_literal: true
begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
end
gemfile(true) do
@jaredbeck
jaredbeck / sorbet_polymorphism.rb
Last active Jun 25, 2019
Three Examples of Polymorphism under the Reign of Sorbet
View sorbet_polymorphism.rb
# typed: true
require 'sorbet-runtime'
# Example 1: Polymorphism by Classical Inheritance
class Fruit; def eat; puts('ate fruit: ' + self.class.name.to_s); end; end
class Apple < Fruit; def eat; puts 'ate apple'; end; end
class Banana < Fruit; end
class Eater
extend T::Sig
@jaredbeck
jaredbeck / symbol_to_proc_test.rb
Created Apr 15, 2019
Regression in cancan 3.0.0: ArgumentError using symbol-to-proc
View symbol_to_proc_test.rb
# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
gem "cancancan", "3.0.0"
gem "rails", "5.2.3"
gem "sqlite3"
end
View bash_git_cheatsheet.md

Prompt Structure

By default, the general appearance of the prompt is::

(<branch> <upstream branch> <branch tracking>|<local status>)

The symbols are as follows:

  • Local Status Symbols
View gist:2a7a05a268235fbfecf95a46f1886797
# 512
Authentication .. no longer possible without using Strong Parameters
https://github.com/binarylogic/authlogic/issues/512
Closed by #558, which deprecates passing AC::Parameters to authlogic. Going
forward, perform the necessary permit, and pass a plain Hash to authlogic.
# 558
View gist:7e8ec4213c72bb3742ae83f99c211342
#!/usr/bin/env ruby
require 'bundler/inline'
gemfile(true) do
ruby '2.4.2'
source 'https://rubygems.org'
gem 'capybara'
gem 'faraday'
end
View pt_issue_594_fixed.rb
# https://github.com/airblade/paper_trail/issues/594
# Use this template to report PaperTrail bugs.
# It is based on the ActiveRecord template.
# https://github.com/rails/rails/blob/master/guides/bug_report_templates/active_record_gem.rb
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
@jaredbeck
jaredbeck / route_diff.rb
Created Oct 10, 2017
A better way to diff the before/after output of rake routes
View route_diff.rb
#!/usr/bin/env ruby
# frozen_string_literal: true
# Usage:
#
# ```
# bin/rake routes > tmp/routes_before
# # edit routes.rb
# bin/rake routes > tmp/routes_after
# bin/dev/route_diff.rb tmp/routes_before tmp/routes_after
View ccc_pr_427.rb
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
gem 'rails', '5.1.0' # use correct rails version
View abcd.sql
drop table if exists d;
drop table if exists c;
drop table if exists b;
drop table if exists a;
create table a (
id int not null auto_increment,
primary key (id)
);
You can’t perform that action at this time.