Skip to content

Instantly share code, notes, and snippets.

View terrybu's full-sized avatar

Terry Bu terrybu

  • Los Angeles, CA
  • 18:32 (UTC -07:00)
  • LinkedIn in/terrybu
View GitHub Profile
@terrybu
terrybu / gist:3d42e33aa8a90c1189f7
Created July 31, 2015 00:39
Boilerplate cellForRowAtIndexPath with reuse identifier - Swift
private let cellReuseIdentifier: String = "yourCellReuseIdentifier"
//
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var cell : UITableViewCell? = tableView.dequeueReusableCellWithIdentifier(cellReuseIdentifier) as? UITableViewCell
if (cell == nil) {
cell = UITableViewCell(style:.Default, reuseIdentifier:cellReuseIdentifier)
@terrybu
terrybu / gist:280d60169dc1536fe4f8
Created March 3, 2015 16:14
UILocalNotification (M-F)
- (void) fireNotificationsForAllWeekDays: (NSInteger) hour minute: (NSInteger) minute {
[self fireNotificationForDay:Monday hour:hour minute:minute];
[self fireNotificationForDay:Tuesday hour:hour minute:minute];
[self fireNotificationForDay:Wednesday hour:hour minute:minute];
[self fireNotificationForDay:Thursday hour:hour minute:minute];
[self fireNotificationForDay:Friday hour:hour minute:minute];
}
- (void) fireNotificationForDay: (WeekDayType) day hour: (NSInteger) hour minute: (NSInteger) minute {
NSDateComponents *dateComponents = [[NSDateComponents alloc]init];
#import <WebKit/WebKit.h>
@interface ViewController : UIViewController
@property(strong,nonatomic) WKWebView *webView;
@property (strong, nonatomic) NSString *productURL; @end
- (void)viewDidLoad {
[super viewDidLoad];
self.productURL = @"http://www.URL YOU WANT TO VIEW GOES HERE";
NSURL *url = [NSURL URLWithString:self.productURL]; NSURLRequest *request = [NSURLRequest requestWithURL:url];
_webView = [[WKWebView alloc] initWithFrame:self.view.frame];