Skip to content

Instantly share code, notes, and snippets.

View aaronmoodie's full-sized avatar
Coffee

Aaron Moodie aaronmoodie

Coffee
View GitHub Profile

Keybase proof

I hereby claim:

  • I am aaronmoodie on github.
  • I am aaronmoodie (https://keybase.io/aaronmoodie) on keybase.
  • I have a public key whose fingerprint is 09BE 3685 A583 684F 5776 FB2B 88EE 7158 C521 01D2

To claim this, I am signing this object:

@aaronmoodie
aaronmoodie / gitCommands.bash
Last active August 29, 2015 13:55
My Collection of git commands
$ git log #show commit history
$ git revert <hash> # reverts changes in that commit
$ git show <hash> | gist -t diff # create diff of commit and pipe to gist
$ git diff —staged # show diff of added (staged files)
$ git rebase -i # interactive rebase
$ git rebase —abort # undo a rebase
$ git cherrypick <hash> # moves a commit from one branch to another
$ git push origin <branch> # push review/branch to github
$ git commit —amend # add changes to the last commit
$ git stash show <stash name> # view changes in stash
@aaronmoodie
aaronmoodie / gist:5401127
Last active December 16, 2015 07:48 — forked from dnch/gist:5392985
class Show < ActiveRecord::Base
attr_accessible :artist_tokens, :cost, :booking_url, :door_charge, :venue_id, :date, :time, :starts_at
attr_reader :artist_tokens, :date, :time
validate :is_time
validate :is_date
before_save :save_date_and_time
has_many :performances
has_many :artists, :through => :performances
[5] pry(main)> file = TagLib::MPEG::File.new('taro.mp3')
=> #<TagLib::MPEG::File:0x007f852353ec88 @__swigtype__="_p_TagLib__MPEG__File">
[6] pry(main)> tag = file.tag
=> #<TagLib::Tag:0x007f852350a870 @__swigtype__="_p_TagLib__Tag">
[7] pry(main)> puts "#{file}: #{tag.title} by #{tag.artist}; track #{tag.track} on #{tag.album}"
#<TagLib::MPEG::File:0x007f852353ec88>: Taro by alt-J; track 13 on An Awesome Wave
=> nil
[8] pry(main)>
1.9.2p290 :002 > require 'taglib'
=> true
1.9.2p290 :003 > TagLib::MPEG::File.new('taro.mp3') do |file|
1.9.2p290 :004 > tag = file.tag
1.9.2p290 :005?> puts "#{file}: #{tag.title} by #{tag.artist}; track #{tag.track} on #{tag.album}"
1.9.2p290 :006?> end
=> #<TagLib::MPEG::File:0x007f9cea923770>
# html
# place under div.email (92)
<div class="gifts-newsletter">
<input type="checkbox" name="etsy_gift" id="etsy_gift"> <label for="etsy_gift">I'd also like great gift ideas from Etsy.</label>
</div>
# css
# place under form div.email (314)
.reminder p {
@aaronmoodie
aaronmoodie / README.md
Created September 2, 2012 23:55 — forked from hongymagic/README.md
Simple zsh wrapper to launch iA Writer from the terminal

This is a simple script to launch iA Writer from the terminal. It is extremely useful for interacting with Github's own wiki system as it provides git access.

INSTALL

One-liner

curl -L https://raw.github.com/gist/3605724/efcccacb59e5df271ddf603ac92da4deee2440df/ia > /usr/local/bin/ia && chmod u+x /usr/local/bin/ia

Manual, safer way

@aaronmoodie
aaronmoodie / theme.html
Created April 17, 2012 22:55 — forked from soemarko/theme.html
embed github gist to tumblr
<!-- Add the following lines to theme's html code right before </head> -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
<script src="http://static.tumblr.com/fpifyru/VCxlv9xwi/writecapture.js"></script>
<script src="http://static.tumblr.com/fpifyru/AKFlv9zdu/embedgist.js"></script>
<!--
Usage: just add <div class="gist">[gist URL]</div>
Example: <div class="gist">https://gist.github.com/1395926</div>
-->
$('#submitForm').click(function(event) {
var total = 0;
$('select.sandwich').each(function() {
total = total + $(this).attr('value');
});
if(total < 10 ) {
event.preventDefault();
$('div.minRequired').css('display', 'block');
} else {
$('div.minRequired').css('display', 'none');
@aaronmoodie
aaronmoodie / config.ru
Created March 6, 2012 10:36
Rails Lightweight Stack. Most of this is detailed on Crafting Rails Applications - http://pragprog.com/book/jvrails/crafting-rails-applications
# Run this file with `RAILS_ENV=production rackup -p 3000 -s thin`
# Be sure to have rails and thin installed.
require "rubygems"
# We are not loading Active Record, nor the Assets Pipeline, etc.
# This could also be in your Gemfile.
gem "actionpack", "~> 3.2"
gem "railties", "~> 3.2"
# The following lines should come as no surprise. Except by