This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "java" | |
java_import javax.swing.JOptionPane | |
class Whazzup | |
def initialize(file = "#{ENV['HOME']}/snippets.txt") | |
@snippets ||= open(file, 'ab') | |
log('[Starting up (ruby)]') | |
thread_loop = Thread.current |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This example is flawed, but hopefully useful for demonstration purposes. | |
def test_stable_sorting | |
ary = (1..100).to_a.shuffle + (1..100).to_a.shuffle | |
# This associates an ordering with the randomized numbers | |
idx = 0 | |
paired = ary.collect {|value| [value, idx += 1]} | |
puts "Now the numbers are paired; the first is the random number 1-100," | |
puts "the second is its sequence within the 200 entries." | |
puts paired.inspect |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TableViewDataSource | |
def awakeFromNib | |
view.registerForDraggedTypes( | |
NSArray.arrayWithObjects("BookmarkDictionaryListPboardType", "MozURLType", | |
NSFilenamesPboardType, NSURLPboardType, NSStringPboardType, nil)) | |
end | |
def tableView(aView, validateDrop:info, proposedRow:row, proposedDropOperation:op) | |
NSDragOperationEvery | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AuctionTableDatasource | |
attr_writer :app_delegate | |
attr_accessor :view | |
. | |
. | |
. | |
def set_selected_category(category_name) | |
context = @app_delegate.managedObjectContext | |
@current_category = Category.find_first(context, by_name:category_name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <CoreData/CoreData.h> | |
#import "FindableData.h" | |
@interface Category : FindableData | |
{ | |
} | |
@property (nonatomic, retain) NSString *name; | |
@property (nonatomic, retain) NSSet *auctions; | |
@property (nonatomic, retain) NSNumber *auctionCount; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'inheritable_attrs' | |
class Entity < NSManagedObject | |
class_inheritable_accessor :entity_name | |
self.entity_name = 'Entity' | |
def self.inherited(sub) | |
sub.entity_name = sub.to_s | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based off of Rails, by way of http://www.raulparolari.com/Rails/class_inheritable | |
class Class | |
def class_inheritable_reader(*syms) | |
syms.each do |sym| | |
class_eval <<-EOS | |
def self.#{sym} | |
read_inheritable_attr(:#{sym}) | |
end | |
EOS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'http://rubygems.org' | |
gem 'rails', '3.0.3' | |
# Edit this Gemfile to bundle your application's dependencies. | |
# This preamble is the current preamble for Rails 3 apps; edit as needed. | |
gem 'mysql' | |
gem 'delayed_job' | |
gem 'unicorn' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# TableDelegate.rb | |
# | |
# An example of capturing double-clicks and a yellow-fade technique in MacRuby. | |
# The yellow fade technique implementation is a ruby-ized translation | |
# of http://www.bdunagan.com/2009/04/26/core-animation-on-the-mac/ | |
# Created by Morgan Schweers on February 26, 2011. | |
framework 'Cocoa' | |
class TableDelegate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mv ~/Library/Preferences/JBidwatcher/jbdb ~/Library/Preferences/JBidwatcher/jbdb.save | |
mv ~/.jbidwatcher/jbdb ~/Library/Preferences/JBidwatcher/jbdb |