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
#!/usr/bin/env ruby | |
# | |
# Usage: | |
# security dump-keychain -d login.keychain > keychain_logins.txt | |
# # Lots of clicking 'Always Allow', or just 'Allow', until it's done... |
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
if ARGV[0].nil? | |
puts "Usage:\n\truby #{__FILE__} {bad bottle#|test}" | |
exit | |
end | |
def guess_bottle(bad_bottle, silent=false) | |
waiters = [] | |
(0..9).each do |waiter_number| | |
waiters[waiter_number] = [] | |
(0..999).each do |bottle| |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Testing HTML5 Canvas element</title> | |
<script src="jquery.min.js" type="text/javascript"></script> | |
</head> | |
<body> | |
This is a test of the HTML5 Canvas element. | |
<canvas id="drawing_canvas" width="800" height="600" style="position: absolute; top: 0; left: 0;"> | |
</canvas> |
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 'rubygems' | |
require 'sqlite3' | |
require 'sequel' | |
# Adding this monkey-patch makes it work on MacRuby. | |
module Sequel | |
class Dataset | |
def single_record | |
record = nil | |
clone(:limit=>1).each{|r| record = r; return r} |
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 |
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
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
# 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
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
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 |