Skip to content

Instantly share code, notes, and snippets.

View Ibrahimhass's full-sized avatar
🏠
Working from home

Md. Ibrahim Hassan Ibrahimhass

🏠
Working from home
View GitHub Profile
@Ibrahimhass
Ibrahimhass / merge_pdfs.py
Created April 2, 2024 11:00 — forked from Geekfish/merge_pdfs.py
pyPDF2 merge 2 pdf pages into one
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())
// 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)
}
}
#import <Foundation/Foundation.h>
@interface BaseClass : NSObject {
@protected NSString *userName;
}
@end
import UIKit
class TestViewController: UIViewController {
var label: UILabel?
var planeFound = false
override func viewDidLoad() {
if let label = label {
view.addSubview(label)
}
#import <UIKit/UIKit.h>
@interface TestViewController: UIViewController
@property (strong, nonatomic) UILabel *label;
@property (strong, nonatomic) BOOL planeFound;
@end
@implementation TestViewController
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
@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];
});
class Test {
static var testSwiftifyObj: NSObject?
func testSwiftify() {
}
}
@implementation Test
- (void) testSwiftify {
static NSObject *obj;
}
@end
{
"draftSavedInstance": {
"weekNumber": 0,
"dayNumber": [false, false, false, false, false, false, false]
},
"workoutFocusId": [159114288059404],
"equipment": false,
"addedByTrainer": true,
"intensityLevel": 2,
"bodyFocusId": [159114238341301],