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 / 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
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
@nisrulz
nisrulz / .gitignore
Last active Nov 22, 2015
.gitignore File for Android Studio
View .gitignore
# [Android] ========================
# Built application files
*.apk
*.ap_
# Files for the Dalvik VM
*.dex
# Java class files
*.class
@nisrulz
nisrulz / AndroidManifest.xml
Created Feb 15, 2016 — forked from billmote/AndroidManifest.xml
When pushing code from your IDE, wake the device and show the activity.
View AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<!-- Add this as a debug manifest so the permissions won't be required by your production app -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
</manifest>
@nisrulz
nisrulz / build.gradle
Created Feb 26, 2016
Change name of apk via gradle property in android
View build.gradle
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.company.packagename"
minSdkVersion 7
targetSdkVersion 23
versionCode 1
versionName "1.0.0"
@nisrulz
nisrulz / Activity.java
Last active Mar 11, 2016
RecyclerView implementation
View Activity.java
// USAGE
// Data set
final ArrayList<ViewModel> viewModelArrayList = new ArrayList<>();
for (int i = 0; i < 100; i++) {
viewModelArrayList.add(new Order(i, "VM Name " + i));
}
// Recyclerview
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.rv);