Skip to content

Instantly share code, notes, and snippets.

Here's something I spent a long time debugging, so I'm making this gist to help others find the solution when searching.

Summary

postgres 12 on MacOS will cause crashes when forking. The solution is to do one of these two things:

  • add gssencmode: "disable" to database.yml
  • if using homebrew: uninstall postgres, update homebrew, reinstall postgres

Here's some discussion:

test results for https://github.com/puma/puma/pull/2228
run 1 - nothing
273.3 MB
27.4 MB
27.3 MB
27.3 MB
27.3 MB
27.3 MB
lines = `find . -name '*.rb'`.split("\n")
problems = []
lines.each_slice(100) do |slice|
threads = []
slice.each do |l|
threads << Thread.new do
result = `ruby -c #{l}`
if "Syntax OK" == result.strip
print "."
class GraphqlController < ApplicationController
def create
ScoutApm::Transaction.rename("Graphql/" + params["_json"].first["operationName"])
# https://github.com/my-company/my-project/branches/stale?page=7
buttons = document.getElementsByClassName("js-branch-delete-target text-red");
for(var i = 0; i < buttons.length; i++)
buttons[i].click();
@jjb
jjb / concat.rb
Last active March 8, 2019 19:10
Ruby String Interpolation vs. Concatenation performance benchmark
t = Time.now
a = []
10_000_000.times do
a << "a" + " " + "b"
end
puts Time.now.to_f - t.to_f

5.0, no id specified

class SerialIdTest < ActiveRecord::Migration[5.0]
  def change
    create_table "test" do |t|
      t.integer "foo_id"
      t.string "foo_role"
    end
  end

alert shell function

I keep mine in .zshrc. It could probably also be a standalone script named "alert" with chmod 755 (i think?) in ~/bin

# examples:
#   git push heroku master ; alert
#   bundle install ; alert
function alert {
  if (( $? == 0 )) then
@jjb
jjb / file.md
Created February 4, 2018 16:27
Active Record Connection Management in Rails 5.1 or lower