Skip to content

Instantly share code, notes, and snippets.

@aki-null
aki-null / gist:1497649
Created December 19, 2011 15:23
Core Text APIを使用した際に起こる行間の問題の回避
NSFont *normalFont = [NSFont systemFontOfSize:12];
CGRect renderFrame = CGRectMake(0, 0, 300, 50); // box to render the text into
static NSLayoutManager *layMan = nil;
if (!layMan) {
layMan = [NSLayoutManager new];
}
CGFloat lineHeight = [layMan defaultLineHeightForFont:normalFont]; // calculate the expected height of a line
NSDictionary *attrDict = [NSDictionary dictionaryWithObject:normalFont andKey:NSFontAttributeName];
@adamawolf
adamawolf / Apple_mobile_device_types.txt
Last active November 18, 2024 09:05
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
i386 : iPhone Simulator
x86_64 : iPhone Simulator
arm64 : 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
import Foundation
final class SafeSyncQueue {
struct QueueIdentity {
let label: String
}
let queue: DispatchQueue
@koher
koher / each-pair-without-any-sequence.md
Created March 3, 2017 03:12
`eachPair` without `AnySequence`

eachPair without AnySequence

extension Sequence where Self.SubSequence: Sequence {
  func eachPair() -> Zip2Sequence<Self, Self.SubSequence> {
    return zip(self, self.dropFirst())
  }
}

(1...10).eachPair().forEach { print($0) }
@Sherlouk
Sherlouk / metrickit-diag.sample.json
Created August 8, 2020 21:34
MetricKit Sample JSON (iOS 14)
{
"crashDiagnostics" : [
{
"version" : "1.0.0",
"callStackTree" : {
"callStacks" : [
{
"threadAttributed" : true,
"callStackRootFrames" : [
{