Skip to content

Instantly share code, notes, and snippets.

James Mead floehopper

Block or report user

Report or block floehopper

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:193415
void addInternetPassword(NSString *password, NSString *account,
NSString *server, NSString *itemLabel, NSString *path,
SecProtocolType protocol, int port)
OSStatus err;
SecKeychainItemRef item = nil;
const char *pathUTF8 = [path UTF8String];
const char *serverUTF8 = [server UTF8String];
const char *accountUTF8 = [account UTF8String];
const char *passwordUTF8 = [password UTF8String];
View gist:193417
SecAccessRef createAccess(NSString *accessLabel)
OSStatus err;
SecAccessRef access=nil;
NSArray *trustedApplications=nil;
//Make an exception list of trusted applications; that is,
// applications that are allowed to access the item without
// requiring user confirmation:
SecTrustedApplicationRef myself, someOther;
View gist:193418
require 'osx/cocoa'
include OSX
def create_access(access_label)
err, myself = SecTrustedApplicationCreateFromPath(nil)
err, some_other = SecTrustedApplicationCreateFromPath('/Applications/')
View gist:202942
# please send me the postscript file generated by the following command
$ man -t launchctl >
# please send me the output of the following commands executed in the irb that comes with Tiger
irb> require 'osx/cocoa' # => true
irb> OSX.require_framework 'PreferencePanes' # => true
irb> OSX::NSUnselectNow # => 1
View gist:204868
require 'stringio'
require 'test/unit/testcase'
require 'minitest/unit'
class TestResult
def self.parse_failure(raw)
matches = %r{(Failure)\:\n([^\(]+)\(([^\)]+)\) \[([^\]]+)\]\:\n(.*)\n}m.match(raw)
return nil unless matches[2], matches[3], [matches[4]], matches[5])
View gist:210776
require 'bacon'
require 'mocha_standalone'
module Bacon
class AssertionCounter
def increment
Counter[:requirements] += 1
floehopper / gist:214172
Created Oct 20, 2009 — forked from technoweenie/gist:213780
how do you test algorithms?
View gist:214172
# how do you test algorithms?
class Pythagoream <, :b)
def result
a**2 + b**2
# I prefer to "invert" the algorithm somehow
# or calculate the expected result another way.
View karl.rb
require 'test/unit'
require 'mocha'
class MyTest < Test::Unit::TestCase
def test_me
index = 0
100.times { index += 1 }
assert_equal 100, index
View gist:239664
** Execute stdlib:build
./miniruby -I. -I./lib bin/rubyc --internal --arch i386 --arch x86_64 -C "rbconfig.rb" -o "./rbconfig.rbo"
/Users/jamesmead/ThirdParty/MacRuby/lib/yaml.rb:9:in `<main>': no such file to load -- libyaml (LoadError)
from /Users/jamesmead/ThirdParty/MacRuby/lib/rubygems/config_file.rb:7:in `<main>'
from /Users/jamesmead/ThirdParty/MacRuby/lib/rubygems.rb:878:in `<main>'
rake aborted!
Command failed with status (1): [./miniruby -I. -I./lib bin/rubyc --interna...]
/usr/local/ruby-1.8.6-p287/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:995:in `sh'
/usr/local/ruby-1.8.6-p287/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1010:in `call'
/usr/local/ruby-1.8.6-p287/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1010:in `sh'
View gist:251547
it 'should destroy the ear if the user is already a member' do
ci = Factory.create(:valid_contact_import)
ear = Factory.create(:valid_emailed_association_request)
user = Factory.create(:valid_user)
ci.user = user
ci.emailed_association_requests << ear
ba =
You can’t perform that action at this time.