Skip to content

Instantly share code, notes, and snippets.


Keybase proof

I hereby claim:

  • I am redconfetti on github.
  • I am redconfetti ( on keybase.
  • I have a public key ASAzmSErVw9jGPNYkpArJ0XNRecBxcnAxmPoQ6V42oM7Ago

To claim this, I am signing this object:

View topsters2.2019-05-23T03_49_18.json
"background": "#000",
"cards": "\"eJztWFtvG8cV/isD9SEpEEtzv+RNlzoOYkmGpThAjTycmTlDTrncZXeXltiif6t/oH+sZ2UbCZZoYKzeCkOgtFyQOmfO5bvs+3+eDH06+f5kPY674fuzswaGsWxf1O1KnsIGtlD/gfm0xfGsnu3PFOeP9DoTPAEabzmoKHPMWFKRUhcjtU8ymNNduzr57mSsY4P0z+/XyO62MKxru2Jv9tvdprYDe8GusWm6ll12TVORQZvZSJ/8sS21rSN9BXKLw8C+vYKHlo0du9oPmz+f/Ou7ZUmH4jlopxI6pQua6EqwBnjKRipI7guT/iv23eIclNbGKe+tVVZn50KOVqmQhEGVveRfmMNdhS0OyK56hO3iZCAIHaDoZG02MRh6awtKE5ROUmg1S+Ya+tocWnYN7UBdm9qX1tDWBA07b+sWmoG9v353ef9Caq7sr4vzsjJLm2yKGpKOOaXoiwIJvGRjtBSzvN5Crt0aIVNKtz/RNG13+xH7xeELF1iCsyK6pF0EH2x0DoNRnuoDct6jQ1p3FPqqfsDFMUVUUuQMnFtdlMpGcAAnvFAcrCj+f8Q8f4DN8qDaJQk5BVoGp61TUHKUTkr0WSHaNAtKhWX3/b7S3L1gP0ADaaxp2uFxcQYmFxVEMjl5rbmUwQaMBmzKXKQUwnwC94/suuuaaQM2+6YZKcjy4ycbtZAyRiq8toggFVpN4CAcooxlFvzib//5d7+h0K+6bbdCmvvFkX0BdMHTmkWKLrTTKRdTlE1OY1TzyDe1nVAxrdkN1Gba/wkXXvawqs3y48ucdMYcUZSgtUheySQtJsejcVznL0riqntoH6DP7G5Xe2iWr7xRUhEe0pYTCImSrEEawRKpOMGleTI/QH9gN/sttOyM3e8jPsCBnffbA6X1FncNYRLRxlvcTgPSY15OGq6AwTKx3DSg0WpL40KwHQrhQyx/kNjHAr1pEIZ9Txd9bV
redconfetti / grading.rb
Created Apr 9, 2019
Grading Model Example
View grading.rb
module EdoOracle
module UserCourses
class Grading
:grade, :grading_basis, :grade_points, :grade_points_adjusted, :include_in_gpa
attr_accessor *PROPERTY_KEYS
def initialize(section_data = {})
@grade = section_data['grade'].try(:strip)
redconfetti / main.rb
Created Aug 31, 2018
Enumerable.find - Hash and Key and Value Match
View main.rb
# It does work
my_hash = {a: 1, b: 2, c: 3, d: 4, e: 5}
my_hash.find {|k,v| puts "k:#{k},v:#{v}"; v == 3}
# Output:
# k:a,v:1
# k:b,v:2
# k:c,v:3
# => [:c, 3]
redconfetti / Vagrantfile
Last active Mar 16, 2018
Attempted approach to setup a local vagrant environment
View Vagrantfile
$setup_travis = <<SCRIPT
sudo su - travis
ssh-keygen -t rsa -b 4096 -C "" -f /home/travis/.ssh/id_rsa -P lala4321
eval "$(ssh-agent -s)"
rvm install 2.5.0
rvm use 2.5.0
cd builds
git clone
cd travis-build
View bash_profile
# Less Colors for Man Pages
# Makes 'man' pages less manly
export LESS_TERMCAP_mb=$'\e[01;31m' # begin blinking
export LESS_TERMCAP_md=$'\e[01;35;5;74m' # begin bold
export LESS_TERMCAP_me=$'\e[0m' # end mode
export LESS_TERMCAP_se=$'\e[0m' # end standout-mode
export LESS_TERMCAP_so=$'\e[35;5;246m' # begin standout-mode - info box
export LESS_TERMCAP_ue=$'\e[0m' # end underline
export LESS_TERMCAP_us=$'\e[04;35;5;146m' # begin underline
redconfetti /
Created Mar 14, 2017
Migrating from Homebrew installed Postgres 9.5 to 9.6.2

Migrating from Postgres 9.5 to 9.6.2

These instructions are for those using Mac OSX with PostgreSQL installed via Homebrew.

These instructions are for those that have recently run brew upgrade, resulting in the upgrade of PostgreSQL 9.5 to 9.6.2. These instructions are based on the pg_upgrade documentation.

If you check your log file like so, and see the following errors, a scripted solution is below.

$ tail -F /usr/local/var/log/postgres.log
redconfetti / constants-not-overridden.rb
Last active Mar 18, 2016
Constants in super classes not overridden by child classes
View constants-not-overridden.rb
# It appears that a base class method refers to the constant value in that method
# instead of the constant value declared in child classes.
# You have to use a method to provide the expected behavior.
class BaseClass
def self.shared_processor
child_processor(COLUMNS + ['column1'])
redconfetti / super-class-method.rb
Last active Mar 18, 2016
Using super with class and instance methods
View super-class-method.rb
# Testing to see how 'super' method works with class and instance methods
# when passing pre-declared variables into the methods where I am expecting them to be modified
# Results noted provided by jruby-1.7.19
class SuperClass
def self.add_something(somehash)
somehash['something'] += 1
def add_something(somehash)
somehash['something'] += 5
View powerball.rb
picks = []
balls = (1..69).to_a
5.times do
picks << balls.sample
powerball = (1..26).to_a.sample
puts "picks: #{picks.join(', ')} - powerball: #{powerball}"[
You can’t perform that action at this time.