Skip to content

Instantly share code, notes, and snippets.

Avatar

Adam Teale adamteale

View GitHub Profile
@wata
wata / ISOString.swift
Last active May 10, 2021
A simple ISO string parsing and converting library for Swift
View ISOString.swift
public struct ISOString {
/// Parse ISO 6709 string.
/// e.g. "+34.0595-118.4460+091.541/"
/// SeeAlso: [ISO 6709](https://en.wikipedia.org/wiki/ISO_6709)
public static func parse(iso6709 text: String?) -> CLLocation? {
guard
let results = text?.capture(pattern: "([+-][0-9.]+)([+-][0-9.]+)"),
let latitude = results[safe: 1] as NSString?,
let longitude = results[safe: 2] as NSString?
else { return nil }
@isoiphone
isoiphone / UIImage+color.swift
Created Mar 28, 2016
Create UIImage of solid color
View UIImage+color.swift
extension UIImage {
class func imageWithColor(color: UIColor, size: CGSize=CGSize(width: 1, height: 1)) -> UIImage {
UIGraphicsBeginImageContextWithOptions(size, false, 0)
color.setFill()
UIRectFill(CGRect(origin: CGPoint.zero, size: size))
let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return image
}
}
@bmatcuk
bmatcuk / symbolizing_osx_crash_logs.md
Created May 29, 2014
How to symbolize OSX crash logs
View symbolizing_osx_crash_logs.md

How to Symbolize OSX Crash Logs

Unfortunately, xcode does not yet have support for importing OSX crash logs and symbolizing them. Therefore, you must use the command line and a little bit of manual work.

  1. Find your dSYM file.
    1. Assuming you are using xcode's archive functionality, open the Organizer window from the Window menu.
    2. Click the Archives tab.
    3. Right click on the appropriate build and select Show in Finder.
    4. When Finder opens, right click on the selected archive and select Show Package Contents.
    5. Navigate to the dSYM directory and copy the appropriate dSYM file to a temporary directory.
    6. Then navigate to Products, then Applications, and copy the app file to the same temporary directory.
@zenorocha
zenorocha / README.md
Last active Oct 9, 2021
A template for Github READMEs (Markdown) + Sublime Snippet
View README.md

Project Name

TODO: Write a project description

Installation

TODO: Describe the installation process

Usage

@aerickson
aerickson / rsync_with_progress.py
Created Oct 13, 2011
Get total rsync progress using Python
View rsync_with_progress.py
# from https://libbits.wordpress.com/2011/04/09/get-total-rsync-progress-using-python/
import subprocess
import re
import sys
print('Dry run:')
cmd = 'rsync -az --stats --dry-run ' + sys.argv[1] + ' ' + sys.argv[2]
proc = subprocess.Popen(cmd,
shell=True,