Skip to content

Instantly share code, notes, and snippets.

View konklone's full-sized avatar

Eric Mill konklone

View GitHub Profile
Minstrel: 1
Bard: 1
Troubadour: 1
Jongleur: 1
test gist
@konklone
konklone / usage.rb
Created August 4, 2008 05:32
Turned this into a project: http://github.com/klondike/wesabe
##########################################################################
# This is now a proper Github project: http://github.com/klondike/wesabe
##########################################################################
wesabe = Wesabe.new 'username', 'password'
# login to trigger automatic updates, so your account info will be fresh
wesabe.trigger_updates
# fetch your account data (you may want to wait a minute after triggering updates)
class User < ActiveRecord::Base
has_attached_file :avatar, :styles => {:thumb => '100x100>'}
end
###########
class CreateUsers < ActiveRecord::Migration
def self.up
create_table :users do |t|
t.string :avatar_file_name
require 'rubygems'
require 'wirble'
Wirble.init
Wirble.colorize
# if I'm in a Rails app
require 'test/factories' if File.exists?('test/factories.rb')
require 'congrelate' if File.exists?('congrelate.rb')
require 'net/https'
require 'rexml/document'
require 'yaml'
CERT_FILENAME = File.dirname(__FILE__) + "/cacert.pem"
class Wesabe
attr_accessor :email, :password, :accounts, :account_xml, :http
def initialize(file)
# Put it in your .irbrc, then you can see the methods of an object or class, besides the ones Object gives to everyone.
def m(obj)
if obj.is_a? Class
obj.methods.sort - Object.methods
else
obj.methods.sort - Object.new.methods
end
end
protected class TweetAdapter extends BaseAdapter {
private Activity context;
private Status[] tweets;
LayoutInflater inflater;
public TweetAdapter(Activity c, Status[] tw) {
context = c;
tweets = tw;
inflater = (LayoutInflater) c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
final Handler handler = new Handler();
final Runnable updateThread = new Runnable() {
public void run() {
ImageView picture = (ImageView) LegislatorProfile.this.findViewById(R.id.picture);
picture.setImageDrawable(avatar);
}
};
public void loadImage() {
Thread loadingThread = new Thread() {
# This is now n actual repo, here:
# http://github.com/klondike/muine-osd
#!/usr/bin/env ruby
require 'yaml'
def d(string); string.gsub /[\'\"]/, ''; end
def load_song(details)
song = {}
details.split(/[\n\r]+/).each do |line|