Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@zoul
zoul / OSStatus.m
Created October 19, 2010 08:21
Decode OSStatus error codes into strings.
NSString *NSStringFromOSStatus(OSStatus errCode)
{
if (errCode == noErr)
return @"noErr";
char message[5] = {0};
*(UInt32*) message = CFSwapInt32HostToBig(errCode);
return [NSString stringWithCString:message encoding:NSASCIIStringEncoding];
}
@zoul
zoul / DownloadOperation.h
Created September 14, 2010 06:36
Asynchronous NSURLConnection in concurrent NSOperation
@interface DownloadOperation : NSOperation
{
NSURLRequest *request;
NSURLConnection *connection;
NSMutableData *receivedData;
}
@property(readonly) BOOL isExecuting;
@property(readonly) BOOL isFinished;
@zoul
zoul / Česko.Digital.Info.md
Last active July 1, 2019 16:31
Poznámky k publikování informací z projektu Česko.Digital

Česko.Digital.Info

Cílem projektu Česko.Digital je zlepšit stát pomocí digitálních technologií a hlavním výstupem projektu je tedy software. Pro úspěch projektu je ale stejně důležité, ne-li důležitější, produkovat také informace, zejména know-how.

Cílové skupiny a problémy

Hlavní příjemci těchto informací jsou dva: stát a samotná komunita kolem Česko.Digital.

Stát potřebuje příklady dobré praxe a podporu při vývoji vlastních řešení, ať už jde o samotné technologie nebo řízení projektů. Česko.Digital by v tomto ohledu vlastně zastupovalo neexistující podporu digitalizace ze strany státu (viz například rozhovor s Michalem Bláhou pro podcast Proti proudu). Hezkým jednoduchým příkladem je britský Technology Code of Practice definující základní kritéria pro návrh, vývoj a nakupování státních IT technologií.

@zoul
zoul / AVAssetExportSession+Testing.m
Created November 8, 2010 08:35
Export assets synchronously. Good for testing.
@implementation AVAssetExportSession (Testing)
- (void) exportSynchronously
{
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
[self exportAsynchronouslyWithCompletionHandler:^{
dispatch_semaphore_signal(semaphore);
}];
dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
dispatch_release(semaphore);
@zoul
zoul / build-notifier.rb
Last active May 17, 2018 15:21
Posts a message to the OS X notification center when a Jekyll build is finished. Requires TerminalNotifier, see http://git.io/5X99Eg or “gem install terminal-notifier”.
begin
require 'terminal-notifier'
module Jekyll
class Site
alias jekyll_process process
def process
jekyll_process
TerminalNotifier.notify('Jekyll rebuild finished.')
end
end
@zoul
zoul / UIImage+ForceLoad.m
Created September 14, 2010 07:06
Forces UIImage to load and decode its data
@implementation UIImage (ForceLoading)
- (void) forceLoad
{
const CGImageRef cgImage = [self CGImage];
const int width = CGImageGetWidth(cgImage);
const int height = CGImageGetHeight(cgImage);
const CGColorSpaceRef colorspace = CGImageGetColorSpace(cgImage);
@zoul
zoul / Foo.h
Created January 5, 2011 14:24
Synthesized properties in Objective-C without instance variables
@interface Foo : NSObject {}
@property(assign) float foo;
@end
@zoul
zoul / Sound.h
Created October 9, 2009 08:09
Simple wrapper around Audio Services
/*
- Trivial wrapper around system sound as provided by Audio Services.
- Don’t forget to link against the Audio Toolbox framework.
- Assumes ARC support.
*/
@interface Sound : NSObject
// Path is relative to the resources dir.
- (id) initWithPath: (NSString*) path;
@zoul
zoul / cotel.yml
Created October 23, 2015 15:53
A sample YAML schema for Cotel™
- title: Cloud Architecture Tutorial
url: http://www.slideshare.net/adrianco/cloud-architecture-tutorial
tags: [cloud, Java, AWS]
@zoul
zoul / Foo.m
Created November 16, 2011 10:04
IBOutlets in private interfaces
#import "Foo.h"
// Private Foo interface. The IBOutlet will get picked up by Interface Builder!
@interface Foo ()
@property(strong) IBOutlet UIView *someView;
@end
@implementation Foo
@synthesize someView;