Skip to content

Instantly share code, notes, and snippets.

@dfox
dfox / uiviewcontroller-method-swizzling.m
Created August 7, 2012 18:47
Method Swizzling in UIApplication to Capture viewDidAppear:
#import "UIViewController+EventInterceptor.h"
#import "EventLogger.h"
#import <objc/runtime.h>
@implementation UIViewController (EventInterceptor)
+(void) load
{
//Replace the noop viewDidAppear with our own implementation
class_replaceMethod(self, @selector(viewDidAppear:), (IMP) viewDidAppear, "v@:@");
@kimsama
kimsama / Debug.cs
Created November 21, 2012 04:38
It overrides UnityEngine.Debug to mute debug messages completely on a platform-specific basis. [Edit] Added isDebugBuild property.
//#if UNITY_EDITOR
//#define DEBUG
//#endif
using UnityEngine;
using System.Collections;
using System;
using System.IO;
using System.Text.RegularExpressions;
using UnityEngineInternal;
@leecrossley
leecrossley / iCloudKiller
Created November 22, 2012 09:10
Don't back up anything on iCloud, ever.
NSString* doc = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString* lib = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) objectAtIndex:0];
float version = [[[UIDevice currentDevice] systemVersion] floatValue];
if (version < 5.1)
{
u_int8_t b = 1;
setxattr([doc fileSystemRepresentation], "com.apple.MobileBackup", &b, 1, 0, 0);
setxattr([lib fileSystemRepresentation], "com.apple.MobileBackup", &b, 1, 0, 0);
using UnityEngine;
using System.Collections;
using UnityEngine.SocialPlatforms;
using UnityEngine.SocialPlatforms.GameCenter;
public class GameCenterConnector : MonoBehaviour
{
// GameCenterのユーザ認証を行う
void Start ()
{
# This file looks empty when viewed with "vi". In fact, there is one
# '~', so users with no AppleVolumes file in their home directory get
# their home directory by default.
#
# volume format:
# :DEFAULT: [all of the default options except volume name]
# path [name] [casefold:x] [options:z,l,j] \
# [allow:a,@b,c,d] [deny:a,@b,c,d] [dbpath:path] [password:p] \
# [rwlist:a,@b,c,d] [rolist:a,@b,c,d] [limitsize:value in bytes] \
@jmcguirk
jmcguirk / PerformBuild.cs
Created March 8, 2013 01:56
Unity3D Ant Build Configuration
// C# example
using UnityEditor;
using System.IO;
using System.Collections;
using UnityEngine;
using System.Collections.Generic;
class PerformBuild
{
static string[] GetBuildScenes()
@maxhuk
maxhuk / UISegmentedControl+Background.h
Created April 9, 2013 10:23
Fast UISegmentedControl appearance customization.
//
// UISegmentedControl+Background.h
//
// Created by Maksym Huk on 4/3/13.
// Copyright (c) 2013 Maksym Huk. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UISegmentedControl (Background)
@allisonsalmon
allisonsalmon / Autobuilder.cs
Created May 9, 2013 18:05
Some basics on setting up an auto builder for Unity 3D
using UnityEditor;
using System.Collections;
public class Autobuilder {
static void PerformBuild()
{
string [] scenes = { @"Assets/Scenes/Main Game.unity",
@"Assets/Scenes/Main Menu.unity",
@yourpalmark
yourpalmark / IncrementBuildVersion.cs
Last active March 3, 2023 08:41 — forked from darktable/IncrementBuildVersion.cs
Unity: Post-process script that increments revision number of iPhone and Android builds. Uses CFBundleShortVersionString as well as CFBundleVersion. CFBundleShortVersionString (Version) is set to {Major}.{Minor}.{Build}. CFBundleVersion (Build) is set to {Revision}. Revision is the auto-incremented value on every build.
/**
* 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
*
@redent
redent / TCHorizontalSelectorView
Created September 6, 2013 09:12
Horizontal selector view with view reuse and infinite circular scrolling, allowing more than one element per page
//
// TCHorizontalSelectorView.m
// TwinCodersLibrary
//
// Created by Guillermo Gutiérrez on 16/01/13.
// Copyright (c) 2013 TwinCoders S.L. All rights reserved.
//
#import <UIKit/UIKit.h>