Skip to content

Instantly share code, notes, and snippets.

View deda9's full-sized avatar
🍁
Learning is always fun

Bassem Qoulta deda9

🍁
Learning is always fun
View GitHub Profile
import Foundation
import UIKit
struct ViewStyle<T> {
let style: (T) -> Void
}
let filled = ViewStyle<UIButton> {
$0.setTitleColor(.white, for: .normal)
$0.backgroundColor = .red
@shaps80
shaps80 / ResponderController.swift
Created November 5, 2018 19:26
A convenient controller for working with the responder chain on iOS
import UIKit
/// Provides a convenient controller for working with the responder chain
public final class ResponderController: NSObject, NSCopying {
/// When true, the responder will loop through the responders when reaching the ends
@IBInspectable
public var isContinuous: Bool = true
@shaps80
shaps80 / FontCacheDescriptor+Graphik.swift
Last active March 19, 2024 14:54
Better font loading in iOS with Swift
extension UIFont {
// The `rawValue` MUST match the filename (without extension)
public enum Graphik: String, FontCacheDescriptor {
case regular = "GraphikAltWeb-Regular"
case medium = "GraphikAltWeb-Medium"
case regularItalic = "GraphikAltWeb-RegularItalic"
case mediumItalic = "GraphikAltWeb-MediumItalic"
}
@lattner
lattner / TaskConcurrencyManifesto.md
Last active June 19, 2024 13:41
Swift Concurrency Manifesto

Note

Apple will reject apps that are using private url schemes (Ugh, Apple....) if they are pretty much obvius. Some apps are rejected and others are not, so, be aware of this issue before implementing any of those URL's in your app as a feature.

Updates

  • [UPDATE 4] iOS 10 update: apparently settings now can be reached using App-Pref instead of prefs
  • [UPDATE 3] For now you just can use url schemes to open your apps's settings with Swift 3.0 (Xcode 8). I'll keep you informed when OS preferences can be reached
  • [UPDATE 2] The openURL() method of UIApplication is now deprecated. You should use application(_:open:options:) instead
  • [UPDATE 1] Not yet tested in iOS 10. It will fail because of policies changes in URL scheme handling.
sudo apt-get install calibre
ebook-convert a.pdf a.mobi
@vasanthk
vasanthk / System Design.md
Last active June 23, 2024 04:30
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@jacobbubu
jacobbubu / ioslocaleidentifiers.csv
Created February 15, 2012 14:41
iOS Locale Identifiers
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
mr Marathi
bs Bosnian
ee_TG Ewe (Togo)
ms Malay
kam_KE Kamba (Kenya)
mt Maltese
ha Hausa
es_HN Spanish (Honduras)
ml_IN Malayalam (India)
ro_MD Romanian (Moldova)