Skip to content

Instantly share code, notes, and snippets.

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

Mohsin Khan mohsinbmwm3

🏠
Working from home
View GitHub Profile
@calt
calt / Tabbar.Swift
Last active October 10, 2024 07:06
UITabBar with custom height in Swift, does not work for iOS 14 or later.
// Does not work on iOS 14.0 or later, keeping the gist just for reference.
extension UITabBar {
override open func sizeThatFits(size: CGSize) -> CGSize {
super.sizeThatFits(size)
var sizeThatFits = super.sizeThatFits(size)
sizeThatFits.height = 71
return sizeThatFits
}
}
@avamsi
avamsi / irctc.py
Last active July 28, 2024 14:33
Python script to semi-automate tatkal ticket booking.
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import Select, WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from time import sleep, strftime
def waituntil(s):
while strftime('%H:%M:%S') < s:
print strftime('%H:%M:%S')
sleep(1)
@gonzalezreal
gonzalezreal / ios-cell-registration-swift.md
Last active March 13, 2024 15:18
iOS Cell Registration & Reusing with Swift Protocol Extensions and Generics

iOS Cell Registration & Reusing with Swift Protocol Extensions and Generics

A common task when developing iOS apps is to register custom cell subclasses for both UITableView and UICollectionView. Well, that is if you don’t use Storyboards, of course.

Both UITableView and UICollectionView offer a similar API to register custom cell classes:

public func registerClass(cellClass: AnyClass?, forCellWithReuseIdentifier identifier: String)
public func registerNib(nib: UINib?, forCellWithReuseIdentifier identifier: String)
@devxoul
devxoul / ios10-url-open-location-service.swift
Created February 14, 2017 10:02
Open Settings > Privacy > Location Service in iOS 10
// Example Usage
func openLocation() {
guard let workspaceClass = NSClassFromString("LSApplicationWorkspace") else { return }
let workspace: AnyObject = execute(workspaceClass, "defaultWorkspace")
let url = URL(string: "Prefs:root=Privacy&path=LOCATION")!
execute(workspace, "openSensitiveURL:withOptions:", with: url)
}
private func getImplementation(_ owner: AnyObject, _ name: String) -> IMP {
let selector = Selector(name)
@ygrenzinger
ygrenzinger / CleanArchitecture.md
Last active October 29, 2024 16:10
Summary of Clean Architecture by Robert C. Martin

Summary of book "Clean Architecture" by Robert C. Martin

Uncle Bob, the well known author of Clean Code, is coming back to us with a new book called Clean Architecture which wants to take a larger view on how to create software.

Even if Clean Code is one of the major book around OOP and code design (mainly by presenting the SOLID principles), I was not totally impressed by the book.

Clean Architecture leaves me with the same feeling, even if it's pushing the development world to do better, has some good stories and present robust principles to build software.

The book is build around 34 chapters organised in chapters.

@dubemike
dubemike / Genrics+CellReuse.swift
Created June 21, 2018 10:12
An easier way to dequeue cells in iOS
import Foundation
import UIKit
public protocol ReusableView: class {
static var defaultReuseIdentifier: String { get }
}
extension ReusableView where Self: UIView {
public static var defaultReuseIdentifier: String {
return String(describing: self)
}
@narate
narate / user-agent.txt
Created January 23, 2019 04:44
Sample user-agent
This file has been truncated, but you can view the full file.
$ua.tools.random()
%E7%94%BB%E5%83%8F%E6%A4%9C%E7%B4%A2/3 CFNetwork/889.9 Darwin/17.2.0
%E7%94%BB%E5%83%8F%E6%A4%9C%E7%B4%A2/3 CFNetwork/901.1 Darwin/17.6.0
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.1 Safari/605.1.15'
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36'
'Mozilla/5.0 (compatible; DuckDuckBot-Https/1.1; https://duckduckgo.com/duckduckbot)'
-
@GCHQ @russia Did you ever play tic-tac-toe?
@lo_security scan-01.lo-sec.online
Aastra 6731i/2.6.0.66