Skip to content

Instantly share code, notes, and snippets.

View quickshiftin's full-sized avatar

Nathan Nobbe quickshiftin

View GitHub Profile
@quickshiftin
quickshiftin / phplint.sh
Last active August 29, 2015 13:56
The lint utility you wish `php -l` was out of the box. Lint check multiple PHP files with a single command.
function php_lint
{
for arg in $(seq $#)
do
# Use find to iterate over directories recursively
if [ -d "${!arg}" ]; then
find "${!arg}" -name '*.php' -exec php -l "{}" ";"
# Just run normal files and symlinks through php -l individually
elif [ -f "${!arg}" -o -h "${!arg}" ]; then
php -l "${!arg}"
@quickshiftin
quickshiftin / mysqldbs.sh
Last active August 29, 2015 13:56
mysqldbs - Show all mysql databases for a given host (defaults to localhost) a given user can view with a simple Bash alias.
alias mysqldbs='_() { local h=""; if [ ! -z "$2" ]; then h="-h$2"; fi; echo "show databases;" | mysql -u "$1" "$h" -p; }; _'
@quickshiftin
quickshiftin / git-find-replace.sh
Last active August 29, 2015 13:56
Simple git find-&-replace utility (for use w/ GNU sed)
#--------------------------------------------------------
# Simple search and replace utility for git repositories.
# @note Use w/ GNU sed.
# (c) Nathan Nobbe 2014
# [email protected]
# http://quickshiftin.com
# $1 - Search
# $2 - Replace
# $3 - Subdirectory (optional, defaults to cwd)
#--------------------------------------------------------
@quickshiftin
quickshiftin / lastd.sh
Created February 10, 2014 19:35
BASH alias to get the last downloaded file on OSX
alias lastd='echo ~/Downloads/$(ls -t ~/Downloads/ | head -n 1)'
@quickshiftin
quickshiftin / git-transmit
Last active January 1, 2020 16:00 — forked from subtleGradient/git-transmit
Checkout this approach for knowing what to transfer. This revision uses a local tag to track each time you use the command. The first time you use it, it pushes all files in the project. At the end of each run it updates the tag to point to HEAD. Next time you run it, it will only push files that have changed since the last push.
#!/usr/bin/env bash
# author: Thomas Aylott SubtleGradient.com
# author: Nathan Nobbe quickshiftin.com
# Find out where HEAD is pointing
head_ref=$(git show-ref --head -s | head -n 1)
# Check to see if transmit tag exists, and get transmit tag hash
_transmit_ref=$(git show-ref --verify -s refs/tags/transmit)
# If there's not transmit tag, create it for the first time.