Skip to content

Instantly share code, notes, and snippets.

View mradbourne's full-sized avatar

Matt Radbourne mradbourne

View GitHub Profile
@mradbourne
mradbourne / multi-selector-messages.feature
Last active September 25, 2023 10:17
MF2 tests as Gherkin
Feature: Multiple selectors
Background:
Given the username is "Matt"
And the source is:
"""
match {$photoCount :number} {$userGender :equals}
when 1 masculine {{$userName} added a new photo to his album.}
when 1 feminine {{$userName} added a new photo to her album.}
when 1 * {{$userName} added a new photo to their album.}
@mradbourne
mradbourne / config
Created September 15, 2022 11:59
Git config alias for pushing a branch and automatically setting the upstream
# Set tracking information for the current branch and push it
push-and-set-upstream = !git push --set-upstream origin $(git symbolic-ref --short HEAD)
# Usage:
# % git push
# fatal: The current branch foo has no upstream branch.
# To push the current branch and set the remote as upstream, use
#
# git push --set-upstream origin foo
#
@mradbourne
mradbourne / kitty-for-alfred.applescript
Created August 27, 2022 19:17
Run terminal commands in kitty using Alfred
# Paste this into Alfred Preferences > Features > Terminal > Application: Custom
on alfred_script(q)
tell application "kitty" to activate
tell application "System Events" to keystroke q
tell application "System Events"
key code 36 -- enter key
end tell
end alfred_script
@mradbourne
mradbourne / delete_git_submodule.md
Created October 24, 2018 13:36 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@mradbourne
mradbourne / old_homebrew.sh
Last active November 29, 2018 11:53
Install old homebrew package
# Install old homebrew package
brew uninstall ImageMagick
gem uninstall rmagick
# Second, please see https://github.com/rmagick/rmagick/issues/256 and read the answer by hristozov, viz:
brew rm imagemagick
cd "$(brew --prefix)/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/"
git checkout 6f014f2b7f1f9e618fd5c0ae9c93befea671f8be imagemagick.rb
brew install imagemagick
@mradbourne
mradbourne / .eslintrc
Created November 26, 2016 14:42
My ESLint preferences
{
"parser": "babel-eslint",
"extends": "airbnb",
"env": {
"browser": true,
"node": true,
"mocha": true,
"es6": true
},
"plugins": [
@mradbourne
mradbourne / settings.json
Last active December 7, 2016 10:41
VS Code user settings
{
"editor.fontSize": 14,
"editor.fontFamily": "Monaco",
"editor.renderWhitespace": "boundary",
"editor.rulers": [80],
"editor.tabSize": 2,
"editor.wordWrap": true,
"files.associations": {
"*.css": "scss",
"*.js": "javascriptreact"
@mradbourne
mradbourne / keybindings.json
Created November 21, 2016 17:35
VS Code keyboard shortcuts
[
{
"key": "shift+cmd+d",
"command": "editor.action.copyLinesDownAction"
},
{
"key": "cmd+l",
"command": "expandLineSelection"
},
@mradbourne
mradbourne / ffmpeg-presets.sh
Last active September 29, 2016 15:37
FFMPEG presets
# WebM - Standard web video quality
ffmpeg -i input_file.mov -codec:v libvpx -quality good -cpu-used 0 -b:v 600k -maxrate 600k -bufsize 1200k -qmin 10 -qmax 42 -vf scale=-1:480 -threads 4 -codec:a libvorbis -b:a 128k output_file.webm
# H.264 - Standard web video quality
ffmpeg -i input_file.avi -codec:v libx264 -profile: high -preset slow -b:v 500k -maxrate 500k -bufsize 1000k -vf scale=-1:480 -threads 0 -codec:a libfdk_aac -b:a 128k output_file.mp4
@mradbourne
mradbourne / Common Terminal commands.sh
Last active July 30, 2018 17:06
Common Terminal commands
# See what's running on port 5000
lsof -i :5000
# Find Foreman processes
ps aux | grep foreman
# Kill process
kill -9 PID
# PostgreSQL - Restore DB from dump