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 / 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_gnuplot.sh
Created Aug 3, 2015
Use gunplot in terminal to plot a graph
View using_gnuplot.sh
#For more info check : http://people.duke.edu/~hpgavin/gnuplot.html
#Install GnuPLot
brew install gnuplot
#Before ploting a graph, set the terminal into dumb mode
set terminal dumb
#To Plot a graph
plot cos(x+2) #for a function
#for a data set
@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
@nisrulz
nisrulz / create_maven_repo.sh
Last active Jun 18, 2020
Creating a maven repository
View create_maven_repo.sh
### Create Maven Repository
#Create a directory named mavenrepo
mkdir mavenrepo
#Move into the dir
cd mavenrepo
#Initialise with git
git init
View regex-weburl.js
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Updated: 2010/12/05
// License: MIT
//
// Copyright (c) 2010-2013 Diego Perini (http://www.iport.it)
//
// Permission is hereby granted, free of charge, to any person
@nisrulz
nisrulz / test.sh
Created Aug 16, 2015
Test gist to showcase on satckoverflow
View test.sh
# This is a test shell script
echo "Hello World"
@nisrulz
nisrulz / convert-png-to-webp
Last active Aug 29, 2015 — forked from jonjensen/convert-png-to-webp
Batch convert PNG files to WebP in 1 directory
View convert-png-to-webp
#!/bin/bash
PATH=/usr/local/bin:/usr/bin:/bin
# cd to the directory of the image so we can work with just filenames
dir="$(dirname "$1")"
cd "$dir" || exit 1
base="$(basename "$1" .png)"
# create a WebP version of the PNG
@nisrulz
nisrulz / task_gen_jar.gradle
Created Oct 2, 2015
Task to generate a JAR from an android library module
View task_gen_jar.gradle
// Place this in the 'build.gradle' of the library module
// Task : Generate a JAR
// Usage : In the terminal, run './gradlew jar'
// Output : Get the jar at 'build/libs'
task jar(type: Jar, dependsOn: 'assembleRelease') {
from fileTree(dir: 'build/intermediates/classes/release')
}
@nisrulz
nisrulz / build.gradle
Created Oct 30, 2015 — forked from ph0b/build.gradle
sample build.gradle for generating split APKs per ABI
View build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig{
minSdkVersion 14
targetSdkVersion 21
versionCode 101