Skip to content

Instantly share code, notes, and snippets.

View aplekhanov's full-sized avatar
🇨🇾
Working from home

Alex Plekhanov aplekhanov

🇨🇾
Working from home
View GitHub Profile
@SergLam
SergLam / ViewController.swift
Last active November 15, 2023 16:27
UITableView - remove empty bottom space
class ViewController: UIViewController {
let tableView = UITableView()
// BAD SOLUTION, but works
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
tableView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: -tableView.bounds.height, right: 0)
}
@XLNCs
XLNCs / AdobeFixAMD
Last active February 17, 2025 21:51
To fix adobe products crashes on AMD hackintosh
MOVED HERE:
https://gist.github.com/naveenkrdy/26760ac5135deed6d0bb8902f6ceb6bd
@qubblr
qubblr / gist:f5d94dd0311d72dac5f1e75639b25f7b
Last active February 17, 2022 12:22
Method to get an index path for UICollectionView supplementary view
extension UICollectionView {
func indexPath(for supplementaryView: UICollectionReusableView?, ofKind kind: String = UICollectionView.elementKindSectionHeader) -> IndexPath? {
let elements = visibleSupplementaryViews(ofKind: kind)
let indexPaths = indexPathsForVisibleSupplementaryElements(ofKind: kind)
for (element, indexPath) in zip(elements, indexPaths) {
if element === supplementaryView {
return indexPath
}
}
@serhii-londar
serhii-londar / swift_4_1_ubuntu16_04.sh
Last active November 26, 2018 08:15
Install swift 4.1 on Ubuntu 16.04 bash script
#!/bin/bash
sudo apt-get install clang libicu-dev libcurl4-openssl-dev lldb git wget unzip -y
wget https://swift.org/builds/swift-4.1-release/ubuntu1604/swift-4.1-RELEASE/swift-4.1-RELEASE-ubuntu16.04.tar.gz
tar zxf swift-4.1*.tar.gz && rm -rf swift-4.1*.tar.gz
sudo mv swift-4.1* /swift-4.1
echo "export PATH=/swift-4.1/usr/bin:\"\${PATH}\"" >> ~/.bashrc
source ~/.bashrc
//
// UIImage+PDF.swift. Copyright © 2016 Nigel Timothy Barber (@mindbrix). All rights reserved.
//
import UIKit
extension UIImage {
static func PDFImageWith(_ url: URL, pageNumber: Int, width: CGFloat) -> UIImage? {
return PDFImageWith(url, pageNumber: pageNumber, constraints: CGSize(width: width, height: 0))
}
@robertpainsi
robertpainsi / commit-message-guidelines.md
Last active November 13, 2025 00:40
Commit message guidelines

Commit Message Guidelines

Short (72 chars or less) summary

More detailed explanatory text. Wrap it to 72 characters. The blank
line separating the summary from the body is critical (unless you omit
the body entirely).

Write your commit message in the imperative: "Fix bug" and not "Fixed
bug" or "Fixes bug." This convention matches up with commit messages
@oleander
oleander / Makefile
Created April 6, 2017 12:26
How to use the Swift Package Manager and CocoaPods within the same XCode application
APP="MyApp"
CONSTRUCT=xcodebuild -workspace $(APP).xcworkspace -scheme $(APP) clean
install_deps:
pod install
create_config:
swift package fetch
swift package generate-xcodeproj
wipe:
rm -rf .build $(APP).xcodeproj $(APP).xcworkspace Package.pins Pods Podfile.lock
enum DateStride {
case year(Int)
case month(Int)
case day(Int)
var component: Calendar.Component {
switch self {
case .year(_):
return .year
@nor0x
nor0x / UICollectionView + NSFetchedResultsController.swift
Last active March 21, 2021 12:52 — forked from nazywamsiepawel/UICollectionView + NSFetchedResultsController.swift
UICollectionView + NSFetchedResultsController Swift 3 / iOS 10
var _fetchedResultsController: NSFetchedResultsController<Entity>? = nil
var blockOperations: [BlockOperation] = []
var fetchedResultController: NSFetchedResultsController<Entity> {
if _fetchedResultsController != nil {
return _fetchedResultsController!
}
let fetchRequest: NSFetchRequest<Entity> = Entity.fetchRequest()
let managedObjectContext = (UIApplication.shared.delegate as! AppDelegate).managedObjectContext!
@mackuba
mackuba / wwdc16.md
Last active March 5, 2023 21:28
New stuff from WWDC 2016

Following the tradition from last year, here's my complete list of all interesting features and updates I could find in Apple's OSes, SDKs and developer tools that were announced at this year's WWDC. This is based on the keynotes, the "What's New In ..." presentations and some others, Apple's release notes, and blog posts and tweets that I came across in the last few weeks.

If for some reason you haven't watched the talks yet, I really recommend watching at least the "State of the Union" and the "What's New In" intros for the platforms you're interested in. The unofficial WWDC Mac app is great way to download the videos and keep track of what you've already watched.

If you're interested, here are my WWDC 2015 notes (might be useful if you're planning to drop support for iOS 8 now and start using some iOS 9 APIs).


OSX → macOS 10.12 Sierra