Skip to content

Instantly share code, notes, and snippets.

View vishalkardode's full-sized avatar

Vishal Kardode vishalkardode

View GitHub Profile
@vishalkardode
vishalkardode / sample-commands.sh
Last active May 6, 2019 09:01
Android SDK manager command lines
# Use SDK Manager Behind Proxy
# Replace following with actual Values
# __PROXY_HOST__, __PROXY_PORT__, __USER-NAME__, __PASSWORD__
_JAVA_OPTIONS="-Dhttp.proxyHost=__PROXY_HOST__ -Dhttp.proxyPort=__PROXY_PORT__ -Dhttp.proxyUser=__USER-NAME__ -Dhttp.proxyPassword=__PASSWORD__" bash -c sdkmanager
# SDK Manager Install Package
sdkmanager "platform-tools" "platforms;android-27"
# create android avd
@vishalkardode
vishalkardode / create-tar-withexclude.sh
Created August 15, 2018 05:40
Create tar by skipping some folders / files
#/bin/sh
tar -czvf test.tar.gz -X exclude-list.txt test
@vishalkardode
vishalkardode / Usage.txt
Last active October 18, 2022 12:16
WebkitCookieManagerProxy for Android sharing cookies between java.net.cookiemanager and android.webkit.cookiemanager taken from http://stackoverflow.com/questions/12731211/pass-cookies-from-httpurlconnection-java-net-cookiemanager-to-webview-android
*SET cookie manager for webkit*
android.webkit.CookieSyncManager.createInstance(appContext);
// unrelated, just make sure cookies are generally allowed
android.webkit.CookieManager.getInstance().setAcceptCookie(true);
*SET cookie manager for java.net (native calls)*
// magic starts here
WebkitCookieManagerProxy coreCookieManager = new WebkitCookieManagerProxy(null, java.net.CookiePolicy.ACCEPT_ALL);
var date = new Date();
var options = {
weekday: "short",
year: "numeric",
month: "2-digit",
day: "numeric"
};
date.toLocaleDateString("en", options);//en is language option, you may specify..
@vishalkardode
vishalkardode / rtl.css
Created July 15, 2015 11:32
HTML i18n RTL support
body {
direction: rtl;
}
@vishalkardode
vishalkardode / versionComparator.js
Created December 11, 2014 08:58
Javascript Version Comparator
/*
* Simple Version Comparator for Javascript
*/
function compareVersions(v1, v2) { // return -1: v1 > v2, 0: v1=v2, 1: v1<v2, NaN: invalid versions
console.log("Comparing Versions ", v1, v2);
v1 = typeof v1 !== 'undefined' ? v1 : "0";
v2 = typeof v2 !== 'undefined' ? v2 : "0";
@vishalkardode
vishalkardode / release-build.sh
Created November 21, 2014 08:02
Cordova Android Release Build
#/bin/sh
#################
# @author Vishal Kardode
# This Script Generate Release Build of Cordova Application for Android, Signs it using given Keystore and prepares to submit to App Store.
# This takes version as parameter, if not provided version will take current date time value
# Update following Configuration before use
# APP_NAME = Application Name
# KEYSTORE_FILE = Keystore File Path. This file uses Keystore kept at parellel location to this file
# KEYSTORE_PASS = Keystore Password
@vishalkardode
vishalkardode / computers.txt
Last active August 29, 2015 14:10
Ping TestPings servers from text file and exports results to another text
127.0.0.1
172.21.32.179
@vishalkardode
vishalkardode / remove-uncompressed.bat
Created November 21, 2014 06:28
Remove uncompressed files from dojo
@echo off
REM @author VISHAL
ECHO "Deleting uncompressed JS files"
for /f "tokens=* delims=" %%i in ('dir /s /b *.uncompressed.js') do (
echo "removing %%i"
rem rmdir /s /q "%%i"
del "%%i"
@vishalkardode
vishalkardode / file-helper.js
Last active August 29, 2015 14:09
Cordova File API Example Usage
// Request Directory
function getDirectory(dirName /*this can be directory path also*/) {
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fileSystem){
// Success Function Callback
fileSystem.root.getDirectory(dirName, {}, function(directory) {
// Success Function Callback
console.log(directory, 'directory');
}, function(error){
//Error CallBack - getDirectory
console.log(error,"Directory Lookup Error ");