Skip to content

Instantly share code, notes, and snippets.

View hartbit's full-sized avatar
👨‍💻
Swifting, one commit at a time

David Hart hartbit

👨‍💻
Swifting, one commit at a time
  • Atipik Sàrl & Witty Wings SA
  • Geneva, Switzerland
View GitHub Profile
@hartbit
hartbit / STACK TRACE
Created November 29, 2010 15:24
Sinatra GET Regexp with ArgumentError wrong number of arguments (2 for 1)
ArgumentError - wrong number of arguments (2 for 1):
test.rb:10:in `block in <main>'
/opt/local/lib/ruby1.9/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:1032:in `call'
/opt/local/lib/ruby1.9/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:1032:in `block in compile!'
/opt/local/lib/ruby1.9/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:620:in `instance_eval'
/opt/local/lib/ruby1.9/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:620:in `route_eval'
/opt/local/lib/ruby1.9/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:604:in `block (2 levels) in route!'
/opt/local/lib/ruby1.9/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:656:in `block in process_route'
/opt/local/lib/ruby1.9/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:653:in `catch'
/opt/local/lib/ruby1.9/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:653:in `process_route'
<key>Name</key>
<string>petitgarconadhoc</string>
<key>ProvisionedDevices</key>
<array>
<string>59f2970b8b5c7a7d00840de38c8505c7bec9806d</string>
<string>c35302c1c7eb8b3dcf1dbfe8e43670089241579e</string>
<string>9f29bcad2efdc86a306321d5dea20f2940eb4aab</string>
</array>
<key>TimeToLive</key>
<integer>324</integer>
@hartbit
hartbit / model.rb
Created December 29, 2010 17:30
DataMapper ManyToMany Update
class Device
include DataMapper::Resource
property :id, Serial
property :udid, String, :required => true
has n, :apps, :through => Resource
end
class App
@hartbit
hartbit / script.rb
Created December 29, 2010 18:09
DataMapper Test
require 'dm-core'
require 'dm-migrations'
require 'dm-serializer'
DataMapper::Logger.new($stdout, :debug)
DataMapper.setup(:default, 'sqlite:test.sqlite')
# =========================================
# MODEL
# =========================================
broken link from tree ffd71373dff9d68b9919a1d99364228408845b79
to blob 8776a7989a1bae17ff5fbdf2b2964b6784ce25aa
broken link from tree 719f17791332d13d525445deec2dee4a0c4db921
to blob 57a861150f6e74ef40301898ec42385d5731cf98
broken link from tree 719f17791332d13d525445deec2dee4a0c4db921
to blob 8477c325c418b304aca50da8598988f73f142ee1
broken link from tree 14a603e41b7639ad6038c254bcb561461bfc7990
to blob 30cfb20cec366743359d57915634ff8f7c8340bd
broken link from tree 72dc653195ee51aa02d208084d7d6ded908dd28b
to blob 56fa1ec0805d56344a4b3c425b6daa15d16dda62
2011-02-18 19:02:10.619 Gravicube[261:307] Store error Error Domain=NSCocoaErrorDomain Code=134100 "The operation couldn’t be completed. (Cocoa error 134100.)" UserInfo=0x14ffd0 {metadata=<CFBasicHash 0x14fe80 [0x3ea4f9fc]>{type = immutable dict, count = 7,
entries =>
2 : <CFString 0x14fc00 [0x3ea4f9fc]>{contents = "NSStoreModelVersionIdentifiers"} = <CFArray 0x14fd00 [0x3ea4f9fc]>{type = immutable, count = 0, values = ()}
4 : <CFString 0x14fc70 [0x3ea4f9fc]>{contents = "NSPersistenceFrameworkVersion"} = <CFNumber 0x14ca50 [0x3ea4f9fc]>{value = +251, type = kCFNumberSInt64Type}
6 : <CFString 0x14fca0 [0x3ea4f9fc]>{contents = "NSStoreModelVersionHashes"} = <CFBasicHash 0x14fdc0 [0x3ea4f9fc]>{type = immutable dict, count = 2,
entries =>
0 : <CFString 0x1440e0 [0x3ea4f9fc]>{contents = "Cell"} = <CFData 0x14fd70 [0x3ea4f9fc]>{length = 32, capacity = 32, bytes = 0xd49ae8ea07aa10b304a52f5e67202d85 ... 9b75f774b3f2ea79}
2 : <CFString 0x11c3a0 [0x3ea4f9fc]>{contents = "Puzzle"} = <CFData 0x14fd20 [0x3ea4f9fc]>{l
//
// HDAnimatedImage.m
// HDFoundation
//
// Created by David Hart on 11/9/10.
// Copyright 2010 hart[dev]. All rights reserved.
//
#import "HDAnimatedImage.h"
#import <QuartzCore/QuartzCore.h>
@hartbit
hartbit / HDTransitionController.m
Created March 29, 2011 09:35
Custom Container Controller
//
// HDTransitionController.m
// HDLibraries
//
// Created by David Hart on 3/22/11.
// Copyright 2011 hart[dev]. All rights reserved.
//
#import "HDTransitionController.h"
#import "HDViewController.h"
@hartbit
hartbit / UIImage+Loading.m
Created April 10, 2011 13:08
UIImage Category for loading images correctly.
#import "UIImage+Loading.h"
#import "HDFoundation.h"
#import "UIDevice+Platform.h"
@interface UIImage ()
+ (UIImage*)findImageNamed:(NSString*)name cached:(BOOL)caches;
@end
static NSComparator upComparator = ^NSComparisonResult(id obj1, id obj2) {
if ([obj1 position].y < [obj2 position].y) {
return NSOrderedAscending;
} else if ([obj1 position].y > [obj2 position].y) {
return NSOrderedDescending;
} else {
return NSOrderedSame;
}
};