Skip to content

Instantly share code, notes, and snippets.

View Ruxton's full-sized avatar
🎹
🍣🎸🥁🎺🎺

Greg Tangey Ruxton

🎹
🍣🎸🥁🎺🎺
View GitHub Profile
@Ruxton
Ruxton / gist:721407
Created November 30, 2010 09:33
bananjour to screen and back again
bananajourd() {
local check=`screen -list|grep bananajour|awk '{print $1}'`
if [[ "$1" = "" ]]; then
if [[ "${check}" = "" ]]; then
screen -dmS bananajour bananajour
echo "Started bananajour in background"
else
echo "Bananajour is running in background..."
read -p "re-attach? (y/n)" choice
if [[ $choice = [yY] ]]; then
@Ruxton
Ruxton / shortlist.rb
Created December 1, 2010 01:05
Lib Or Model? You DECIDE! Today on Who Want's To Be A Programmer?
class Shortlist
def initialize(variants)
@list_storage = variants
if @list_storage.nil?
@list_storage = []
end
end
def add_variant(variant_id)
#
# __selector: "prompt", "returnvar", "current_selected", "selection_list"
#
# __selector "Select a volume", "selected_volume", "", `ls -la /Volumes/`
# cd $selected_volume
#
function __selector() {
local selections selPrompt selCurrent selListCommand selSize choose
selPrompt=$1
@Ruxton
Ruxton / keith.rb
Created April 29, 2011 05:37
Requiring assistance of Keith Pitt
begin
require('KeithPitt')
rescue PersonNotAvailableException
logger.error('Keith Pitt is currently unavailable')
end
# __screend: screen daemonizing
__screend() {
local name="${1}"
local check=`screen -list|grep $name|awk '{print $1}'`
if [[ "$2" = "" ]]; then
if [[ "${check}" = "" ]]; then
screen -dmS $name $name > /dev/null
local runCheck=`screen -list|grep $name|awk '{print $1}'`
if [[ "${runCheck}" = "" ]]; then
var object = {
init: function() {
this.someFunc();
},
someFunc: function() {
console.log('Stuff');
}, // THIS TRAILING COMMA SUX ARSE
@Ruxton
Ruxton / itms.js
Created August 15, 2011 03:19
Blocks clicks in them itms link maker, re-creates metadata and captures output
$('a.link').unbind( 'click' );
$('a.link').bind( 'click', function(event) {
event.preventDefault();
event.stopPropagation();
var f = this.className.replace(/(\s|^)link(\s|$)/, "");
this.mediaType = f.substr(0, 1).toUpperCase() + f.substr(1);
if (this.mediaType == "Artist") {
this.linkText = $(this).prevAll("h5").text() + " (Artist)";
#
#Usage
#
#$ __selector "Select a volume" "selected_volume" "" "`ls -la /Volumes/`"
#$ cd $selected_volume
#
# __selector: good for selecting stuff
function __selector() {
local selections selPrompt selCurrent selListCommand selSize choose
@Ruxton
Ruxton / driver.rb
Created March 6, 2012 07:37 — forked from osiro/driver.rb
class Driver
....
after_destroy :set_new_current_driver_to_insurance_detail
protected
def set_new_current_driver_to_insurance_detail
@insurance_detail = self.insurance_detail
@insurance_detail.update_attribute(:current_driver, @insurance_detail.drivers.first) if @insurance_detail.drivers.any? and @insurance_detail.current_driver_id == self.id
module Apathy
extend ActiveSupport::Concern
def care_factor
0
end
end
class Dan