Skip to content

Instantly share code, notes, and snippets.

View jbonhag's full-sized avatar
🛷

Jeff Bonhag jbonhag

🛷
  • America/New_York
View GitHub Profile
@jbonhag
jbonhag / serializer_explanation.md
Created February 23, 2026 21:54
ProjectSerializer: Fix count attributes with empty maps (.key? vs .present?)

ProjectSerializer Count Attribute Fix

Problem

Empty hash {} is not .present? in Rails, causing count attributes to be excluded even when the controller intends to include them.

{}.present?  # => false ❌

Solution

@jbonhag
jbonhag / projects_perf_optimization.diff
Created February 23, 2026 21:26
ProjectsController#index performance optimizations
diff --git i/app/controllers/api/v2/projects_controller.rb w/app/controllers/api/v2/projects_controller.rb
index a115f3ff925..c3873506539 100644
--- i/app/controllers/api/v2/projects_controller.rb
+++ w/app/controllers/api/v2/projects_controller.rb
@@ -39,9 +39,11 @@ module Api
@projects = @projects.search(q)
end
- # Eager load effective tags because the serializer makes use of their existence
- # It's also possible that they are sideloaded using the include query param

Keybase proof

I hereby claim:

  • I am jbonhag on github.
  • I am jbonhag (https://keybase.io/jbonhag) on keybase.
  • I have a public key ASClg7xhuZMkwhYnFqm7QwUBoVVmE1JQMJeDmnsdRYHkpgo

To claim this, I am signing this object:

variable "bucket_name"
description = "Name of the s3 bucket. Must be unique."
type = string
}
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
https://www.youtube.com/watch?v=GEU-BTDQw-8 https://www.youtube.com/watch?v=CXL4qi85Q2k
https://www.youtube.com/watch?v=AzylZnJrjok https://www.youtube.com/watch?v=MfRIObAzKks
https://www.youtube.com/watch?v=7_ayJQNOUqI https://www.youtube.com/watch?v=Cab6nOWZUQA
https://www.youtube.com/watch?v=7z103k7LjVc https://www.youtube.com/watch?v=9M96V5HwFYI
https://www.youtube.com/watch?v=L9JjUScyits https://www.youtube.com/watch?v=rMqJ0bGJ454
https://www.youtube.com/watch?v=8IrXqqYG_QI https://www.youtube.com/watch?v=5Hm8wbG5-C4
https://www.youtube.com/watch?v=YhrwNmFGzEY https://www.youtube.com/watch?v=vVc12xutJok
https://www.youtube.com/watch?v=AEWKGyUjSto https://www.youtube.com/watch?v=rMqJ0bGJ454
https://www.youtube.com/watch?v=QVrn_HEhNW8 https://www.youtube.com/watch?v=VtFJiyWtNcU
https://www.youtube.com/watch?v=SwGkdrSbdPg https://www.youtube.com/watch?v=lXCsUOKIkkc
@jbonhag
jbonhag / sshd_config
Last active January 30, 2020 17:58
Windows sshd_config with administrators_authorized_keys removed and logging turned up
# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.
# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options override the
# default value.
#Port 22
#AddressFamily any
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.network "private_network", ip: "172.17.0.19"
config.vm.synced_folder "/Volumes/Development", "/home/vagrant/Development", type: "nfs"
end
cd beck1994-01-26.shnf
shnjoin *.shn
lame --preset insane joined.wav beck1994-01-26.mp3
rm joined.wav
to getDocumentName()
tell application "Safari"
return name of document 1 as text
end tell
end getDocumentName
to getDocumentBody()
tell application "Safari"
return source of document 1 as text
end tell
@jbonhag
jbonhag / Makefile
Created January 2, 2017 01:22
Make a DVD from iPhone movies
all: clean dvd
dvd: dvd.iso
hdiutil burn dvd.iso
dvdauthor.xml:
echo "<dvdauthor>" > dvdauthor.xml
echo " <vmgm />" >> dvdauthor.xml
echo " <titleset>" >> dvdauthor.xml
echo " <titles>" >> dvdauthor.xml