Skip to content

Instantly share code, notes, and snippets.

Avatar
🌠
Coding in the MultiVerse

Nishant Srivastava nisrulz

🌠
Coding in the MultiVerse
View GitHub Profile
@nisrulz
nisrulz / CustomUncaughtExpHandler.java
Created Apr 5, 2015
Android : Custom Uncaught Exception Handler
View CustomUncaughtExpHandler.java
public class CustomUncaughtExpHandler implements Thread.UncaughtExceptionHandler {
/**
* Method to handle any exception thats not handled in code
*
* @param thread
* @param ex
*/
@Override
public void uncaughtException(Thread thread, Throwable ex) {
Log.e(SP_Defaults.LOGTAG,
@nisrulz
nisrulz / build.gradle
Created Apr 5, 2015
Android : Prompt for signing when building for release
View build.gradle
signingConfigs {
release {
storeFile file(System.console().readLine("\n\$ Enter keystore path: "))
storePassword new String(System.console().readPassword("\n\$ Enter keystore password: "))
keyAlias System.console().readLine("\n\$ Enter key alias: ")
keyPassword new String(System.console().readPassword("\n\$ Enter key password: "))
}
}
@nisrulz
nisrulz / gradle.properties
Created Apr 5, 2015
Faster Gradle Builds
View gradle.properties
org.gradle.daemon=true
org.gradle.configureondemand=true
org.gradle.parallel=true
@nisrulz
nisrulz / styles.xml
Last active Aug 29, 2015
Android : Tint the Navigation Bar
View styles.xml
<style name="AppTheme" parent="@style/Theme.AppCompat.Light">
...
<item name="navigationBarColor">#123456</item>
...
<!--Or-->
<item name="android:navigationBarColor" tools:targetApi="21">@android:color/white</item>
</style>
@nisrulz
nisrulz / proguard-rules.pro
Created Apr 11, 2015
Proguard rules to strip logs from the android source
View proguard-rules.pro
-assumenosideeffects class android.util.Log {
public static *** d(...);
}
View MultiExporter.jsx
// MultiExporter.jsx
// Version 0.1
// Version 0.2 Adds PNG and EPS exports
// Version 0.3 Adds support for exporting at different resolutions
// Version 0.4 Adds support for SVG, changed EPS behaviour to minimise output filesize
// Version 0.5 Fixed cropping issues
// Version 0.6 Added inner padding mode to prevent circular bounds clipping
//
// Copyright 2013 Tom Byrne
// Comments or suggestions to tom@tbyrne.org
@nisrulz
nisrulz / get_public_ssh_key.sh
Last active Aug 29, 2015
Get SSH Public Key
View get_public_ssh_key.sh
#More info at : https://help.github.com/articles/generating-ssh-keys/
cat ~/.ssh/id_dsa.pub
@nisrulz
nisrulz / build_buildtypes.gradle
Created Jul 18, 2015
Standard build.gradle configurations for a gradle based android app, with build flavours
View build_buildtypes.gradle
buildTypes {
debug {
minifyEnabled false
applicationIdSuffix '.debug'
versionNameSuffix '-debug'
}
release {
signingConfig signingConfigs.release
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
@nisrulz
nisrulz / ellipsis.css
Created Aug 1, 2015
Truncate text if it overflows and put ellipsis
View ellipsis.css
.ellipsis {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis; // IE 6+, FF 7+, Op 11+, Saf 1.3+, Chr 1+
-o-text-overflow: ellipsis; // for Opera 9 & 10
}
@nisrulz
nisrulz / using_battery_historian.sh
Last active Aug 29, 2015
Using Google's Battery Historian 2.0
View using_battery_historian.sh
#Start battery historian
cd $GOPATH/src/github.com/google/battery-historian
go run cmd/battery-historian/battery-historian.go
#Setup device for data collection
./adb shell dumpsys batterystats --enable full-wake-history
./adb shell dumpsys batterystats --reset
#Capture bugreport
./adb bugreport > ./bugreports/android_device_bugreport.txt