Skip to content

Instantly share code, notes, and snippets.

View blwinters's full-sized avatar

Ben Winters blwinters

  • Bambi
  • Cleveland, Ohio, United States
  • X @blwinters
View GitHub Profile
@weihanglo
weihanglo / thoughts-on-react-native-from-an-ios-developer.md
Last active August 2, 2023 16:51
Thoughts on React Native from an iOS developer

Thoughts on React Native from an iOS developer

React Native

About two month ago, I started making a React Native app ["PyConTW 17"][pycontw-mobile] for the biggest annual Python conference in Taiwan ([PyCon Taiwan][pycontw]). The app is quite simple, but still took some efforts for me to build. As a complete React newbie, I would like to share some of my thoughts about React Native.

(written on 2017-07-30, based on React Native 0.44.2)

@roymckenzie
roymckenzie / CloudKitBasics.swift
Last active August 10, 2022 12:01
Basic Subscription and Fetch manager and setup for CloudKit
import UIKit
import CloudKit
import RealmSwift
/// Handles common methods for subscriptions across multiple databases
enum CloudKitDatabaseSubscription: String {
case `private`
case `public`
}
@dfrib
dfrib / DictionaryKeyPath.swift
Last active April 14, 2023 12:45
Swift: Reading and writing to (possible) nested dictionaries for a given key path, using a recursive approach
// For details, see
// http://stackoverflow.com/questions/40261857/remove-nested-key-from-dictionary
import Foundation
extension Dictionary {
subscript(keyPath keyPath: String) -> Any? {
get {
guard let keyPath = Dictionary.keyPathKeys(forKeyPath: keyPath)
else { return nil }
return getValue(forKeyPath: keyPath)
@kristofer
kristofer / KeychainPasscodeRepository.swift
Created August 3, 2016 11:55
KeychainPasscodeRepository - a simple example of a ios keychain based repository for https://github.com/yankodimitrov/SwiftPasscodeLock
//
// KeychainPasscodeRepository.swift
// PasscodeLock
// a simple example of a keychain based repository
// https://github.com/yankodimitrov/SwiftPasscodeLock
// uses this fine work for easy access to Keychain
// https://cocoapods.org/pods/KeychainAccess
// written by https://github.com/kristofer
@qmchenry
qmchenry / QButton.swift
Last active November 23, 2021 18:18
Swift UIButton subclass that implements toggle and backgroundColor for states
import UIKit
class QButton: UIButton {
var isToggle: Bool = false {
didSet {
if isToggle {
self.addTarget(self, action: Selector("touchUpInside:"), forControlEvents: .TouchUpInside)
} else {
self.removeTarget(self, action: Selector("touchUpInside:"), forControlEvents: .TouchUpInside)
}
@mattt
mattt / NSDecimalNumber.swift
Last active April 1, 2023 00:06
NSDecimalNumber Additions for Swift
import Foundation
// MARK: - Comparable
extension NSDecimalNumber: Comparable {}
public func ==(lhs: NSDecimalNumber, rhs: NSDecimalNumber) -> Bool {
return lhs.compare(rhs) == .OrderedSame
}
@jaredsinclair
jaredsinclair / set-build-number.sh
Last active January 1, 2020 15:41
Git-friendly run script for automated build numbering in Xcode
# Set the build number to the current git commit count.
#
# Permanent home:
# https://gist.github.com/jaredsinclair/af6898f93674ee5923f3
#
# Based on: http://w3facility.info/question/how-do-i-force-xcode-to-rebuild-the-info-plist-file-in-my-project-every-time-i-build-the-project/
# Updated with dSYM handling from http://yellowfeather.co.uk/blog/auto-incrementing-build-number-in-xcode-revisited/
git=`sh /etc/profile; which git`
appBuild=`"$git" rev-list HEAD --count`