Skip to content

Instantly share code, notes, and snippets.

View boctor's full-sized avatar

Peter Boctor boctor

View GitHub Profile
@boctor
boctor / gist:0049d5eb5d3609078f5d24344601f502
Created September 16, 2016 17:00
iPhone 7 availability
List iPhone 7/7+ availability in every US Apple Store:
https://reserve.cdn-apple.com/US/en_US/reserve/iPhone/availability.json
List all US Apple Stores:
https://reserve.cdn-apple.com/US/en_US/reserve/iPhone/stores.json
iPhone 7/7+ model numbers:
https://www.techwalls.com/iphone-7-plus-model-differences/
//
// UIDeviceHardware.h
//
// Used to determine EXACT version of device software is running on.
#import <Foundation/Foundation.h>
@interface UIDeviceHardware : NSObject
+ (NSString *) platform;
@boctor
boctor / BaseViewController.m
Created May 5, 2011 02:08
A base view controller class that when running on the simulator in debug mode, will auto simulate a memory warning every time the view controller's viewDidAppear is called
//
// BaseViewController.m
//
// Created by Peter Boctor on 5/4/11.
//
// Copyright (c) 2011 Peter Boctor
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
@boctor
boctor / wordpress_freshly_pressed.rb
Created March 18, 2011 08:29
This ruby script uses Hpricot to scrape the Freshly Pressed pages on Wordpress.com. It then stores its results as JSON on S3. Here is the related blog post to this Gist: http://idevrecipes.com/?p=260
#!/usr/bin/ruby -rubygems
require 'open-uri'
require 'hpricot'
require 'aws/s3'
require 'yaml'
require 'json'
def save_in_s3(key, data, bucket, options)
amazon_s3_settings = YAML.load(open(File.join(File.dirname(__FILE__), "amazon_s3.yml"){ |f| f.read }))
AWS::S3::Base.establish_connection!(:access_key_id => amazon_s3_settings[:access_key_id], :secret_access_key => amazon_s3_settings[:secret_access_key])
@boctor
boctor / Landscape support
Created January 2, 2011 17:48
How does the Twitter iPhone App animate the current tab bar indicator? http://idevrecipes.com/2010/12/17/twitter-app-tab-bar-animation/#comment-96
- (void) addTabBarArrow
{
UIImage* tabBarArrowImage = [UIImage imageNamed:@"TabBarNipple.png"];
self.tabBarArrow = [[[UIImageView alloc] initWithImage:tabBarArrowImage] autorelease];
CGRect frame = CGRectMake([self horizontalLocationFor:0], -4, [tabBarArrow frame].size.width, [tabBarArrow frame].size.height);
[tabBarArrow setFrame:frame];
[[tabBarController tabBar] addSubview:tabBarArrow];
}