Skip to content

Instantly share code, notes, and snippets.

View adonaldson's full-sized avatar

Andrew Donaldson adonaldson

View GitHub Profile
@adonaldson
adonaldson / qw.scpt
Created November 8, 2011 22:41
Linkinus script to set iChat as away when off to play Quake. How very '98!
on linkinuscmd(ipAddress)
set AppleScript's text item delimiters to ""
set iChatActive to false
set theString to "/me is not currently running iChat"
tell application "Finder"
if (get name of every process) contains "iChat" then set iChatActive to true
end tell
if iChatActive then
@adonaldson
adonaldson / gist:1205902
Created September 9, 2011 10:23
Fixing a bug in a tagged release
I have a process for fixing bugs in tagged releases, but it always seems such a faff. This makes
me think I'm doing it wrong. So imagine this scenario:
- I tag a release (v1) and push it onto staging
- I continue work in master
- Client comes back with an issue on v1
- I create a branch based off v1
- I fix the bug
- ...
@adonaldson
adonaldson / Output from 'since'
Created September 5, 2011 17:55
Output from Git
Mon, 5 Sep 2011
Changes between 'ea776f90655ded3da3e1cf3b1f077b22b7ff0401' and HEAD
FEATURE:
- Hello world, now with added 3
BUGFIX:
- Forgot to add version 2
OTHER:
(function() {
var lighthouse_token = '';
var base_url = "https://harmonypark.lighthouseapp.com";
var ticket_url = prompt("Ticket url?");
if (ticket_url === null) {
return;
}
@adonaldson
adonaldson / gem?.rb
Created February 9, 2011 11:02
"Could not find crack-0.1.8 in any of the sources" -- what does crack do? 'gem? crack'
#!/usr/bin/env ruby
# I named this file gem? and put it into my path. I'm sure that cuteness will blow up in
# my face at some point!
require 'rubygems'
require 'hpricot'
require 'open-uri'
require 'CGI'
class AdvertsController < ActionController::Base
protect_from_forgery
# Non-adminny controller, delete the adverts.html.erb from app/view/layouts, it'll default to using
# application.html.erb
end
class AdminController < ActionController::Base
protect_from_forgery
before_filter :login_required
# With the following spec/spec.opts:
# --colour
# --format progress
# --format failing_examples:spec/spec_rerun.txt
# --loadby mtime
# --reverse
#
# You can use the following rake task:
# rake spec:rerun
// From http://stackoverflow.com/questions/3583989/jquery-autocomplete-pass-targeted-element-attribute-as-an-extra-parameter
$("#autocomplete input").each(function() {
var that = this;
$(that).autocomplete({
source: function(request, response) {
$.ajax({
url: "search.php",
dataType: "json",
data: {
if has ("autocmd")
autocmd bufwritepost .vimrc source $MYVIMRC
endif
rstakeout_model_spec()
{
rstakeout "script/spec spec/models/$1_spec.rb $2" "app/models/*.rb" "spec/models/$1_spec.rb"
}