Skip to content

Instantly share code, notes, and snippets.

@SeanZoR
SeanZoR / detectWebGL.js
Created August 20, 2015 12:48
Detect WebGL with JS in browser
/**
* Detects if WebGL is enabled.
* Inspired from http://www.browserleaks.com/webgl#howto-detect-webgl
*
* @return { number } -1 for not Supported,
* 0 for disabled
* 1 for enabled
*/
function detectWebGL()
{
[
{
"collection_addr": "terra103z9cnqm8psy0nyxqtugg6m7xnwvlkqdzm4s4k",
"created_at": "2021-10-02 16:11:27+00:00",
"description": "Galactic Punks are 10,921 randomly generated NFTs on the Terra blockchain.",
"in_settlement": true,
"kind": "image",
"name": "Galactic Punk #9085",
"price": 65000000,
"slug": "terra103z9cnqm8psy0nyxqtugg6m7xnwvlkqdzm4s4k_322419286319563754354739883815582226965",
@SeanZoR
SeanZoR / getDeviceUniqueId
Created February 22, 2014 11:03
Android - Get device unique Id ("UDID")
public static String getDeviceUniqueId(Context ctx) {
return Settings.Secure.getString(ctx.getContentResolver(),
Settings.Secure.ANDROID_ID);
}
@SeanZoR
SeanZoR / ProGuard_ignore_libraries
Last active January 7, 2021 17:15
ProGuard - simple ignore for 3rd party libraries
# Ignoring all of the external "org" libraries
# (for example org.apache & org.jackson)
-keep class org.** { *; }
-dontwarn org.**
# Have more? Simply add them like the one above,
# and change to the desired package name.
@SeanZoR
SeanZoR / build.gradle
Last active November 9, 2020 01:27
Automatic versioning and increment using Git tags and Gradle
android {
defaultConfig {
...
// Fetch the version according to git latest tag and "how far are we from last tag"
def longVersionName = "git -C ${rootDir} describe --tags --long".execute().text.trim()
def (fullVersionTag, versionBuild, gitSha) = longVersionName.tokenize('-')
def(versionMajor, versionMinor, versionPatch) = fullVersionTag.tokenize('.')
// Set the version name
versionName "$versionMajor.$versionMinor.$versionPatch($versionBuild)"
@SeanZoR
SeanZoR / WebViewAccessibilityIgnore.java
Created February 20, 2020 12:48
Android's react-native-webview that doesn't flood the accessibility/UIAutomator2/Appium
/**
* If the WebView is causing constant refreshes to UI, and Appium/UIAutomator2 chokes on it,
* Use this. (To be given as a constructor argument to {@link RNCWebViewManager}.)
*/
public class WebViewAccessibilityIgnore implements WebViewConfig {
@Override
void configWebView(WebView webView){
webView.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
}
@SeanZoR
SeanZoR / getLanguageCode
Last active July 15, 2019 18:13
Android - Fix some language code to fit ISO-639-1
/**
* This method helps getting the right langauage ISO code, which suppose to be
* according to ISO-639-1, BUT, on some devices it still returns the deprecated ISO-639.
* <BR>
* Languages codes that are translated in this method:
* <ul>
* <li>Hebrew: IW -> HE
* <li>Indonesian: IN -> ID
* <li>Yiddish: JI -> YI
* </ul>
@SeanZoR
SeanZoR / getVersionCode
Created February 22, 2014 11:02
Android - Get application version code
public static int getVersionCode(Context ctx) {
int versionCode = 0;
try {
PackageInfo pInfo = ctx.getPackageManager().getPackageInfo(
ctx.getPackageName(), 0);
versionCode = pInfo.versionCode;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
@SeanZoR
SeanZoR / InstallFullStackAngularJsMean.sh
Last active September 30, 2018 22:14
Full Stack AngularJS MEAN Installation (OS X, El Capitan)
# Make sure homebrew is installed and latest
brew update
# Run the brew doctor and read the instructions, it will make sure all paths are ready for write and all
brew doctor
# Start installing packages
brew install mongodb
brew install homebrew/versions/node010 #For Yeomen compatability later on
npm install express -g
/***
* Wrapper for instabug implementation
* API docs are (mostly) here: https://instabug.com/public/android-api-reference/com/instabug/library/Instabug.html
*/
public class InstabugUtil {
public static void init(Application context) {
// Builder should run first
Instabug.Builder builder = new Instabug.Builder(context, context.getString(R.string.instabug_key));
if (BuildConfig.DEBUG) {