Skip to content

Instantly share code, notes, and snippets.

Avatar

Sasmito Adibowo adib

View GitHub Profile
@adib
adib / BSManagedDocument.h
Created Sep 11, 2012
An NSDocument subclass that supports asynchronous Core Data operations
View BSManagedDocument.h
//
// BSManagedDocument.h
//
// Created by Sasmito Adibowo on 29-08-12.
// Copyright (c) 2012 Basil Salad Software. All rights reserved.
// http://basilsalad.com
//
// Licensed under the BSD License <http://www.opensource.org/licenses/bsd-license>
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
@adib
adib / ViewController.swift
Created Jul 29, 2017
View Model app restoration setup
View ViewController.swift
class ViewController : UIViewController {
override func decodeRestorableState(with coder: NSCoder) {
super.decodeRestorableState(with: coder)
// force class initialization for the sake of state restoration
ViewModel.classInit
viewModel = coder.decodeObject(of: ViewModel.self, forKey: "viewModel")
}
}
@adib
adib / gist:5341936
Last active Jul 7, 2016
Custom Cookie Storage, rev 2.
View gist:5341936
//
// BSHTTPCookieStorage.h
//
// Created by Sasmito Adibowo on 02-07-12.
// Copyright (c) 2012 Basil Salad Software. All rights reserved.
// http://basilsalad.com
//
// Licensed under the BSD License <http://www.opensource.org/licenses/bsd-license>
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
@adib
adib / BSAlertViewDelegateBlock.h
Created Jan 2, 2014
Generic UIAlertViewDelegate implementation that translates into a convenient block-based API. Go to http://cutecoder.org to read how to use this.
View BSAlertViewDelegateBlock.h
//
// BSAlertViewDelegateBlock.h
// SpeechTimer2
//
// Created by Sasmito Adibowo on 25-12-13.
// Copyright (c) 2013-2014 Basil Salad Software. All rights reserved.
//
// Licensed under the BSD License <http://www.opensource.org/licenses/bsd-license>
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
@adib
adib / gist:4752376
Last active Dec 12, 2015
JSON parsing data type support
View gist:4752376
// JSONSupport.m
// Created by Sasmito Adibowo on 29-08-12.
// Copyright (c) 2012 Basil Salad Software. .
// http://basilsalad.com
//
// Licensed under the BSD License <http://www.opensource.org/licenses/bsd-license>
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
// SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
@adib
adib / gist:3811879
Created Oct 1, 2012
Method of the block that AppCode 1.6 couldn't refactor
View gist:3811879
+(void) refreshFeedWithType:(BSYammerFeedType) feedType
threadType:(BSYammerFeedThreadType) threadType
olderThan:(BSYammerMessage*) oldestMessage
newerThan:(BSYammerMessage*) latestMessage
associatedWith:(NSManagedObject<BSYammerEntity>*) associatedEntity
fromAccount:(BSYammerContext*) accountContext
limit:(int) maxMessages
toManagedObjectContext:(NSManagedObjectContext*) objectContext
completionHandler:(void(^)(NSArray* objectIDs,NSError* errorOrNil)) completionHandler
{
@adib
adib / BSManagedDocument.h
Created Sep 6, 2012
Asynchronous saving of Core Data document for Mac OS X
View BSManagedDocument.h
//
// BSManagedDocument.h
// Scuttlebutt
//
// Created by Sasmito Adibowo on 29-08-12.
// Copyright (c) 2012 Basil Salad Software. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@adib
adib / NSArray+FoundationAdditions.m
Created Jul 23, 2012
Sparse Array - FoundationAdditions
View NSArray+FoundationAdditions.m
@implementation NSArray (FoundationAdditions)
-(id) objectAtCheckedIndex:(NSUInteger) index {
if(index >= self.count) {
return nil;
} else {
id result = [self objectAtIndex:index];
return result == [NSNull null] ? nil : result;
}
}
@adib
adib / gist:2020649
Created Mar 12, 2012
Perform Object After Delay
View gist:2020649
[[NSOperationQueue mainQueue] performSelector:@selector(addOperation:) withObject:^{
// do your stuff here
} afterDelay:3.0];
View BSGLView.h
//
// BSGLView.h
// AirKill
//
// Created by Sasmito Adibowo on 07-06-14.
// Basil Salad Software, http://basilsalad.com
//
// This code is in the public domain.
#import "CCGLView.h"
You can’t perform that action at this time.