Skip to content

Instantly share code, notes, and snippets.

Avatar

Yonat Sharon yonat

View GitHub Profile
@damienlaughton
damienlaughton / UIAccessorizedTextField.swift
Created Mar 28, 2018
UIAccessorizedTextField is an iOS friendly alternative to the drop down list
View UIAccessorizedTextField.swift
//
// UIAccessorizedTextField.swift
// AccessorizedTextField
//
// Created by Damien Laughton on 28/03/2018.
// 2018 Mobilology Limited. No rights reserved.
//
import Foundation
import UIKit
@joyrexus
joyrexus / README.md
Last active Jan 15, 2021
collapsible markdown
View README.md

collapsible markdown?

CLICK ME

yes, even hidden code blocks!

print("hello world!")
@artemnovichkov
artemnovichkov / UITableView+Dequeue.swift
Created Dec 9, 2016
UItableView dequeueing with Swift magic
View UITableView+Dequeue.swift
import UIKit
extension UITableView {
func dequeueReusableCell<T: UITableViewCell>() -> T {
return dequeueReusableCell(withIdentifier: NSStringFromClass(T.self)) as! T
}
}
//using: let cell: ExampleTableViewCell = tableView.dequeueReusableCell()
@steipete
steipete / gist:d9b44d8e9f341e81414e86d7ff8fb62d
Last active Jan 6, 2021
Using iOS 14 devices with Xcode 11.5 (instead of Xcode 12)
View gist:d9b44d8e9f341e81414e86d7ff8fb62d
// The trick is to link the DeviceSupport folder from the beta to the stable version.
// sudo needed if you run the Mac App Store version. Always download the dmg instead... you'll thank me later :)
// Support iOS 14 devices (Xcode 12.0) with Xcode 11.5:
sudo ln -s /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/14.0 /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
View .gitconfig
[alias]
st = status
ci = commit
br = branch
co = checkout
df = diff
lg = log -p
branches = for-each-ref --sort='-authordate:iso8601' --format=' %(authordate:relative)%09%(refname:short)' refs/heads
[push]
@yonat
yonat / ask.swift
Created Apr 28, 2015
ask() - Show an OK/Cancel modal box that works in both iOS 7 and iOS 8
View ask.swift
/// Show an OK/Cancel modal box that works in both iOS 7 and iOS 8
func ask(title: String, #message: String, #completion: (answer: Bool) -> Void) {
if nil != objc_getClass("UIAlertController".UTF8String) { // use UIAlertController
let alertController = UIAlertController(title: title, message: message, preferredStyle: .Alert)
let cancelAction = UIAlertAction(title: "Cancel", style: .Cancel, handler: { (action) -> Void in
completion(answer: false)
})
let okayAction = UIAlertAction(title: "OK", style: .Default, handler: { (action) -> Void in
completion(answer: true)
})
@yonat
yonat / Save-iOS-image-name.md
Last active Mar 16, 2017
Set Image Name in iOS Camera Roll
View Save-iOS-image-name.md
@yonat
yonat / Badge.swift
Last active Mar 28, 2020
Rounded UILabel and UIButton, Badged UIBarButtonItem
View Badge.swift
//
// Badge.swift
// Extensions for Rounded UILabel and UIButton, Badged UIBarButtonItem.
//
// Usage:
// let label = UILabel(badgeText: "Rounded Label");
// let button = UIButton(type: .System); button.rounded = true
// let barButton = UIBarButtonItem(badge: "42", title: "How Many Roads", target: self, action: "answer")
//
// Created by Yonat Sharon on 06.04.2015.
@pyrtsa
pyrtsa / version.bash
Last active Jan 13, 2021
Xcode: Set version and build number from Git
View version.bash
#!/bin/bash
# Xcode: Set version and build number from Git
# --------------------------------------------
#
# This script sets the version number `CFBundleShortVersionString` to one of
#
# - `1.2.3` -- for the tagged commit `v1.2.3` or a hyphen-separated prerelease,
# e.g. `v1.2.3-alpha`, `v1.2.3-alpha.2`, `v1.2.3-beta`, `v1.2.3-rc`.
# - `1.2.3-7-gabc1234` -- at commit `abc1234`, 7 commits after `v1.2.3`,
# - `1.2.3-7-gabc1234-dirty` -- when there are uncommitted changes, or
View GSRegex.swift
import Foundation
public protocol GSRegularExpressionMatchable {
func match(regex: GSRegex) -> Bool
func match(regex: NSRegularExpression) -> Bool
}
public class GSRegex: StringLiteralConvertible {
let regex: NSRegularExpression?
You can’t perform that action at this time.