This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PyPDF2 import PdfFileReader, PdfFileWriter | |
from PyPDF2.pdf import PageObject | |
reader = PdfFileReader(open("invoice.pdf",'rb')) | |
invoice_page = reader.getPage(0) | |
sup_reader = PdfFileReader(open("supplement.pdf",'rb')) | |
sup_page = sup_reader.getPage(1) # We pick the second page here | |
translated_page = PageObject.createBlankPage(None, sup_page.mediaBox.getWidth(), sup_page.mediaBox.getHeight()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// handles touch events even if the point tapped is outside the parent views's bounds | |
// Ref: https://medium.com/zendesk-engineering/ios-how-to-capture-touch-events-outside-uiview-bounds-bc7461970788 | |
class CustomView: UIView { | |
override func point(inside point: CGPoint, with event: UIEvent?) -> Bool { | |
let convertedPoint = button.convert(point, from: self) | |
return button.point(inside: convertedPoint, with: event) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
@interface BaseClass : NSObject { | |
@protected NSString *userName; | |
} | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class TestViewController: UIViewController { | |
var label: UILabel? | |
var planeFound = false | |
override func viewDidLoad() { | |
if let label = label { | |
view.addSubview(label) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <UIKit/UIKit.h> | |
@interface TestViewController: UIViewController | |
@property (strong, nonatomic) UILabel *label; | |
@property (strong, nonatomic) BOOL planeFound; | |
@end | |
@implementation TestViewController |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Test { | |
static let workerThreadVar: Thread? = { | |
var workerThread = Thread(target: self, selector: Selector("threadMain:"), object: nil) | |
workerThread.start() | |
return workerThread | |
}() | |
class func workerThread() -> Thread? { | |
// `dispatch_once()` call was converted to a static variable initializer | |
return workerThreadVar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation Test | |
+ (NSThread *)workerThread { | |
static NSThread *workerThread = nil; | |
static dispatch_once_t oncePredicate = (dispatch_once_t)0; | |
dispatch_once(&oncePredicate, ^{ | |
workerThread = [[NSThread alloc] initWithTarget:self selector:@selector(threadMain:) object:nil]; | |
[workerThread start]; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Test { | |
static var testSwiftifyObj: NSObject? | |
func testSwiftify() { | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation Test | |
- (void) testSwiftify { | |
static NSObject *obj; | |
} | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"draftSavedInstance": { | |
"weekNumber": 0, | |
"dayNumber": [false, false, false, false, false, false, false] | |
}, | |
"workoutFocusId": [159114288059404], | |
"equipment": false, | |
"addedByTrainer": true, | |
"intensityLevel": 2, | |
"bodyFocusId": [159114238341301], |
NewerOlder