Service | Handle |
---|---|
Bluesky | johncarney.dev |
Mastodon | johncarneyau |
johncarneyau | |
Hive | johncarney |
Post | johncarney |
Flickr | johncarney |
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
# frozen_string_literal: true | |
module PresenceRefinements | |
refine Object do | |
def blank? = (respond_to?(:empty?) ? !!empty? : !self) | |
def present? = !blank? | |
def presence = (self if present?) | |
end | |
# This bit is cribbed from https://github.com/rpanachi/core_ext |
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
#!/bin/sh | |
# Passes all changed and added files on the current branch to RuboCop before pushing. Paste the below into your | |
# .bin/hooks/pre-push file, which should be made executable. | |
# Note that it assumes that your trunk branch is named "main." If this is not the case, make the appropriate adjustment. | |
TRUNK_BRANCH=main | |
CURRENT_BRANCH="$(git branch --show-current)" | |
if [ "$CURRENT_BRANCH" != "$TRUNK_BRANCH" ]; then | |
rubocop $(git diff --name-status "$TRUNK_BRANCH" "$CURRENT_BRANCH" | egrep '^[AM]' | cut -f 2 | egrep '(^Gemfile|.rb)$') |
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 | |
# 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. |
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 |
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
# frozen_string_literal: true | |
require "active_support/all" | |
require "optparse" | |
module Options | |
extend ActiveSupport::Concern | |
included do | |
delegate :arguments, :options, to: :Options |
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:
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 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 | |
} |
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
# ########################################################################### | |
# | |
# 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 | |
# |
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:NilClass
- For MySQL,
DateAdd
generates a double-minus when given a negative duration:
NewerOlder