Skip to content

Instantly share code, notes, and snippets.

Avatar
🎹
🍣🎸🥁🎺🎺

Greg Tangey Ruxton

🎹
🍣🎸🥁🎺🎺
View GitHub Profile
@Ruxton
Ruxton / gist:721407
Created Nov 30, 2010
bananjour to screen and back again
View gist:721407
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 Dec 1, 2010
Lib Or Model? You DECIDE! Today on Who Want's To Be A Programmer?
View shortlist.rb
class Shortlist
def initialize(variants)
@list_storage = variants
if @list_storage.nil?
@list_storage = []
end
end
def add_variant(variant_id)
View gist:772887
#
# __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 Apr 29, 2011
Requiring assistance of Keith Pitt
View keith.rb
begin
require('KeithPitt')
rescue PersonNotAvailableException
logger.error('Keith Pitt is currently unavailable')
end
View __screend.bash
# __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
View gist:1091538
var object = {
init: function() {
this.someFunc();
},
someFunc: function() {
console.log('Stuff');
}, // THIS TRAILING COMMA SUX ARSE
@Ruxton
Ruxton / itms.js
Created Aug 15, 2011
Blocks clicks in them itms link maker, re-creates metadata and captures output
View itms.js
$('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)";
View __selector.bash
#
#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
View 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
View gist:2004621
module Apathy
extend ActiveSupport::Concern
def care_factor
0
end
end
class Dan