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
CC3MeshNode *node = [CC3MeshNode node]; | |
[node populateAsCenteredRectangleWithSize:CGSizeMake(width, height)]; |
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
CC3Box bounds = { {-1, -1, -1}, {1, 1, 1} }; | |
CC3MeshNode *cube = [CC3MeshNode node]; | |
[cube populateAsSolidBox:bounds]; |
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
CC3MeshNode *sphere = [CC3MeshNode node]; | |
[sphere populateAsSphereWithRadius:1 andTessellation:(CC3Tessellation){8,8}]; |
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
// sample of using POCO's ThreadPool | |
#include "Poco/Runnable.h" | |
#include "Poco/ThreadPool.h" | |
#include <iostream> | |
using namespace std; | |
class Worker:public Poco::Runnable{ | |
public: |
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
#!/bin/sh | |
# This script will install a Git pre-push hook that prevents force pushing the master branch. | |
# Install in current Git repo: | |
# curl -fL https://gist.githubusercontent.com/stefansundin/d465f1e331fc5c632088/raw/install-pre-push.sh | sh | |
# Uninstall: | |
# rm .git/hooks/pre-push | |
# in each repository that you've added this to. | |
GITROOT=`git rev-parse --show-toplevel 2> /dev/null` |
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
#define UIViewParentController(__view) ({ \ | |
UIResponder *__responder = __view; \ | |
while ([__responder isKindOfClass:[UIView class]]) \ | |
__responder = [__responder nextResponder]; \ | |
(UIViewController *)__responder; \ | |
}) |
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
#define NSLog(FORMAT, ...) fprintf( stderr, "%s\n", [[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String]); |
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
static void printIvarsList(Class classType) { | |
printf("\n"); | |
do { | |
unsigned int count = 0; | |
Ivar* ivars = class_copyIvarList(classType, &count); | |
for(unsigned int i = 0; i < count; ++i) { | |
printf("%s::%s %s\n", [classType description].UTF8String, ivar_getName(ivars[i]), ivar_getTypeEncoding(ivars[i])); | |
} | |
free(ivars); |
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)initialize { | |
Class metaClass = objc_getMetaClass(class_getName(self)); | |
SEL selector = @selector(description); | |
IMP implementation = imp_implementationWithBlock(^NSString *(){ | |
return @">>>added"; | |
}); | |
Method method = class_getClassMethod(metaClass, selector); |
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
CGPoint points[num]; | |
CGContextRef ctx = [[NSGraphicsContext currentContext] graphicsPort]; | |
CGMutablePathRef path = CGPathCreateMutable(); | |
CGPathAddLines(path, NULL, points, num); | |
if (closePath) CGPathCloseSubpath(path); | |
CGContextAddPath(ctx,path); | |
CGContextStrokePath(ctx); |
OlderNewer