Skip to content

Instantly share code, notes, and snippets.

View JamesHarrison's full-sized avatar

James Harrison JamesHarrison

View GitHub Profile
@JamesHarrison
JamesHarrison / gist:28017
Created November 23, 2008 02:42
undefined
class NotifierProcessor < ApplicationProcessor
subscribes_to :notifications
#require 'msn/msn'
require 'rubygems'
require 'net/yail'
require 'xmpp4r'
require 'xmpp4r/client'
require 'xmpp4r/muc'
$IRC_DEBUG = true
/*
Noisepad 0.1
A real-time generative synth with draggable interface.
Thanks to:
st33d (http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Syntax;action=display;num=1157926569) - Example code on draggable implementation
Author: James Harrison
# Logfile created on Tue Dec 09 14:50:32 +0000 2008 by /
Opacity: 255, 255, 255
Computed Opacity: 0.0, 0.0, 0.0
Opacity: 255, 255, 255
Computed Opacity: 0.0, 0.0, 0.0
Opacity: 255, 255, 255
Computed Opacity: 0.0, 0.0, 0.0
Opacity: 255, 255, 255
Computed Opacity: 0.0, 0.0, 0.0
Opacity: 255, 255, 255
require 'rubygems'
require 'RMagick'
module Eve
module CorporateLogo
# Represents a complete logo.
# Attributes:
# image - The Magick::Image instance
# layers - Array of Layer instances
# output - Path to which the output of this Logo has been written
class Logo
xml = new XMLElement(this, "http://wiki.eveonline.com/w/index.php?title=Special:Recentchanges&feed=rss");
XMLElement[] changes=xml.getChild(0).getChildren();
int change_count = xml.getChild(0).getChildCount();
for(int n = 0; n < change_count;n++){
if (changes[n].getChildCount() > 1) {
// this element is an item element
XMLElement[] item = changes[n].getChildren();
String pagename = item[0].getContent();
# A corporation in EVE.
class Corporation < ActiveRecord::Base
has_many :characters
has_many :stations
has_many :kills
has_many :kill_attackers
has_many :fittings
has_many :reimbursement_requests
has_one :ceo, :class_name => "Character", :foreign_key => "ceo_id"
belongs_to :alliance
require 'net/http'
require 'RMagick'
# Retrieves a corporation logo for a corporation
class GetCorporationLogoJob < Struct.new(:corporation_id)
def perform
File.open("#{RAILS_ROOT}/public/system/corporations/#{corporation_id.to_i}_64.png","wb") do |f|
Net::HTTP.start("clg.eve-metrics.com") do |http|
resp = http.get("/#{corporation_id.to_i.to_s}.png")
return unless resp
if resp.response['Location'] then
@JamesHarrison
JamesHarrison / metoffice.rb
Created February 5, 2009 10:53
Two classes for scraping and viewing met office satellite data
# tiny little class to scrape Met Office satellite and radar image feeds and save them
require 'net/http'
require 'ftools'
class MetOfficeGrabber
def initialize(type, save_folder, file_format='jpg', base_url='http://www.metoffice.gov.uk/weather/images')
@type = type.to_s # eg ukir_sat or ukvis_sat
@url = URI.parse(base_url.to_s) # met office website
@path = save_folder.to_s # save location - will be folderised by type
@format = file_format.to_s # what format is the file on the website? radar uses gif.
# make save location if it doesn't exist
/*Column Information For - evemetrics_development.order_facts*/
---------------------------------------------------------------
Field Type Collation Null Key Default Extra Privileges Comment
-------------- ------- --------- ------ ------ ------- -------------- ------------------------------- -------
id int(11) (NULL) NO PRI (NULL) auto_increment select,insert,update,references
lowSellPrice float (NULL) YES (NULL) select,insert,update,references
totalDemand int(11) (NULL) YES (NULL) select,insert,update,references
avgSellPrice float (NULL) YES (NULL) select,insert,update,references
totalProvision int(11) (NULL) YES (NULL) select,insert,update,references
We couldn’t find that file to show.