Skip to content

Instantly share code, notes, and snippets.

@dodikk
dodikk / BaconFail
Created January 8, 2013 21:41 — forked from anonymous/BaconFail
describe "Fail test" do
it "always fails" do
(1).should.equal 2
end
end
NSURLConnection | NSURLSession
------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------
NSURLConnectionDelegate connectionShouldUseCredentialStorage: |
------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------
NSURLConnectionDelegate connection:willSendRequestForAuthenticationChallenge: | NSURLSessionDelegate URLSession:didReceiveChallenge:completionHandler:
| N
import Foundation
infix operator +=! { associativity right precedence 90 } // Int32 or Int64
infix operator -=! { associativity right precedence 90 } // Int32 or Int64
postfix operator ++! {} // Int32 or Int64
postfix operator --! {} // Int32 or Int64
infix operator |=! { associativity right precedence 90 } // UInt32
infix operator &=! { associativity right precedence 90 } // UInt32
@dodikk
dodikk / StackTrace.txt
Created March 27, 2017 15:42 — forked from soxjke/StackTrace.txt
RaceCondition2
Thread 5Queue : com.apple.root.user-initiated-qos (concurrent)
#0 0x000000010f181d2b in objc_release ()
#1 0x000000010f1831d1 in (anonymous namespace)::AutoreleasePoolPage::pop(void*) ()
#2 0x00000001125037ce in _dispatch_root_queue_drain ()
#3 0x0000000112503059 in _dispatch_worker_thread3 ()
#4 0x00000001128cb4de in _pthread_wqthread ()
#5 0x00000001128c9341 in start_wqthread ()
enum APIError : ErrorType {
// Can't connect to the server (maybe offline?)
case ConnectionError(error: NSError)
// The server responded with a non 200 status code
case ServerError(statusCode: Int, error: NSError)
// We got no data (0 bytes) back from the server
case NoDataError
// The server response can't be converted from JSON to a Dictionary
case JSONSerializationError(error: ErrorType)
// The Argo decoding Failed
@dodikk
dodikk / Localized.swift
Created May 5, 2017 09:43 — forked from tapoton/Localized.swift
Strongly typed localization for domain grouped strings.
import Foundation
protocol Domain {
associatedtype Parent = Domain
static var name: String { get }
static var fullName: String { get }
}
@dodikk
dodikk / PhotosCameraRoll.m
Created May 19, 2017 14:40 — forked from Koze/PhotosCameraRoll.m
Getting Camera Roll with Photos.framework
PHFetchResult *result = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeSmartAlbum
subtype:PHAssetCollectionSubtypeSmartAlbumUserLibrary
options:nil];
PHAssetCollection *assetCollection = result.firstObject;
NSLog(@"%@", assetCollection.localizedTitle);
// Camera Roll
@dodikk
dodikk / uuid_test.c
Created October 23, 2017 10:10 — forked from yoggy/uuid_test.c
libuuid sample program
//
// libuuid sample program
//
// library install for debian
// $ sudo apt-get install uuid-dev
//
// compile
// $ gcc uuid_test.c -luuid -o uuid_test
//
#include <stdio.h>
@dodikk
dodikk / NSObject+Debounce.h
Created February 21, 2018 11:31 — forked from berzniz/NSObject+Debounce.h
Debounce method for Objective C
@interface NSObject (Debounce)
- (void)debounce:(SEL)action delay:(NSTimeInterval)delay;
@end
@dodikk
dodikk / debounce-throttle.swift
Created February 21, 2018 11:37 — forked from simme/debounce-throttle.swift
Swift 3 debounce & throttle
//
// debounce-throttle.swift
//
// Created by Simon Ljungberg on 19/12/16.
// License: MIT
//
import Foundation
extension TimeInterval {