Skip to content

Instantly share code, notes, and snippets.

View mehmetfarhan's full-sized avatar
🚀

Mohammad Farhan mehmetfarhan

🚀
View GitHub Profile
import UIKit
import PlaygroundSupport
final class ViewController: UIViewController {
// Step 1
lazy private var draggableView: UIView = {
let view = UIView(frame: CGRect(origin: .zero, size: CGSize(width: 50, height: 50)))
view.backgroundColor = .red
return view
import AVFoundation
import UIKit
public class ScannerOverlayPreviewLayer: AVCaptureVideoPreviewLayer {
// MARK: - OverlayScannerPreviewLayer
public var cornerLength: CGFloat = 30
public var lineWidth: CGFloat = 6
@mehmetfarhan
mehmetfarhan / PaddedLabel.swift
Last active April 26, 2019 21:37
PaddedLabel
//
// PaddedLabel.swift
// PaddedLabel
//
// Created by Mohammad Farhan on 4/27/19.
// Copyright © 2019 PaddedLabel. All rights reserved.
//
import UIKit
@mehmetfarhan
mehmetfarhan / UIFont
Created December 15, 2018 11:19
Override the system font "swift 4" "iOS"
import UIKit
struct AppFontName {
static let regular = "CourierNewPSMT"
static let bold = "CourierNewPS-BoldMT"
static let italic = "CourierNewPS-ItalicMT"
}
extension UIFontDescriptor.AttributeName {
static let nsctFontUIUsage = UIFontDescriptor.AttributeName(rawValue: "NSCTFontUIUsageAttribute")
@mehmetfarhan
mehmetfarhan / ArrayDeepCopy.swift
Created September 20, 2017 05:50 — forked from sohayb/ArrayDeepCopy.swift
Array deep copy in Swift
//Protocal that copyable class should conform
protocol Copying {
init(original: Self)
}
//Concrete class extension
extension Copying {
func copy() -> Self {
return Self.init(original: self)
}
@ppamorim
ppamorim / ImageInsets.swift
Created November 5, 2015 16:30
Add padding/margin at a image!
import UIKit
extension UIImage {
func imageWithInsets(insetDimen: CGFloat) -> UIImage {
return imageWithInset(UIEdgeInsets(top: insetDimen, left: insetDimen, bottom: insetDimen, right: insetDimen))
}
func imageWithInset(insets: UIEdgeInsets) -> UIImage {
UIGraphicsBeginImageContextWithOptions(
CGSizeMake(self.size.width + insets.left + insets.right,
@danielgomezrico
danielgomezrico / UITextView+scrolls.swift
Created October 8, 2015 16:47
iOS - Swift - UITextView scroll to bottom extension
import UIKit
extension UITextView {
func scrollToBotom() {
let range = NSMakeRange(text.characters.count - 1, 1);
scrollRangeToVisible(range);
}
}
@developius
developius / README.md
Last active April 25, 2024 22:15
Setup SSH keys for use with GitHub/GitLab/BitBucket etc

Create a new repository, or reuse an existing one.

Generate a new SSH key:

ssh-keygen -t rsa -C "your_email@example.com"

Copy the contents of the file ~/.ssh/id_rsa.pub to your SSH keys in your GitHub account settings (https://github.com/settings/keys).

Test SSH key: