Skip to content

Instantly share code, notes, and snippets.

@seaders
seaders / git_whitespace.py
Last active August 29, 2015 14:23
If you've a big dirty git workspace, with loads of documents with whitespace (which you know you can safely commit), you can use python's sh library (https://github.com/amoffat/sh) and the script below to safely stage all files with only whitespace changes
#!/usr/bin/python
import sh
git = sh.git.bake('--no-pager', # @UndefinedVariable
_cwd='/Developer/repos/git/example')
for fname in git.diff('--name-only', '--full-index', 'HEAD').splitlines():
if '' == git.diff('-w', fname):
print 'adding', fname
git.add(fname)
public static void onCreate( Bundle savedInstanceState )
public static void onActivityResult( int request, int response, Intent data )
public static void onNewIntent( Intent intent )
public static void onStart()
public static void onStop()
In order to take part in the Unity Activity sharing system, there are a few steps you will need to take outlined below. First, some background. You can signify which class you would like to receive all the Activity lifecycle methods. When you implement the methods they should have the exact same signature but they should be *public static void*. That is important! They will not be called if they are not public static void. You can implement 1 or all of the methods. That is entirely up to your needs.
1. Download the Prime31UnityActivity.jar file from here: https://app.box.com/s/xw6hq1ltjaniycc14j21 You are free to distribute the file but *do not change it's name*! That would defeat the purpose of the sharing mechanism!
2. Implement any of the methods that are available in this Gist (https://gist.github.com/prime31/10747997)
3. Perform the AndroidManifest changes below
If successful, on app launch you will see a log that looks like the following:
Failed running /Applications/Unity/Unity.app/Contents/Frameworks/Tools/UnusedByteCodeStripper2/UnusedBytecodeStripper2.exe -out "/Developer/repos/git/fishing/Temp/StagingArea/Data/Managed" -l none -c link -x "/Applications/Unity/Unity.app/Contents/Frameworks/Tools/UnusedByteCodeStripper/native_link.xml" -f "/Applications/Unity/Unity.app/Contents/Frameworks/il2cpp/LinkerDescriptors" -x "/Developer/repos/git/fishing/Temp/StagingArea/Data/Managed/../platform_native_link.xml" -x "/Developer/repos/git/fishing/Temp/StagingArea/Data/methods_pointedto_by_uievents.xml" -d "/Developer/repos/git/fishing/Temp/StagingArea/Data/Managed" -a "/Developer/repos/git/fishing/Temp/StagingArea/Data/Managed/Assembly-CSharp-firstpass.dll" -a "/Developer/repos/git/fishing/Temp/StagingArea/Data/Managed/Assembly-CSharp.dll" -a "/Developer/repos/git/fishing/Temp/StagingArea/Data/Managed/Assembly-UnityScript-firstpass.dll" -a "/Developer/repos/git/fishing/Temp/StagingArea/Data/Managed/UnityEngine.UI.dll" -a "/Developer/repos/git/fis
function AuthiOSGameCenter(data, callback)
{
if(data.bundle_id !== 'com.example.game')
{
callback(false);
return;
}
function handleResponse(key)
{
package com.sixminute.twitterlibrary;
import android.app.Activity;
import android.content.Intent;
import android.util.Log;
import com.twitter.sdk.android.Twitter;
import com.twitter.sdk.android.core.Callback;
import com.twitter.sdk.android.core.Result;
import com.twitter.sdk.android.core.TwitterAuthConfig;
#import "UnityAppController.h"
@interface SMSubController : UnityAppController
@end
IMPL_APP_CONTROLLER_SUBCLASS(SMSubController)
@implementation SMSubController
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using Amazon.DynamoDBv2.Model;
using Amazon.DynamoDBv2;
using Amazon;
using System;
using Amazon.Runtime;
using Amazon.DynamoDBv2.DocumentModel;
using Amazon.DynamoDBv2.DataModel;
package
{
public class FunctionyTest
{
public function FunctionyTest()
{
functionAccepter(noArgs);
// output: noArgs function called
functionAccepter(someArgs, "asdf", 1234);
// output: someArgs function called with asdf 1234
#!/usr/local/bin/python
import time, sys, wrapper
target = int(sys.argv[1])
curr = int(sys.argv[2])
adb_loc = '/Developer/sdks/android/platform-tools/adb'
adb = wrapper.CommandWrapper(adb_loc)