Skip to content

Instantly share code, notes, and snippets.

Yusuke Ito novi

Block or report user

Report or block novi

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
@boctor
boctor / BaseViewController.m
Created May 5, 2011
A base view controller class that when running on the simulator in debug mode, will auto simulate a memory warning every time the view controller's viewDidAppear is called
View BaseViewController.m
//
// BaseViewController.m
//
// Created by Peter Boctor on 5/4/11.
//
// Copyright (c) 2011 Peter Boctor
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
@rsms
rsms / KVOChangeScope.hh
Created Nov 25, 2010
Conveniently mark Key-Value Observable properties as edited in Objective-C++
View KVOChangeScope.hh
/*
* KVOChangeScope -- Conveniently mark edits for Key-Value Observations in
* Objective-C++ in custom setters.
*
* Example:
*
* - (void)setFoo:(id)value {
* kvo_scoped_change(foo);
* // your setter code here which might return at any moment
* }
@rsms
rsms / sleeping-barber.m
Created Nov 10, 2010
Sleeping barber with GCD (Grand Central Dispatch)
View sleeping-barber.m
int main (int argc, const char * argv[]) {
dispatch_queue_t waitingChairs = dispatch_queue_create("waitingChairs", 0);
dispatch_queue_t barber = dispatch_queue_create("barber", 0);
dispatch_semaphore_t semaphore = dispatch_semaphore_create(3);
NSInteger ident = 0;
while (++ident) {
if (dispatch_semaphore_wait(semaphore, DISPATCH_TIME_NOW) != 0) {
printf("Customer %d turned away\n", ident);
continue;
}
You can’t perform that action at this time.