Skip to content

Instantly share code, notes, and snippets.


Jared Beck jaredbeck

View GitHub Profile
View duplicate_columns.rb
require 'benchmark'
require 'matrix'
v1 = [1, 1, 1, 1]
v2 = [2, 3, 2, 3]
v3 = [1, 1, 1, 1 ]
def sol_1(a,b,c)
sum = 0
zip =, c)
View rubocop_issue_9946.rb
# redacted = '13c7722bd7b3c830bea3dfbd89d447979b902335c5e517ffdba6ee091d01a1151a6c6d9609f6733a4a12116dd8bb88a0d20d62691ef3dc648393d492f6506e48e6946508783b94463d118113ae98a540a1dcb376b38751f1af8e95ddc70184b2b4d2f8844bf02de8a956b445d9c9fe886dd15c8a2b2e1c7bd2f3cc67b065f5383dca814898b5ead264adea9a88ed5accb31bd5654e2628e5958fe84bc2c79c12a9897d9b4820a81aac5999bc64c7edbbe592a52bf7c583efb9c26de9a11b42166e6fdbc527541278ff3861f0bd0c4a1c5b21d5e1d116b07def9ef8bb8b8b569b364d44edac389e936c8911541896308a9cb8e45e3406750edd35f6f8e804109042808a255f0f8660218e07c4374786ec5c32c9dab56bc0f7354852cf2acf6846bb6323ee7b488f68fb823b51dd819dc630d06569933839fc26acc4f8004387ff15e44090907dad8b5eef3ed8d0cbd3d03d6dfcf85494f67c61e34f055ef8af86c0244a8a6428168cf92e5fe7cd8215165dac197d944fdce3c71f61d0e83d98ea916bc0b8285c64b8590db7907af0bc302995b3669da2e05c13a8a4ce2bfaf431a43d8c0d719d049f012923e027128ab45e0a72d00e92096d4b5414599068ed665d1baf52fb283aeee06d0f67b35d2e4b766d0f0557d6150170fa9a16fe42af914ff696ab701034fde7bd9d944f0c3c3ccc18020ba9
jaredbeck /
Last active Jun 22, 2020
Loop over git branches, interactively inspecting/deleting them
#!/usr/bin/env bash
set -e
for BRANCH in $(git branch --format '%(refname:short)' | egrep -v '(master|dev)')
until [ "$NEXT_BRANCH" = true ]
echo -e "\n$BRANCH"
jaredbeck / test.rb
Created May 13, 2020
Testing Authlogic PR 717
View test.rb
require 'bundler/setup'
require 'minitest'
require 'minitest/autorun'
# AR
module AR6022
def save(*args, &block)
{ args: args }
View rails_issue_33429.rb
# frozen_string_literal: true
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
gemfile(true) do
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: ' +; end; end
class Apple < Fruit; def eat; puts 'ate apple'; end; end
class Banana < Fruit; end
class Eater
extend T::Sig
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 ""
gem "cancancan", "3.0.0"
gem "rails", "5.2.3"
gem "sqlite3"

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
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 ''
gem 'capybara'
gem 'faraday'