This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FRAME_COUNT = 5 | |
| class Frame | |
| PIN_COUNT = 10 | |
| def initialize(final_frame = false) | |
| @rolls = RollList.new | |
| @final_frame = final_frame | |
| reset_pins |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'csv' | |
| # ensure all classes have been laoded | |
| Rails.application.eager_load! | |
| def calc_callback_counts | |
| models = ApplicationRecord.descendants | |
| class_callback_counts = {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CALLBACKS = [ | |
| 'before_validation', | |
| 'after_validation', | |
| 'before_save', | |
| 'around_save', | |
| 'before_create', | |
| 'around_create', | |
| 'after_create', | |
| 'after_save', | |
| 'after_commit', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'octokit' | |
| require 'pp' | |
| def obtain_comment_stats | |
| # takes about a minute for 1 months of PRs | |
| stats = {} | |
| # sample_output = { | |
| # "kallin" => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| current_branch = `git symbolic-ref --short HEAD`.chomp | |
| if current_branch != "master" | |
| if $?.exitstatus == 0 | |
| puts "WARNING: You are on branch #{current_branch}, NOT master." | |
| else | |
| puts "WARNING: You are not on a branch" | |
| end | |
| puts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| current_branch = `git symbolic-ref --short HEAD`.chomp | |
| if current_branch != "master" | |
| if $?.exitstatus == 0 | |
| puts "WARNING: You are on branch #{current_branch}, NOT master." | |
| else | |
| puts "WARNING: You are not on a branch" | |
| end | |
| puts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def num_to_digits(num) | |
| digits = [] | |
| until num == 0 | |
| digits << num % 10 | |
| num = num / 10 | |
| end | |
| digits |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def find_descendants(person) | |
| descendants = [] | |
| stack = person[:children] | |
| until stack.empty? | |
| current_node = stack.pop | |
| children = current_node[:children] | |
| if children | |
| children.each do |child| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def find_descendants(person) | |
| descendants = [] | |
| children = person[:children] | |
| if children | |
| descendants << children | |
| children.each do |child| | |
| descendants << find_descendants(child) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Vegetable | |
| attr_accessor [ | |
| :rarity | |
| ] | |
| def ferment | |
| # let's make some vegetable jam! | |
| end | |
NewerOlder