Skip to content

Instantly share code, notes, and snippets.

View giannigdev's full-sized avatar

Gianni giannigdev

View GitHub Profile
@calebd
calebd / ArrayHelpers.swift
Last active November 4, 2022 15:17
Swift Helpers
extension Array {
func first() -> Element? {
if isEmpty {
return nil
}
return self[0]
}
func last() -> Element? {
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DVTConsoleDebuggerInputTextColor</key>
<string>0.052 0.489 0.482 1</string>
<key>DVTConsoleDebuggerInputTextFont</key>
<string>Menlo-Bold - 11.0</string>
<key>DVTConsoleDebuggerOutputTextColor</key>
<string>0.432 0.325 0.276 1</string>
@Machx
Machx / Blackboard.dvtcolortheme
Created February 4, 2011 20:02
Blackboard theme from TextMate for Xcode 4
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DVTConsoleDebuggerInputTextColor</key>
<string>1 1 1 1</string>
<key>DVTConsoleDebuggerInputTextFont</key>
<string>Menlo-Bold - 11.0</string>
<key>DVTConsoleDebuggerOutputTextColor</key>
<string>1 1 1 1</string>
@michaelochs
michaelochs / NSFormattingContextDynamic.m
Created December 13, 2016 15:37
`NSFormattingContextDynamic` makes a formatter return string proxies that change based on where you but them inside a format string.
NSDate *date = [NSDate new];
NSDateFormatter *dateFormatter = [NSDateFormatter new];
dateFormatter.locale = [NSLocale localeWithLocaleIdentifier:@"nl_NL"];
dateFormatter.dateStyle = NSDateFormatterFullStyle;
dateFormatter.formattingContext = NSFormattingContextDynamic; // this is the important setting
NSString *dateString = [dateFormatter stringFromDate:date];
NSString *s1 = [NSString stringWithFormat:@"Foo %@", dateString]; // "Foo dinsdag 13 december 2016"
@subdigital
subdigital / ObsidianCode.dvtcolortheme
Created February 21, 2011 20:24
Obsidian Code Theme for Xcode
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DVTConsoleDebuggerInputTextColor</key>
<string>0 0 0 1</string>
<key>DVTConsoleDebuggerInputTextFont</key>
<string>Menlo-Bold - 11.0</string>
<key>DVTConsoleDebuggerOutputTextColor</key>
<string>0 0 0 1</string>
@Angles
Angles / Open-source-iOS-apps.md
Created July 25, 2012 19:21
real iOS apps with GitHub open source repos

Real iOS Apps in AppStore, with source on GitHub:

thanks 4 putting source for a noob to learn a little

I've used these:

@steipete
steipete / gist:d76549ec262430354e7c
Last active December 3, 2018 23:56
Our set of warnings in PSPDFKit
//
// Warnings.xcconfig
//
// The list of warnings we (don’t) use, and the reasons why.
//
// :MARK: Warnings in use:
// :MARK: -everything
// We want the best possible diagnostics, so we simply enable everything that exists, and then opt–out of what doesn’t make sense for us.
//
// :MARK: - Warnings not to be promoted:
enum FizzBuzz {
case fizz
case buzz
case fizzBuzz
case number(Int)
init(rawValue: Int) {
switch (rawValue % 3, rawValue % 5) {
case (0, 0): self = .fizzBuzz
case (0, _): self = .fizz
@modocache
modocache / gist:82a32312af663ea59782
Created September 27, 2015 17:00
Xcode Stack Trace
Process: Xcode [59837]
Path: /Applications/Xcode-beta.app/Contents/MacOS/Xcode
Identifier: com.apple.dt.Xcode
Version: 7.1 (9069)
Build Info: IDEFrameworks-9069000000000000~10
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Xcode [59837]
User ID: 1199935289
import Foundation
extension String {
var isHomogeneous: Bool {
if lengthOfBytesUsingEncoding(NSUTF8StringEncoding) == 0 {
return true
}
var homogeneous = true
var character: NSString?