Skip to content

Instantly share code, notes, and snippets.

View bernardinus's full-sized avatar
🏠
Working from home

Bernardinus bernardinus

🏠
Working from home
  • Indonesia, Jakarta
View GitHub Profile
@bernardinus
bernardinus / 0_reuse_code.js
Created April 24, 2016 22:37
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@bernardinus
bernardinus / RootViewController-Fix
Created November 20, 2013 04:20
cocos2d-iphone v1.0.1 iOS 7 Fix, add new Function in root view controller
#pragma mark -
#pragma mark iOS 7 Fix Status Bar // ROOT VIEW CONTROLLER
-(BOOL)prefersStatusBarHidden
{
return true;
}
@bernardinus
bernardinus / AppDelegate-Fix
Created November 20, 2013 04:16
cocos2d-iphone v1.0.1 iOS 6 Fix AppDelegate.m replace [window addSubview:viewController.view]; RootViewController.m add new function
//iOS 6 Fix
{
NSString *reqSysVer = @"6.0";
NSString *currSysVer = [[UIDevice currentDevice] systemVersion];
if([currSysVer compare:reqSysVer options:NSNumericSearch]!=NSOrderedAscending)
{
[window setRootViewController:viewController];
}
else
{
@bernardinus
bernardinus / ExampleClass.m
Created November 20, 2013 04:11 — forked from lukeredpath/ExampleClass.m
Singleton [OBJ-C]
@implementation MySharedThing
+ (id)sharedInstance
{
DEFINE_SHARED_INSTANCE_USING_BLOCK(^{
return [[self alloc] init];
});
}
@end
using UnityEngine;
using System;
using System.Collections.Generic;
/// <summary>
/// A console that displays the contents of Unity's debug log.
/// </summary>
/// <remarks>
/// Developed by Matthew Miner (www.matthewminer.com)
/// Permission is given to use this script however you please with absolutely no restrictions.
<?php
function unzip($file) {
$zip = zip_open($file);
if (is_resource($zip)) {
$tree = "";
while (($zip_entry = zip_read($zip)) !== false) {
echo "Unpacking " . zip_entry_name($zip_entry) . "\n";
if (strpos(zip_entry_name($zip_entry), DIRECTORY_SEPARATOR) !== false) {
$last = strrpos(zip_entry_name($zip_entry), DIRECTORY_SEPARATOR);
$dir = substr(zip_entry_name($zip_entry), 0, $last);
/* **************************************************************************
Copyright 2012 Calvin Rien
(http://the.darktable.com)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
-- Two dashes start a one-line comment.
--[[
Adding two ['s and ]'s makes it a
multi-line comment.
--]]
----------------------------------------------------
-- 1. Variables and flow control.
----------------------------------------------------

Launch Sublime Text 2 from the Mac OS X Terminal

Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

Installation

// List all fonts on iPhone
NSArray *familyNames = [[NSArray alloc] initWithArray:[UIFont familyNames]];
NSArray *fontNames;
NSInteger indFamily, indFont;
for (indFamily=0; indFamily<[familyNames count]; ++indFamily)
{
NSLog(@"Family name: %@", [familyNames objectAtIndex:indFamily]);
fontNames = [[NSArray alloc] initWithArray:
[UIFont fontNamesForFamilyName:
[familyNames objectAtIndex:indFamily]]];