Skip to content

Instantly share code, notes, and snippets.

CGPoint _firstLocation;
CGFloat _startY, _yMinValue = 74.0f, _yFullSize, _yExtraSpace;
- (void)panRecognizerAction:(UIPanGestureRecognizer *)recognizer
{
CGPoint location = [recognizer locationInView:self];
if (recognizer.state == UIGestureRecognizerStateBegan)
{
_startY = self.frame.size.height;
This file has been truncated, but you can view the full file.
'use strict';
var COMPILED = !0, goog = goog || {};
goog.global = this;
goog.DEBUG = !1;
goog.LOCALE = "en";
goog.provide = function (a) {
if (!COMPILED) {
if (goog.isProvided_(a))
throw Error('Namespace "' + a + '" already declared.');
delete goog.implicitNamespaces_[a];
event [#<Event id: 1, user_id: 1, expireTime: "2013-02-01 22:06:37", created_at: "2013-02-01 20:59:57", updated_at: "2013-02-01 20:59:57">]
Started GET "/api/delegates/show/1" for 127.0.0.1 at 2013-02-01 21:17:51 +0000
Processing by Api::DelegatesController#show as */*
Parameters: {"id"=>"1"}
Delegate Load (0.1ms) SELECT "delegates".* FROM "delegates" WHERE "delegates"."event_id" = 1 AND "delegates"."passcode" = '1234' LIMIT 1
Event Load (0.1ms) SELECT "events".* FROM "events" WHERE "events"."id" = 1
Completed 500 Internal Server Error in 20ms
user = User.find_or_create_by_email :name => ENV['ADMIN_NAME'].dup, :email => ENV['ADMIN_EMAIL'].dup, :password => ENV['ADMIN_PASSWORD'].dup, :password_confirmation => ENV['ADMIN_PASSWORD'].dup
event = user.events.create(:expireTime => Time.now+4000)
delegate = event.delegates.create(:passcode => '1234')
@interface UILabel (Appearence)
- (void)MW_setBackgroundColor:(UIColor *)color UI_APPEARANCE_SELECTOR;
@end
self.label = [[UILabel alloc] init];
self.segmentedControl = [[UISegmentedControl alloc] init];
[self.contentView addSubview:_segmentedControl];
[self.contentView addSubview:_label];
NSDictionary* viewsDictionary = @{@"segmentedControl" : _segmentedControl, @"label" : _label};
[self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[label(>=100)]-[segmentedControl(>=100)]-|"
options:NSLayoutFormatAlignAllTop
- (CFHTTPMessageRef)createHeadMessage
{
NSURL* url = self.request.URL;
CFHTTPMessageRef request = CFHTTPMessageCreateRequest(NULL, (CFStringRef)@"HEAD", (__bridge CFURLRef)url, kCFHTTPVersion1_1);
return request;
}
- (NSDictionary *)responseHeaders:(CFHTTPMessageRef)request
{
CFReadStreamRef requestStream = CFReadStreamCreateForHTTPRequest(NULL, request);
ASIHTTPRequest* headRequest = [ASIHTTPRequest requestWithURL:self.request.URL];
[headRequest setRequestMethod:@"HEAD"];
[headRequest startSynchronous];
@pita5
pita5 / test
Created October 25, 2012 11:53
dispatch_queue_t queue = dispatch_queue_create("somequeue", DISPATCH_QUEUE_CONCURRENT);
dispatch_apply(1000000, queue, ^(size_t i) {
NSUInteger length = [self saveSomethingToDisk];
NSUInteger gotLength = [self getSoemthingFromDisk];
if (length != gotLength)
{
NSLog(@"Something went wrong!");
}
dispatch_queue_t queue = dispatch_queue_create("somequeue", DISPATCH_QUEUE_CONCURRENT);
dispatch_apply(1000000, queue, ^(size_t i) {
[self saveSomethingToDisk];
});
- (void)saveSomethingToDisk
{
NSString* cachesPath = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject];
NSString* someFile = [cachesPath stringByAppendingPathComponent:@"somefile"];
NSData* data = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"apple_rainbow_logo" ofType:@"jpg"]];