Skip to content

Instantly share code, notes, and snippets.

@mckeed
mckeed / pre-commit
Last active January 24, 2025 17:47
Run rubocop on only staged files in git pre-commit
#!/bin/sh
STAGED_FILES=$(git diff-index HEAD --name-only --cached)
if [[ -z $STAGED_FILES ]]
then
exit # no staged files, no need to run rubocop
fi
# Checks if any staged files have unstaged changes
# otherwise rubocop isn't running on what is actually
@mabenson00
mabenson00 / cheatsheet.rb
Last active March 6, 2025 07:42
Rails Postgres ActiveRecord JSON cheatsheet
# Basic key operators to query the JSON objects :
# #> : Get the JSON object at that path (if you need to do something fancy)
# -> : Get the JSON object at that path (if you don't)
# ->> : Get the JSON object at that path as text
# {obj, n} : Get the nth item in that object
# https://www.postgresql.org/docs/9.4/functions-json.html#FUNCTIONS-JSONB-OP-TABLE
# Date
# date before today
@ty-porter
ty-porter / memory_killer.rb
Created May 18, 2021 17:27
Sidekiq/Heroku MemoryKiller middleware
# frozen_string_literal: true
require 'platform-api'
# Adapted from GitLab
#
# Docs: https://docs.gitlab.com/ee/administration/operations/sidekiq_memory_killer.html
# Source: https://gitlab.com/gitlab-org/gitlab-foss/-/blob/master/lib/gitlab/sidekiq_daemon/memory_killer.rb
class Sidekiq::Middleware::MemoryKiller
# Default the RSS limit to 0, meaning the MemoryKiller is disabled (kilobytes)
@codingjoe
codingjoe / Procfile
Created January 19, 2021 17:29
Sentry Release on Heroku w/ commits, sourmaps & assets
release: bin/release
web: ...
worker: ...
@qoomon
qoomon / conventional-commits-cheatsheet.md
Last active March 30, 2025 20:39
Conventional Commits Cheatsheet

Conventional Commit Messages starline

See how a minor change to your commit message style can make a difference.

Tip

Take a look at git-conventional-commits , a CLI util to ensure these conventions, determine version and generate changelogs

Commit Message Formats

Default

@denji
denji / http-benchmark.md
Last active March 27, 2025 19:46
HTTP(S) Benchmark Tools / Toolkit for testing/debugging HTTP(S) and restAPI (RESTful)