Skip to content

Instantly share code, notes, and snippets.

View marcin-maciukiewicz's full-sized avatar

Marcin Maciukiewicz marcin-maciukiewicz

View GitHub Profile
@marcin-maciukiewicz
marcin-maciukiewicz / gist:2591680
Created May 4, 2012 03:12
Cocos2d init in RubyMotion
class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
director=CCDirector.sharedDirector
viewController = RootViewController.alloc.initWithNibName(nil, bundle:nil)
viewController.wantsFullScreenLayout = true
------------------------------------------------------------------------------------------------------------------------------------------
2012/3/16 Michal Henryk <mikgol26@xxxxxxxxxx>
Witaj Marcin
Dziki za pochlebne slowa :-)
Zgadza sie z toba w pelni ze jest to wykorzystywanie bazy. Podobnie jak ludzie na spotkaniach pozyczaja
sobie ksiazki dyskutuja rzeczy niezwiazane z Tostmaster to sie nazywa networking.
Jezeli ktos uprzejmie zapytuje to mozna uprzejmie odpowiedziec nie, chya ze komus brak
kultury to mozna wolgarnie patrz ponizej ?
@marcin-maciukiewicz
marcin-maciukiewicz / gist:1722407
Created February 2, 2012 08:48
CoreData exception
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Failed to process pending changes before save.
The context is still dirty after 100 attempts.
Typically this recursive dirtying is caused by a bad validation method, -willSave, or notification handler.'
@marcin-maciukiewicz
marcin-maciukiewicz / gist:1092009
Created July 19, 2011 11:11
Example Log4Cocoa usage
- (void)done {
log4Debug(@"done"); // <-- debug message
[_connection release];
}
- (void) createTempFilePath {
// ....
int fileDescriptor = mkstemp(tempFileNameCString);
if (fileDescriptor == -1) {
@marcin-maciukiewicz
marcin-maciukiewicz / gist:1091990
Created July 19, 2011 11:04
Minimal Log4Cocoa stup
// log every category
[[L4Logger rootLogger] setLevel:[L4Level all]];
// send log messages to console
L4ConsoleAppender *consoleAppender=[[[L4ConsoleAppender alloc] initTarget:YES withLayout: [L4Layout simpleLayout]] autorelease];
[[L4Logger rootLogger] addAppender: consoleAppender];
L4Logger *theLogger = [L4Logger loggerForClass:[L4FunctionLogger class]];
[theLogger setLevel:[L4Level debug]];
//
log4Info(@"The logging system has been initialized.");
page id=0 file="impact-normal-italic-26-green.png"
chars count=67
char id=32 x=0 y=0 width=0 height=0 xoffset=0 yoffset=37 xadvance=12 page=0 chnl=0
char id=65 x=0 y=0 width=28 height=27 xoffset=3 yoffset=0 xadvance=23 page=0 chnl=0
char id=66 x=28 y=0 width=27 height=27 xoffset=3 yoffset=0 xadvance=17 page=0 chnl=0
...
// starts at line no. 214
//
// assume propertyValue='impact-normal-italic-26-green.png'
NSString *textureAtlasName = [CCFileUtils fullPathFromRelativePath:propertyValue];
// at this point textureAtlasName=absolute path to the file
// e.g.
// /Users/ciukes/Library/Application Support/iPhone Simulator/4.0.1/Applications/ \
// B4DF07F2-1155-450C-9BE8-103821559323/CFFontServer-Test.app/impact-normal-italic-26-green.png
//
// Why the following is used?
# Destination root for the framework
DESTROOT="${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}-${CURRENT_PROJECT_VERSION}"
mkdir -p "${DESTROOT}"
#
IPHONE_DEST="${DESTROOT}/iPhone Framework"
DOC_DEST="${DESTROOT}/Documentation"
# Populate the framework folder
mkdir -p "${IPHONE_DEST}"
FRAMEWORK="${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework"
lipo \
"${BUILD_DIR}/${CONFIGURATION}-iphoneos/lib${PRODUCT_NAME}-iPhone.a" \
"${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/lib${PRODUCT_NAME}-iPhoneSimulator.a" \
-create -output "${FRAMEWORK}/Versions/Current/${PRODUCT_NAME}"
cd "${FRAMEWORK}" && ln -sf "Versions/Current/${PRODUCT_NAME}" ./