Skip to content

Instantly share code, notes, and snippets.

View davelyon's full-sized avatar

Dave Lyon davelyon

View GitHub Profile
SYSTEM_DEPENDENCIES = ["ruby", "rake", "gem"]
GEM_DEPENDENCIES = ["redis", "resque"]
def dependency_check(who)
if(system("which #{who}"))
puts "#{who} installed."
else
puts "#{who} missing."
end
end
require 'pathname'
require 'fileutils'
# @a = "/Users/dave/Desktop/hq-feeder/test-dirs/"
# @b = "/Users/dave/Desktop/hq-feeder/test-dirs2/"
# EXPORT_DIR = "/Users/dave/Desktop/hq-feeder/test-export-dirs/"
class ImageLoader
attr_reader :files
class Book
attr_accessor :title
attr_reader :isbn
attr_writer :owner
end
# This is identical to
class Book
# Define an image as below, you can call it anything, and you can have several -- e.g. ActiveRegion_AIA171, ActiveRegion_AIA090
class ActiveRegionImage < Image
layer :id => 1, :visible => :true, :opacity => 100
types ["mobile","web"]
scale 2.63
end
class ActiveRegionMovie < Movie
layer :id => 1, :visible => :true, :opacity => 100
types ["mobile","web"]
require 'image'
require 'movie'
require 'event_registry'
class HelioEvent
EVENT_STARTTIME_KEY = "event_starttime"
EVENT_ENDTIME_KEY = "event_endtime"
EVENT_ARCHIVEDATE_KEY = "kb_archivdate"
EVENT_UID_KEY = "kb_archivid"
EVENT_BBOX_KEY = "hpc_bbox"
# More ruby fun!
def power(base)
Proc.new {|x| base ** x }
end
base2 = power(2) # => #<Proc:0x00000001001569d0@-:4>
base2.call(8) # => 256
[user]
name = Dave Lyon
email = dave@davelyon.net
[diff]
external = "mate"
[core]
editor = "mate -wl1"
excludes = "/Users/dlyon/.gitignore"
var fortunes=new Array(" One learns to itch where one can scratch. -- Ernest Bramah "," One meets his destiny often on the road he takes to avoid it. "," One monk said to the other, \"The fish has flopped out of the net! How will it live?\" The other said, \"When you have gotten out of the net, I'll tell you.\" "," Only that in you which is me can hear what I'm saying. -- Baba Ram Dass "," Only those who leisurely approach that which the masses are busy about can be busy about that which the masses take leisurely. -- Lao Tsu "," Paradise is exactly like where you are right now ... only much, much better. -- Laurie Anderson "," Perfection is reached, not when there is no longer anything to add, but when there is no longer anything to take away. -- Antoine de Saint-Exupery "," Perhaps the biggest disappointments were the ones you expected anyway. "," Philosophy will clip an angel's wings. -- John Keats "," Push where it gives and scratch where it itches. "," Reality always seems harsher in the early morning. ",
cp $2 "$1/$2"
cd $1
# Run with . ./test.sh $DIR_TO_CP_TO $FILE
@davelyon
davelyon / itunes_xml_parse.rb
Created November 19, 2010 04:33
Parse an itunes XML file to something html-ish
require 'rubygems'
require 'plist'
r = Plist::parse_xml("/Users/dave/Desktop/ItunesLibrary.xml")
lib = Hash.new()
r["Tracks"].each do |track|
album = track[1]["Album"]