Skip to content

Instantly share code, notes, and snippets.

View tadamcz's full-sized avatar

Tom Adamczewski tadamcz

View GitHub Profile
@tadamcz
tadamcz / diffocop.sh
Last active January 19, 2022 11:29
Execute Rubocop on all files that appear in the diff. Faster than rubocop on all files.
git diff origin/master --name-only --diff-filter=ACMRTUXB | grep "\.rb$" | tr "\n" " " | xargs bundle exec rubocop -A --force-exclusion
@tadamcz
tadamcz / jekyll_picture_tag_hook.rb
Last active October 20, 2022 20:25
Jekyll picture tag hook: automatic responsive images from pure markdown
# Jekyll plugin to replace Markdown image syntax with {% picture %} tag for crafting responsive images
# Adapted from https://gist.github.com/mmistakes/77c68fbb07731a456805a7b473f47841
# Use as a gem: https://github.com/tadamcz/jekyll-markdown-responsive-image
Jekyll::Hooks.register [:pages, :documents], :pre_render do |post, payload|
file_ext = post.extname.tr('.', '')
# This regex will match all of the following correctly:
#