Skip to content

Instantly share code, notes, and snippets.

@mckeed
mckeed / pre-commit
Last active June 19, 2024 10:37
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
@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: ...