Skip to content

Instantly share code, notes, and snippets.

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

Faiz Mokhtar faizmokh

🏠
Working from home
View GitHub Profile
class ViewController: UIViewController {
lazy var lottieView: AnimationView = {
let view = AnimationView()
view.translatesAutoresizingMaskIntoConstraints = false
view.loopMode = .loop
view.contentMode = .scaleAspectFit
return view
}()
import AuthenticationServices
import RxCocoa
import RxSwift
import UIKit
@available(iOS 13.0, *)
extension ASAuthorizationController: HasDelegate {
public typealias Delegate = ASAuthorizationControllerDelegate
}
@faizmokh
faizmokh / AutoLayoutDSL.swift
Created May 27, 2021 04:05 — forked from V8tr/AutoLayoutDSL.swift
Auto Layout DSL
import UIKit
/// Represents a single `NSLayoutConstraint`
enum LayoutAnchor {
case constant(attribute: NSLayoutConstraint.Attribute,
relation: NSLayoutConstraint.Relation,
constant: CGFloat)
case relative(attribute: NSLayoutConstraint.Attribute,
relation: NSLayoutConstraint.Relation,
ACTION = build
AD_HOC_CODE_SIGNING_ALLOWED = NO
ALTERNATE_GROUP = staff
ALTERNATE_MODE = u+w,go-w,a+rX
ALTERNATE_OWNER = grantdavis
ALWAYS_SEARCH_USER_PATHS = NO
ALWAYS_USE_SEPARATE_HEADERMAPS = YES
APPLE_INTERNAL_DEVELOPER_DIR = /AppleInternal/Developer
APPLE_INTERNAL_DIR = /AppleInternal
APPLE_INTERNAL_DOCUMENTATION_DIR = /AppleInternal/Documentation
/*
HookHandler - listen for github webhooks, sending updates on channel.
DeploymentMonitor select update type based on channel and call deployment script
*/
package main
import (
"fmt"
"html/template"
"io/ioutil"
@faizmokh
faizmokh / .gitconfig
Created November 21, 2018 01:49 — forked from robmiller/.gitconfig
Some useful Git aliases that I use every day
#
# Working with branches
#
# Get the current branch name (not so useful in itself, but used in
# other aliases)
branch-name = "!git rev-parse --abbrev-ref HEAD"
# Push the current branch to the remote "origin", and set it to track
# the upstream branch
publish = "!git push -u origin $(git branch-name)"
@faizmokh
faizmokh / helpers.swift
Created November 20, 2018 04:32 — forked from kastiglione/helpers.swift
Swift helpers, and the lldb setup to use them. Presented @ SLUG https://speakerdeck.com/kastiglione/advanced-debugging-and-swift
extension UIView {
/// Example: call someView.nudge(0, 30)
func nudge(_ dx: CGFloat, _ dy: CGFloat) {
self.frame = self.frame.offsetBy(dx: dx, dy: dy)
CATransaction.flush()
}
}
extension UIView {
/// Example: po UIView.root
@faizmokh
faizmokh / gist:6483403fadc747a9d9b2f67a83a6fab7
Created October 10, 2018 04:14 — forked from steipete/ios-xcode-device-support.sh
Using iOS 12.1 devices with Xcode 10.0
// The trick is to link the DeviceSupport folder from the beta to the stable version.
// Updated on Oct 9th, 2018 for Xcode 10
ln -s /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/12.1\ \(16B5068g\) /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
// Then restart Xcode and reconnect your devices. You will need to do that for every beta of future iOS versions
// sudo needed if you run the Mac App Store version. Always download the dmg instead... you'll thank me later :)
@faizmokh
faizmokh / NibLoadableView.swift
Created September 5, 2018 13:40 — forked from eMdOS/NibLoadableView.swift
Reusable views and cell registration and dequeuing (for table views and collection views)
protocol NibLoadableView: class {
static var nibName: String { get }
}
extension NibLoadableView where Self: UIView {
static var nibName: String {
return String(describing: self)
}
}
@faizmokh
faizmokh / UIAlertController+TextField.swift
Created August 17, 2018 15:18 — forked from ole/UIAlertController+TextField.swift
A UIAlertController with a text field and the ability to perform validation on the text the user has entered while the alert is on screen. The OK button is only enabled when the entered text passes validation. More info: https://oleb.net/2018/uialertcontroller-textfield/
import UIKit
/// A validation rule for text input.
public enum TextValidationRule {
/// Any input is valid, including an empty string.
case noRestriction
/// The input must not be empty.
case nonEmpty
/// The enitre input must match a regular expression. A matching substring is not enough.
case regularExpression(NSRegularExpression)