Skip to content

Instantly share code, notes, and snippets.

@vixvix
vixvix / noSQL for iOS
Created December 21, 2013 02:51
noSQL for iOS
http://docs.couchbase.com/couchbase-lite/cbl-ios/
https://github.com/couchbase/couchbase-lite-ios
https://github.com/tciuro/NanoStore
@vixvix
vixvix / python twitter
Last active December 28, 2015 22:59
python twitter
https://github.com/sixohsix/twitter
https://github.com/ryanmcgrath/twython
https://github.com/bear/python-twitter
https://github.com/joshthecoder/tweepy
@vixvix
vixvix / button on tableViewCell
Created November 15, 2013 22:33
button on tableViewCell
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
...
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
...
// set the button's target to this table view controller so we can interpret touch events and map that to a NSIndexSet
[button addTarget:self action:@selector(checkButtonTapped:event:) forControlEvents:UIControlEventTouchUpInside];
...
cell.accessoryView = button;
@vixvix
vixvix / Remove all subviews
Created November 7, 2013 20:20
objective-c remove all subviews
For NSView (desktop Mac development only), you can simply use the following:
[someNSView setSubviews:[NSArray array]];
For UIView (iOS development only), you can safely use makeObjectsPerformSelector: because the subviews property will return a copy of the array of subviews:
[[someUIView subviews] makeObjectsPerformSelector:@selector(removeFromSuperview)];
http://stackoverflow.com/questions/2156015/remove-all-subviews
@vixvix
vixvix / obj-c singleton
Created October 30, 2013 14:56
obj-c singleton
+ (id)sharedManager {
static MyManager *sharedMyManager = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedMyManager = [[self alloc] init];
});
return sharedMyManager;
}
@vixvix
vixvix / pop back 2 controllers on the stack to the setup screen
Created October 30, 2013 14:32
pop back 2 controllers on the stack to the setup screen
http://stackoverflow.com/questions/4985816/how-do-i-pop-the-view-controller-underneath-a-pushed-view-controller
// pop back 2 controllers on the stack to the setup screen
//
// locally store the navigation controller since
// self.navigationController will be nil once we are popped
//
UINavigationController *navController = self.navigationController;
#ifndef ma_concurrent_queue_h
#define ma_concurrent_queue_h
// Based on code from http://www.justsoftwaresolutions.co.uk/threading/implementing-a-thread-safe-queue-using-condition-variables.html
// Original version by Anthony Williams
// Modifications by Michael Anderson
#include "boost/thread.hpp"
#include <deque>