-
{:x => y}
->{x: y}
Find Replace Comment :(\w+) =>
\1:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# this hook aborts commits which do not include a link to trello | |
INPUT_FILE=$1 | |
START_LINE=`head -n1 $INPUT_FILE` | |
PATTERN="https:\/\/trello\.com\/" | |
if ! [[ "$START_LINE" =~ $PATTERN ]]; then | |
echo "Commit messages should include a link to the related trello card." | |
echo "To override this check add the --no-verify flag " | |
exit 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# this hook aborts commits which contain invalid puppet syntax | |
errors=0 | |
# get all files in commit, use awk to get file name only, use grep to get puppet files only | |
files=$(git diff --cached --name-status | awk '$1 != "D" { print $2 }' | grep "\.pp") | |
# if you are committing .pp files | |
if [[ "$files" ]]; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add indent after access modifier e.g. private | |
Layout/IndentationConsistency: | |
EnforcedStyle: indented_internal_methods # previously rails style | |
# Use double quotes by default, common in large projects including rails | |
# https://anti-pattern.com/always-use-double-quoted-strings-in-ruby | |
Style/StringLiterals: | |
Enabled: true | |
EnforcedStyle: double_quotes | |
set -x
shows all commands in bash as they are run.
to stop showing commands, reload the shell e.g. exec $SHELL
set -x && echo "hi"
exec $SHELL
# # output (stdout)
# + echo hi
# hi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# show commits from all branches for current git user. | |
function my-commits-since() { | |
git log --all --author=$(git config user.email) --since=$@ | |
} | |
# show commits from yesterday. | |
# if none were found, assume it's Monday and show commits from Friday. | |
function standup() { | |
if [ -z "$(my-commits-since yesterday)" ]; then | |
my-commits-since last.friday.midnight $@; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# bash, find import in every .py file recursively under the current dir | |
grep -rin --include="*.py" import | |
# find files bye name and follow symlinks | |
find -L ./ -name "*.sublime-snippet" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# print the path to the latest screenshot | |
latest_screenshot() { | |
# get screenshot dir, replace ~ with $HOME (required for ls to work) | |
screenshot_dir=$(defaults read com.apple.screencapture location | sed "s;~;$HOME;") | |
# use ls -t to order by time, use head -n 1 to get only latest | |
file_name=$(/bin/ls -t $screenshot_dir | head -n 1) | |
# if REL is passed, show relative path (filename), otherwise show absolute path | |
if [[ -z "$REL" ]]; then | |
printf "%q\n" "$screenshot_dir/$file_name" | |
else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// example: https://jsfiddle.net/conorsheehan1/vqdfsh31/ | |
// runnable in any browser console | |
// fail (coworker showed me this one) | |
(![] + [])[+[]] + (![] + [])[+!+[]] + ([![]] + [][[]])[+!+[] + [+[]]] + (![] + [])[!+[] + !+[]]; | |
// Naff | |
((![] + [][[]]) + [])[+[]] + ((![] + [][[]]) + [])[+!+[]] + (![] + [])[+[]] + (![] + [])[+[]]; | |
// Nooo |
OlderNewer