Skip to content

Instantly share code, notes, and snippets.

Ian Young iangreenleaf

Block or report user

Report or block iangreenleaf

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:b206d09c587e8fc6399e

Rails naming conventions

General Ruby conventions

Class names are CamelCase.

Methods and variables are snake_case.

Methods with a ? suffix will return a boolean.

### Runs rsync, retrying on errors up to a maximum number of tries.
### Simply edit the rsync line in the script to whatever parameters you need.
# Trap interrupts and exit instead of continuing the loop
trap "echo Exited!; exit;" SIGINT SIGTERM
iangreenleaf / yaml.vim
Created Mar 15, 2011
Dumb-smart indentation for Yaml
View yaml.vim
" Vim indent file
" Language: Yaml
" Author: Ian Young
" Get it bundled for pathogen:
if exists("b:did_indent")
"runtime! indent/ruby.vim
"unlet! b:did_indent
iangreenleaf /
Last active Jan 8, 2019
Shotwell RAW metadata migrator - rescue your data from Shotwell
# Shotwell RAW metadata migrator
# This software is provided WITHOUT WARRANTY OF ANY KIND
# Shotwell doesn't write metadata to RAW files. This was a problem when I wished to migrate all my data out of Shotwell.
# This script pulls data out of Shotwell's database and writes it to the files using exiftool.
# This is not elegant, performant, or well-tested. However, it seems to get the job done!
iangreenleaf / Gemfile
Last active Jan 25, 2018
Usage example of the Bundler plugin I built for testing with JSON fixtures
View Gemfile
source "test/fixtures/my_rubygems_fixture", type: "json_fixture" do
gem "whatever"
gem "foobar", "~> 1.0.1"
iangreenleaf / gist:984bc6765d2a4dc49862
Created May 12, 2014
Import seperate git repo as subdirectory
View gist:984bc6765d2a4dc49862
export target=my_dir
git remote add "$target" file:////path/to/original/repo
git fetch "$target"
git co -b "$target" "$target/master"
# Probably breaks on whitespace, sorry dawg.
git filter-branch -f --tree-filter "mkdir -p \"$target\"; git ls-tree \$GIT_COMMIT --name-only | xargs --no-run-if-empty mv -t $target" "$target"
git co master
git merge "$target"
git remote remove "$target"
git br -d "$target"
View gist:897534a599ba652a5d3d
#= dump database to yaml for fixtures
# originated by elm200 <>
#== install
# move this file to RAILS_ROOT/lib/tasks/extract_fixtures.rake
namespace :db do
iangreenleaf / .gitconfig
Created Sep 20, 2010
Better diffs in git
View .gitconfig
[diff "ruby"]
wordRegex = (@@?|\\b:|[^:]:)?[[:alnum:]_]+|:\"[^\"]+\"|::|[^[:space:]]
[diff "php"]
wordRegex = \\${0,2}[[:alnum:]_]+|::|->|[^[:space:]]
iangreenleaf / npm-troubleshooter
Last active Apr 29, 2016
View npm-troubleshooter
# Guaranteed to fix any and every problem with your npm install!**
# © ️Ian Young 2016
# Usage:
# Simply run the script, passing as arguments the command that is failing.
# Come back in 1-45 minutes to a totally fixed npm install.
View wtf_handlebars
Here are the version numbers available for Handlebars.js
| npm versions | Official website | GitHub downloads | Git tags |
| 1.0.2beta | 1.0.0-rc.3 | 0.9.0.pre.2 | 0.9.0.pre.4 |
| 1.0.4beta | | 0.9.0.pre.3 | 1.0.0.beta.1 |
| 1.0.5beta | | 0.9.0.pre.4 | 1.0.0-rc.3 |
| 1.0.6 | | 0.9.0.pre.5 | 1.0.rc.1 |
| 1.0.6-2 | | 0.9.0.pre.js | 1.0.rc.2 |
You can’t perform that action at this time.