Skip to content

Instantly share code, notes, and snippets.

@hishma
hishma / 256-char
Created April 8, 2014 16:39
256 Character String
THIS STRING IS 256 CHARACTERS xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
@hishma
hishma / WWDC.md
Last active April 10, 2024 07:03
WWDC 2015-2018 Session Videos

WWDC 2015-2018 Session Videos

For some reason some older WWDC session videos have been disappearing from Fruit Co's the developer site. Luckily Harish posted this this gist of URL's and titles. So I converted that JSON to this markdown doc.

Enjoy!

2018

  • 102 – Platforms State of the Union – 2018 Platforms State of the Union
  • 103 – Apple Design Awards – Join us for an unforgettable award ceremony celebrating developers and their outstanding work. The 2018 Apple Design Awards recognize state of the art iOS, macOS, watchOS, and tvOS apps that reflect excellence in design and innovation.
/*
CoreDataErrors.h
Core Data
Copyright (c) 2004-2022, Apple Inc.
All rights reserved.
*/
#import <Foundation/NSObject.h>
/* NSError codes for Core Data added errors in NSCocoaErrorDomain. Foundation error codes can be found in <Foundation/FoundationErrors.h>. AppKit error codes can be found in <AppKit/AppKitErrors.h>.
@hishma
hishma / updateBuildNumber.sh
Last active April 13, 2023 15:12
Shell script to update the build number (CFBundleVersion) of the info.plist in the build folder.
# Shamelessly ripped of from https://blog.curtisherbert.com/automated-xcode-build-numbers-early-2019-edition/
#
git=`sh /etc/profile; which git`
bundleVersion=`"$git" rev-list --all | wc -l | tr -d '[:space:]'`
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $bundleVersion" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"
echo "☛ BUILD NUMBER: ${bundleVersion}"
@hishma
hishma / CLLocation+Encodable.swift
Created January 16, 2019 23:57
CoreLocation and Codable
extension CLLocation: Encodable {
public enum CodingKeys: String, CodingKey {
case latitude
case longitude
case altitude
case horizontalAccuracy
case verticalAccuracy
case speed
case course
case timestamp
@hishma
hishma / fix-xcode-docs.md
Last active October 10, 2022 16:10
HowTo Fix Xcode Documentation

Fix for missing documentation indexes and other anomolies in the Xcode documentation viewer. Mine seemed to get all borked up with some beta relaeases. Shamelessly ripped off from this thread.

  1. Quit Xcode
  2. Delete the cache file at ~/Library/Caches/com.apple.dt.Xcode.
  3. Delete the contents of ~/Library/Developer/Shared/Documentation/DocSets/.
  4. Delete the contents of /Applications/Xcode.app/Contents/Developer/Documentation/DocSets/.
  5. Launch Xcode.
  6. Open the Preferences pane, select the Downloads tab, and download the docsets you want to use.
@hishma
hishma / versionInSettings.md
Last active May 31, 2022 07:26
Display iOS app version in settings

To display the current version of an iOS app in the settings

  1. Add an entry like this in Settings.bundle/Root.plist
<key>PreferenceSpecifiers</key>
<array>
  <dict>
    <key>Type</key>
 PSTitleValueSpecifier
@hishma
hishma / setTitleToVersionName.applescript
Created July 13, 2011 15:24
Copy the Aperture Version Name to the IPTC ObjectName (Title field in Aperture)
-- Copy the Aperture Version Name to the IPTC ObjectName (Title field in Aperture)
tell application "Aperture"
set selectedImages to (get selection)
if selectedImages is {} then
error "Please select an image."
else
repeat with i from 1 to count of selectedImages
tell library 1
tell item i of selectedImages
import Foundation
public extension String {
// MARK: - Web URL
/// Extract all web urls from a string.
func webURLs() -> [String] {
guard let detector = try? NSDataDetector(types: NSTextCheckingResult.CheckingType.link.rawValue) else {
return []
@hishma
hishma / gist:1a7e94063d37e6fec1c80ccd7f960216
Created February 15, 2021 22:35
LocationDegreesFormatter.swift
import CoreLocation
class LocationDegreesFormatter: Formatter {
enum Direction {
case none
case latitude
case longitude
}