Skip to content

Instantly share code, notes, and snippets.

@iangreenleaf
iangreenleaf / lychee_tag.rb
Last active April 7, 2021 04:48 — forked from tobru/lychee_tag.rb
A Liquid tag for Jekyll sites that allows embedding Lychee albums. See https://tobrunet.ch/articles/jekyll-meets-lychee-a-liquid-tag-plugin/
# Connects Jekyll with Lychee (http://lychee.electerious.com/)
#
# # Features
#
# * Generate album overview and link to image
# * Caching of JSON data
#
# # Usage
#
# {% lychee_album <album_id> %}
@iangreenleaf
iangreenleaf / shotwell_metadata_fix.sh
Last active January 8, 2019 17:41
Shotwell RAW metadata migrator - rescue your data from Shotwell
#!/bin/bash
# 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
iangreenleaf / Gemfile
Last active January 25, 2018 17:49
Usage example of the Bundler plugin I built for testing with JSON fixtures
source "test/fixtures/my_rubygems_fixture", type: "json_fixture" do
gem "whatever"
gem "foobar", "~> 1.0.1"
end
@iangreenleaf
iangreenleaf / npm-troubleshooter
Last active March 26, 2024 16:50
THE MULTI-PURPOSE NPM TROUBLESHOOTING SCRIPT
#!/bin/bash
# THE MULTI-PURPOSE NPM TROUBLESHOOTING SCRIPT
# 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.
<ruleset name="Grinnellplans.com">
<target host="grinnellplans.com" />
<target host="www.grinnellplans.com" />
<rule from="^http:" to="https:" />
</ruleset>
#
#= dump database to yaml for fixtures
#
# originated by elm200 <http://d.hatena.ne.jp/elm200/20070928/1190947947>
#
#== install
#
# move this file to RAILS_ROOT/lib/tasks/extract_fixtures.rake
#
namespace :db do
@iangreenleaf
iangreenleaf / gist:b206d09c587e8fc6399e
Last active December 7, 2024 18:16
Rails naming conventions

Rails naming conventions

General Ruby conventions

Class names are CamelCase.

Methods and variables are snake_case.

Methods with a ? suffix will return a boolean.

@iangreenleaf
iangreenleaf / gist:6dfb4d0847ebda0cc3dd
Last active August 29, 2015 14:15
Bulk-save files in Vim
ack -f --print0 | xargs -0 -n1 vim +wq
@iangreenleaf
iangreenleaf / keybase.md
Created January 14, 2015 18:01
Keybase identity proof

Keybase proof

I hereby claim:

  • I am iangreenleaf on github.
  • I am iangreenleaf (https://keybase.io/iangreenleaf) on keybase.
  • I have a public key whose fingerprint is 3820 459D 1ADA C0D3 6F33 988E 0D31 6FB4 774E 9147

To claim this, I am signing this object:

@iangreenleaf
iangreenleaf / gist:984bc6765d2a4dc49862
Created May 12, 2014 18:18
Import seperate git repo as subdirectory
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"