Skip to content

Instantly share code, notes, and snippets.

🕶
Encrypting Bits

Richard Stelling rjstelling

🕶
Encrypting Bits
Block or report user

Report or block rjstelling

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View SynchronizedArray.swift
import Foundation
import PlaygroundSupport
/// A thread-safe array.
public class SynchronizedArray<Element> {
private let queue = DispatchQueue(label: "io.zamzam.ZamzamKit.SynchronizedArray", attributes: .concurrent)
private var array = [Element]()
public init() { }
View scalecrop.swift
import UIKit
// Swift rewrite challenge
// Starting point: https://gist.github.com/jkereako/200342b66b5416fd715a#file-scale-and-crop-image-swift
func scaleAndCropImage(
image: UIImage,
toSize size: CGSize,
fitImage: Bool = true
) -> UIImage {
View scale-and-crop-image.swift
// credit: http://stackoverflow.com/questions/603907/uiimage-resize-then-crop#605385
func scaleAndCropImage(_ image:UIImage, toSize size: CGSize) -> UIImage {
// Make sure the image isn't already sized.
guard !image.size.equalTo(size) else {
return image
}
let widthFactor = size.width / image.size.width
let heightFactor = size.height / image.size.height
var scaleFactor: CGFloat = 0.0
@neilco
neilco / RSASHA1.swift
Created Apr 27, 2015
RSA-SHA1 signing with a PKCS#12 private key
View RSASHA1.swift
//
// RSASHA1.swift
//
// Copyright (c) 2015 Neil Cowburn. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
@jspahrsummers
jspahrsummers / GHRunLoopWatchdog.h
Created Jan 28, 2015
A class for logging excessive blocking on the main thread
View GHRunLoopWatchdog.h
/// Observes a run loop to detect any stalling or blocking that occurs.
///
/// This class is thread-safe.
@interface GHRunLoopWatchdog : NSObject
/// Initializes the receiver to watch the specified run loop, using a default
/// stalling threshold.
- (id)initWithRunLoop:(CFRunLoopRef)runLoop;
/// Initializes the receiver to detect when the specified run loop blocks for
@seanwolter
seanwolter / README.md
Last active Jan 4, 2017
Scripts we use on our Xcode Bots CI server
View README.md

The following plists and scripts are used on VOKAL's iOS build server. Thanks to the magic of launchd the backup script runs once a day and the dropoff script runs as needed. The dropoff script imports p12 files to the system keychain and moves provisioning files to correct folder.

To use these scripts put them somewhere safe, then put the plist files in /Library/LaunchDaemons Update the paths to the scripts, fix the ACCESS_KEY_ID and SECRET_ACCESS_KEY variables, and you're on your way.

If you have questions about Daemons and Agents look at Apple's technote: https://developer.apple.com/library/mac/technotes/tn2083/_index.html

More docs: https://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/Introduction.html#//apple_ref/doc/uid/10000172i-SW1-SW1

@odrobnik
odrobnik / BCKEAN13Code.m
Last active Dec 20, 2015
First progress on making a modern EAN13 Barcode generator ...
View BCKEAN13Code.m
//
// BCKEAN13Code.m
// BarCodeKit
//
// Created by Oliver Drobnik on 8/9/13.
// Copyright (c) 2013 Oliver Drobnik. All rights reserved.
//
#import "BCKEAN13Code.h"
@eternalstorms
eternalstorms / Apple Evangelists.txt
Created Jun 12, 2013
Apple Evangelists (WWDC 2013)
View Apple Evangelists.txt
UI- and App Frameworks Evangelist - Jake Behrens, behrens@apple.com, twitter: @Behrens
- What's new in Cocoa
- Accessibility in iOS
- Building User Interfaces for iOS 7
- Getting Started with UIKit Dynamics
- What's new in Cocoa Touch
- What's New With Multitasking
- Best Practices for Cocoa Animation
- Improving Power Efficiency with App Nap
- Introducing Text Kit
anonymous
anonymous / NSString+Verbose.h
Created Dec 12, 2012
An NSString category for overly verbose methods that have little or no practical application.
View NSString+Verbose.h
//
// NSString+Verbose.h
//
// An NSString category for overly verbose methods that have little or no practical application.
//
@interface NSString (Verbose)
@adamawolf
adamawolf / Apple_mobile_device_types.txt
Last active Jun 25, 2019
List of Apple's mobile device codes types a.k.a. machine ids (e.g. `iPhone1,1`, `Watch1,1`, etc.) and their matching product names
View Apple_mobile_device_types.txt
i386 : iPhone Simulator
x86_64 : iPhone Simulator
iPhone1,1 : iPhone
iPhone1,2 : iPhone 3G
iPhone2,1 : iPhone 3GS
iPhone3,1 : iPhone 4
iPhone3,2 : iPhone 4 GSM Rev A
iPhone3,3 : iPhone 4 CDMA
iPhone4,1 : iPhone 4S
iPhone5,1 : iPhone 5 (GSM)
You can’t perform that action at this time.