The arel_extensions gem has a couple of bugs...
DateSubdoesn't work:
(table[:column] - 10.hours).to_sql
# => NoMethodError: undefined method `to_sql' for nil:NilClass- For MySQL,
DateAddgenerates a double-minus when given a negative duration:
| # Examples | |
| # | |
| # MyModel.order(MyModel.arel_table[:name].asc.nulls_last) | |
| # MyModel.order(MyModel.arel_table[:name].desc.nulls_first) | |
| module Arel | |
| module NullOrder | |
| def nulls_last | |
| Arel::Nodes::NullsLast.new self | |
| end |
| #!/usr/bin/env ruby | |
| # Custom Psych parser that captures line number information from a YAML file. | |
| # | |
| # For a project I'm working on I need to be able to determine which line(s) in a YAML | |
| # file a particular value comes from. There are a few bits of advice on the internet | |
| # about this, the best of them that I've found involves monkey-patching, which is a | |
| # fairly low bar for "best" in my opinion. I found it on Stack Overflow: | |
| # | |
| # https://stackoverflow.com/questions/29462856/loading-yaml-with-line-number-for-each-key |
The arel_extensions gem has a couple of bugs...
DateSub doesn't work:(table[:column] - 10.hours).to_sql
# => NoMethodError: undefined method `to_sql' for nil:NilClassDateAdd generates a double-minus when given a negative duration:| # ########################################################################### | |
| # | |
| # Probes all model associations looking for ones with a scope that call | |
| # `with_deleted`. Lists all such associations, along with the location in | |
| # source that `with_deleted` is called. | |
| # | |
| # Usage: | |
| # | |
| # $ rails runner script/associations-using-with-deleted.rb | |
| # |
| #!/usr/bin/env sh | |
| # If you don't already have a pre-push hook in your working copy, simply copy | |
| # this into .git/hooks/pre-push in your working copy. If you already have a | |
| # pre-push hook, you'll have to integrate it with your existing hook. | |
| function current_branch { | |
| git rev-parse --abbrev-ref HEAD | |
| } |
A module for implementing the Service Object pattern that allows for custom "verbs".
Including CallMe in your class adds a call class method that instantiates an
object of the class using the provided arguments and invokes its call method.
For example:
| # frozen_string_literal: true | |
| require "active_support/all" | |
| require "optparse" | |
| module Options | |
| extend ActiveSupport::Concern | |
| included do | |
| delegate :arguments, :options, to: :Options |
A random list of tracks that comes up in the algorithmic feeds I listen to that I particularly like.
| Track | Artist | Country |
|---|---|---|
| [Gagarin] | [Public Service Broadcasting] | UK |
| [As I Went Out One Morning][dps-01] | [Dirty Projectors] | US |
| [Make The Road By Walking][msb-01] | [Menahan Street Band] | US |
| [Home][vs-01] | [Villagers] | Ireland |
| #!/usr/bin/env ruby | |
| # frozen_string_literal: true | |
| require "json" | |
| require "open3" | |
| require "pathname" | |
| require "tempfile" | |
| # Detects intermittent failures in an RSpec test suite and reports on varying | |
| # coverage. |