-
Reviewed How To Open a Homebrew Pull Request
a. Forked
codekitchen/homebrew-dinghy
on Github toms-ati/homebrew-dinghy
b. Changed to directory containing the Dinghy tap:
cd $(brew --repository codekitchen/dinghy)
c. Added my fork as a remote:
git remote add ms-ati https://github.com/ms-ati/homebrew-dinghy.git
d. Checked out the
master
branch:git checkout master
This file contains 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
gem "rb-inotify" | |
require 'rb-inotify' | |
gem "listen" | |
require "listen" | |
# BEGIN MONKEY PATCH OF LISTEN GEM | |
Listen::Adapter::Linux::DEFAULTS.tap do |defaults| | |
# Add :modify to the inotify events monitored by the Linux adapter | |
new_defaults = defaults.merge(events: defaults[:events] + [:modify]) |
This file contains 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
## | |
# Monkey-patch IRB in Ruby 2.3.4 to address the following Ruby issue: | |
# | |
# * https://bugs.ruby-lang.org/issues/14685 | |
# IRB doesn't print exception cause | |
## | |
# After loading this file, one should observe in an IRB session: | |
# | |
# * Printed exceptions contain the `#cause` | |
# In fact, this should work for a chain of `#cause` relationships |
This file contains 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 "benchmark/ips" | |
require "bigdecimal" | |
FLOATS = [1.35, 2.35, 3.35, 4.35, 5.35, 6.35, 7.35].freeze | |
STRINGS = ["1.4", "2.4", "3.4", "4.4", "5.4", "6.4", "7.4"].freeze | |
FULL = BigDecimal.double_fig | |
PART = 3 | |
def full_precision |
This file contains 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
# A queue that you can pass to IO.select. | |
# | |
# NOT THREAD SAFE: Only one thread should write; only one thread should read. | |
# | |
# Purpose: | |
# Allow easy integration of data-producing threads into event loops. The | |
# queue will be readable from select's perspective as long as there are | |
# objects in the queue. | |
# | |
# Implementation: |
This file contains 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
# frozen_string_literal: true | |
# | |
# What's the fast way to find a constant set of values in a ruby case statement? | |
# | |
require "benchmark/ips" | |
require "set" | |
# Provides a `===` operator for a Set | |
class SetCaseEq |
This file contains 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
# frozen_string_literal: true | |
# | |
# What's the fast way to choose "a" vs "an" English article in Ruby? | |
# | |
# Based on / inspired by: https://github.com/JuanitoFatas/fast-ruby/blob/master/code/string/start-string-checking-match-vs-start_with.rb | |
# See more at https://github.com/JuanitoFatas/fast-ruby | |
# | |
require 'benchmark/ips' |
This file contains 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 "benchmark/ips" # gem install benchmark-ips | |
require "values" | |
fields = [:a, :b, :c, :d, :e, :f, :g] | |
# Current code | |
a = Value.new(*fields) | |
# Code with optimized `#eql?` | |
b = Value.new(*fields) do |
This file contains 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
# Simple immutable value objects for ruby. | |
# | |
# @example Make a new value class: | |
# Point = Value.new(:x, :y) | |
# | |
# @example And use it: | |
# p = Point.new(1, 0) | |
# p.x | |
# #=> 1 | |
# p.y |
This file contains 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
# Workaround for https://github.com/ruby-concurrency/concurrent-ruby/issues/611 | |
# | |
# This approach works to *lazily* compose a chained future of | |
# sequential steps, where each step is a *zipped* future of a | |
# set of futures to execute in parallel at that step. | |
# | |
# Works with: | |
# | |
# gem install concurrent-ruby-edge -v 0.2.3.pre3 | |
# |
NewerOlder