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
//int vesioncode = context().getPackageManager().getPackageInfo(context().getPackageName(), 0).versionCode; | |
public static int GetVersionCode() { | |
AndroidJavaClass contextCls = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); | |
AndroidJavaObject context = contextCls.GetStatic<AndroidJavaObject>("currentActivity"); | |
AndroidJavaObject packageMngr = context.Call<AndroidJavaObject>("getPackageManager"); | |
string packageName = context.Call<string>("getPackageName"); | |
AndroidJavaObject packageInfo = packageMngr.Call<AndroidJavaObject>("getPackageInfo", packageName, 0); | |
return packageInfo.Get<int>("versionCode"); | |
} | |
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
[Test] | |
public function should_verify_response():void { | |
// @see https://manage.sbs.wooga.com/docs/api/abconfig | |
// 1) Decrypt the X-SBS-Config-Signature using the public key for your SBS-ID | |
var rsa:RSAKey = PEM.readRSAPublicKey(correctKey); | |
var src:ByteArray = new ByteArray(); | |
src.writeUTFBytes(Base64.encode(correctSignature)); |
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
package klausur.spierpinski; | |
import org.jetbrains.annotations.NotNull; | |
import org.jetbrains.annotations.Nullable; | |
import javax.swing.*; | |
import java.awt.*; | |
import static javax.swing.JFrame.EXIT_ON_CLOSE; |
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
/* | |
* OpenSimplex (Simplectic) Noise in Java. | |
* (v1.0.1 With new gradient set and corresponding normalization factor, 9/19/14) | |
*/ | |
public class OpenSimplexNoise { | |
private static final double STRETCH_CONSTANT_3D = -1.0 / 6; | |
private static final double SQUISH_CONSTANT_3D = 1.0 / 3; | |
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
public static class CSVParser | |
{ | |
public static string ReadKeyStorePassword (string path) | |
{ | |
string password = ""; | |
StreamReader theReader = new StreamReader (path, Encoding.Default); | |
using (theReader) { | |
password = theReader.ReadLine ().Replace ("\n", ""); | |
} |
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
public override Promise unlockAchievements (string name, double points, bool autoStart = true) | |
{ | |
var deferred = new Deferred<bool>(); | |
string format = "Unlock Achievement " + name + " with " + points; | |
deferred.OnFulfilled += (bool result) => Debug.Log(format + ": " + result); | |
deferred.OnFailed += (bool result) => Debug.Log(format + ": " + result); | |
deferred.action += () => | |
Social.ReportProgress(name, points, (bool success) => { | |
if(success) |
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
public static string ToString<T>(this IEnumerable<T> list, string separator) | |
{ | |
StringBuilder sb = new StringBuilder(); | |
foreach (var obj in list) { | |
if (sb.Length > 0) { | |
sb.Append(separator); | |
} | |
sb.Append(obj); | |
} | |
return sb.ToString(); |
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
public static T GetComponentByInterface<T>(this GameObject go) where T : class | |
{ | |
var components = go.GetComponents<MonoBehaviour>(); | |
foreach (var c in components) | |
{ | |
T t = c as T; | |
if (t != null) | |
return t; | |
} | |
return 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
// major.branchName.revId.commitCount | |
def pattern = Pattern.compile('versionName=\"(\\d+)\\.(\\w+)\\.(\\w+)\\.(\\d+)\"') | |
task incrementMajor << { | |
def stdout = new ByteArrayOutputStream() | |
exec { | |
commandLine "git", "branch" |
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
mWebView.setWebViewClient(new WebViewClient() { | |
@Override | |
public WebResourceResponse shouldInterceptRequest(WebView view, String url) { | |
if (url.contains("creditcard_cvc.jpg")) { | |
Log.v("WebView", "Replacing [" + url + "] with [R.raw.tmp_replacement]"); | |
ContentResolver contentResolver = getActivity().getContentResolver(); | |
return new WebResourceResponse(contentResolver.getType(Uri.parse(url)), "UTF-8", getResources().openRawResource(R.raw.tmp_replacement)); | |
} | |
return super.shouldInterceptRequest(view, url); |
OlderNewer