Skip to content

Instantly share code, notes, and snippets.

Andreas Grosam couchdeveloper

  • South Germany
Block or report user

Report or block couchdeveloper

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 TaskQueue
//
// TaskQueue.swift
//
// Copyright © 2017 Andreas Grosam. All rights reserved.
//
import Dispatch
/**
View DataRaceDemo.swift
import Foundation
func test(completion: (Int) -> ()) {
let queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)
//let queue = dispatch_queue_create("serial queue", DISPATCH_QUEUE_SERIAL)
var counter = 0
let grp = dispatch_group_create()
@couchdeveloper
couchdeveloper / RXTimer.h
Last active Jul 29, 2019
A timer based on dispatch_source_create() Objective-C
View RXTimer.h
//
// RXTimer.h
//
// Copyright 2013 Andreas Grosam
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
@couchdeveloper
couchdeveloper / RXAsynchronousOperation.h
Last active Dec 29, 2015
A RXStreamToStreamCopier asynchronously copies the content of a source stream into a destination stream.
View RXAsynchronousOperation.h
//
// RXAsynchronousOperation.h
//
// Copyright 2013 Andreas Grosam
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
@couchdeveloper
couchdeveloper / transform_each.m
Last active Oct 30, 2016
Asynchronous Pattern with GCD Part I
View transform_each.m
/**
Objective:
Asynchronously transform or process an array of items - one after the
other and return the result of each transform in an array.
Synopsis:
void transform_each(NSArray* inArray, unary_async_t task, completion_t completion);
@couchdeveloper
couchdeveloper / SimpleGetHTTPRequest.h
Last active Dec 18, 2015
SimpleGetHTTPRequest This is a simple Objective-C class which wraps a `NSURLConnection` and relevant state information. It's meant to give an idea how one can implement a more "real" and more versatile connection class. It's deliberately kept simple.
View SimpleGetHTTPRequest.h
//
// SimpleGetHTTPRequest.h
//
#import <Foundation/Foundation.h>
typedef void (^completionHandler_t) (id result);
@couchdeveloper
couchdeveloper / NSOperationQueue
Created May 10, 2013
Play around with NSOperationQueue and NSOperation.
View NSOperationQueue
#import <Foundation/Foundation.h>
#include <dispatch/dispatch.h>
@interface Operation : NSOperation
@property (nonatomic, readwrite) BOOL isExecuting;
@property (nonatomic, readwrite) BOOL isFinished;
@property (nonatomic, readwrite) BOOL terminating;
@end
@implementation Operation {
You can’t perform that action at this time.