This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (UIImage*)snapshot:(UIView*)eaglview | |
{ | |
// Get the size of the backing CAEAGLLayer | |
GLint backingWidth, backingHeight; | |
glBindRenderbufferOES(GL_RENDERBUFFER_OES, _colorRenderbuffer); | |
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &backingWidth); | |
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &backingHeight); | |
NSInteger x = 0, y = 0, width = backingWidth, height = backingHeight; | |
NSInteger dataLength = width * height * 4; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(BOOL) setupFetchedResultsControllerForEntity:(NSString *)argEntityName withSortKey:(NSString *)argSortKey | |
{ | |
// Uncomment the following line to display an Edit button in the navigation bar for this view controller. | |
// self.navigationItem.rightBarButtonItem = self.editButtonItem; | |
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init]; | |
// Configure the request's entity, and optionally its predicate. | |
NSEntityDescription *entityDescription = [NSEntityDescription entityForName:argEntityName inManagedObjectContext:self.managedObjectContext]; | |
[fetchRequest setEntity:entityDescription]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void) clearNSURLConnectionCache | |
{ | |
NSURLCache *sharedCache = [[NSURLCache alloc] initWithMemoryCapacity:0 diskCapacity:0 diskPath:nil]; | |
[NSURLCache setSharedURLCache:sharedCache]; | |
[sharedCache release]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (UIView *view in self.navigationController.navigationBar.subviews) { | |
NSLog(@"%@", [[view class] description]); | |
LOG_EXPR([[view class] description]); | |
if ([[[view class] description] isEqualToString:@"UINavigationButton"]) { | |
[(UINavigationButton *)view setTintColor:[UIColor brownColor]]; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
dir = [] | |
def listDirectory(directory): | |
for f in os.listdir(directory): | |
path0 = os.path.join(directory, f) | |
if os.path.isdir(path0): | |
dir.append(path0) | |
listDirectory(path0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
NSLog(@"%@", [self getSystemFontPath:18]); | |
NSLog(@"%s", [self getSystemFontPathCString:18]); | |
... | |
- (const char *)getSystemFontPathCString:(CGFloat)argFontSize | |
{ | |
NSString *path = [self getSystemFontPath:argFontSize]; | |
const char *path_cstring = [path cStringUsingEncoding:[NSString defaultCStringEncoding]]; | |
return path_cstring; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stevedore.extension Could not load 'user_scripts': virtualenv-clone | |
stevedore.extension virtualenv-clone | |
Traceback (most recent call last): | |
File "/usr/local/lib/python2.7/site-packages/stevedore/extension.py", line 89, in _load_plugins | |
invoke_kwds, | |
File "/usr/local/lib/python2.7/site-packages/stevedore/extension.py", line 101, in _load_one_plugin | |
plugin = ep.load() | |
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/distribute-0.6.40-py2.7.egg/pkg_resources.py", line 2030, in load | |
if require: self.require(env, installer) | |
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/distribute-0.6.40-py2.7.egg/pkg_resources.py", line 2043, in require |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo pip install virtualenv-clone --upgrade |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import tldextract | |
from tld import get_tld | |
from tld.utils import update_tld_names | |
TEST_COUNT = 1000000 | |
start_time = os.times()[4] | |
for i in range(TEST_COUNT): | |
e = tldextract.extract('http://forums.news.cnn.com:8080/a/b/c/') |
OlderNewer