Skip to content

Instantly share code, notes, and snippets.

Avatar

Jared Beck jaredbeck

View GitHub Profile
View rubocop_issue_9946.rb
begin
# redacted = '13c7722bd7b3c830bea3dfbd89d447979b902335c5e517ffdba6ee091d01a1151a6c6d9609f6733a4a12116dd8bb88a0d20d62691ef3dc648393d492f6506e48e6946508783b94463d118113ae98a540a1dcb376b38751f1af8e95ddc70184b2b4d2f8844bf02de8a956b445d9c9fe886dd15c8a2b2e1c7bd2f3cc67b065f5383dca814898b5ead264adea9a88ed5accb31bd5654e2628e5958fe84bc2c79c12a9897d9b4820a81aac5999bc64c7edbbe592a52bf7c583efb9c26de9a11b42166e6fdbc527541278ff3861f0bd0c4a1c5b21d5e1d116b07def9ef8bb8b8b569b364d44edac389e936c8911541896308a9cb8e45e3406750edd35f6f8e804109042808a255f0f8660218e07c4374786ec5c32c9dab56bc0f7354852cf2acf6846bb6323ee7b488f68fb823b51dd819dc630d06569933839fc26acc4f8004387ff15e44090907dad8b5eef3ed8d0cbd3d03d6dfcf85494f67c61e34f055ef8af86c0244a8a6428168cf92e5fe7cd8215165dac197d944fdce3c71f61d0e83d98ea916bc0b8285c64b8590db7907af0bc302995b3669da2e05c13a8a4ce2bfaf431a43d8c0d719d049f012923e027128ab45e0a72d00e92096d4b5414599068ed665d1baf52fb283aeee06d0f67b35d2e4b766d0f0557d6150170fa9a16fe42af914ff696ab701034fde7bd9d944f0c3c3ccc18020ba9
@jaredbeck
jaredbeck / delete_branches_interactively.sh
Last active Jun 22, 2020
Loop over git branches, interactively inspecting/deleting them
View delete_branches_interactively.sh
#!/usr/bin/env bash
set -e
for BRANCH in $(git branch --format '%(refname:short)' | egrep -v '(master|dev)')
do
NEXT_BRANCH=false
until [ "$NEXT_BRANCH" = true ]
do
echo -e "\n$BRANCH"
@jaredbeck
jaredbeck / test.rb
Created May 13, 2020
Testing Authlogic PR 717
View test.rb
require 'bundler/setup'
require 'minitest'
require 'minitest/autorun'
# AR 6.0.2.2
module AR6022
def save(*args, &block)
{ args: args }
end
end
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