Skip to content

Instantly share code, notes, and snippets.

@CodingDoug
CodingDoug / README.md
Last active December 17, 2022 10:23
Copying data from Firebase Realtime Database to a Google Sheet in real time via Cloud Functions
//
// SampleCode.xcconfig
//
// The `SAMPLE_CODE_DISAMBIGUATOR` configuration is to make it easier to build
// and run a sample code project. Once you set your project's development team,
// you'll have a unique bundle identifier. This is because the bundle identifier
// is derived based on the 'SAMPLE_CODE_DISAMBIGUATOR' value. Do not use this
// approach in your own projects—it's only useful for sample code projects because
// they are frequently downloaded and don't have a development team set.
@NSExceptional
NSExceptional / XcodeBuildSettingsReference.md
Last active November 14, 2024 02:25
The Xcode Build Settings Reference in a searchable document, as of Xcode 8.3.2

Build settings reference

Active Build Action (ACTION)

A string identifying the build system action being performed.

Additional SDKs (ADDITIONAL_SDKS)

The locations of any sparse SDKs that should be layered on top of the one specified by Base SDK (SDKROOT). If more than one SDK is listed, the first one has highest precedence. Every SDK specified in this setting should be a "sparse" SDK, for example, not an SDK for an entire macOS release.

Alternate Install Group (ALTERNATE_GROUP)

@hcrub
hcrub / NSRegularExpression+Split.swift
Last active August 25, 2023 15:10
Regular Expression "split" Implementation written for Swift 3.0+.
// NSRegularExpression+Split.swift
//
// Verbatim ObjC->Swift port originating from https://github.com/bendytree/Objective-C-RegEx-Categories
extension NSRegularExpression {
func split(_ str: String) -> [String] {
let range = NSRange(location: 0, length: str.characters.count)
//get locations of matches
@ptrkstr
ptrkstr / URL+Extended.swift
Created December 19, 2016 22:53
URL Extension
extension URL {
/// Converts URL to a "https" scheme
func secure() -> URL? {
guard var comps = URLComponents(url: self, resolvingAgainstBaseURL: false) else {
return nil
}
comps.scheme = "https"
@ptrkstr
ptrkstr / NSColor+Extended.swift
Last active December 19, 2016 22:54
NSColor extension
extension NSColor {
/// Creates a NSColor from "#XXXXXX"/"XXXXXX" format
convenience init(hex: String, alpha: CGFloat = 1) {
// TODO: Validate hex string is in the "#XXXXXX" or "XXXXXX" format
let scanner = Scanner(string: hex)
scanner.scanLocation = hex[hex.startIndex] == "#" ? 1 : 0
var rgb: UInt32 = 0
@rnapier
rnapier / doOnce.swift
Last active April 20, 2022 16:12
A function that only executes once. Good Swift or over-clever?
// Swift3 gets rid of dispatch_once and recommends replacing it with a lazy global.
// That's very straightforward when dispach_once is used to initialize something, but
// isn't an exact match when you want something to execute once, and then become a noop
// in a thread-safe way.
// The following approach seems completely "correct" and I guess actually a bit elegant,
// if by "elegant" you mean "terse and not immediately obvious to the reader, which makes
// you look very clever."
var doOnce: () -> Void = {
ffmpeg -i data/video.mp4 -vcodec h264 -b:v 1000k -acodec mp2 data/output.mp4
@johndpope-karhoo
johndpope-karhoo / simulator_populator
Last active September 13, 2016 01:53 — forked from cabeca/simulator_populator
This script removes and recreates all simulators in Xcode 6.
gem install snapshot; snapshot reset_simulators
killall Xcode
sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService
rm -rf ~/Library/Developer/CoreSimulator/Devices
open /Applications/Xcode.app
@IanKeen
IanKeen / ObservableType+Weak.swift
Created April 6, 2016 18:36
Allow a more concise way to weakly subscribe to Observables using self.someFunction
//
// ObservableType+Weak.swift
//
// Created by Ian Keen on 6/04/2016.
// Copyright © 2016 Ian Keen. All rights reserved.
//
import Foundation
import RxSwift