Skip to content

Instantly share code, notes, and snippets.

@Kishanjvaghela
Kishanjvaghela / prog.java
Created September 23, 2016 13:11
Problem
/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
@Kishanjvaghela
Kishanjvaghela / example
Last active September 23, 2016 14:39
You're given an array of positive numbers. Write an algorithm that arranges these numbers one after another in a way that the end result is a single number and is the largest number possible using those combinations.
Input: {252, 11, 9, 17545}
Output: 92521754511
@Kishanjvaghela
Kishanjvaghela / WrapContentViewPager.java
Created October 5, 2016 05:55
Wrap content height ViewPager
import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.View;
/**
* Created by DSK02 on 7/4/2016.
*/
@Kishanjvaghela
Kishanjvaghela / 01-Arrow-Functions-add.js
Last active January 5, 2017 09:46
Let's Learn ES6 - Arrow Functions
// 1
let add = (a,b) => {
return a+b;
}
console.log(add(4,5));
// 2
let add = (a,b) => a+b;
console.log(add(4,5));
@Kishanjvaghela
Kishanjvaghela / 01-Spread Operator-and-Rest-Parameters-reduce.js
Last active January 5, 2017 13:10
Let's Learn ES6 - Spread Operator and Rest Parameters
//1
let sum = function(){
var method = (prev,curr)=>{
return prev+curr;
};
return Array.prototype.reduce.call(arguments,method);
};
console.log(sum(1,2,3,4));
/*
output:
@Kishanjvaghela
Kishanjvaghela / Let's Learn ES6 - Destructuring - Array.js
Last active January 11, 2017 10:27
Let's Learn ES6 - Destructuring
//1
let numbers = [10,20,30,40];
let first = numbers[0]; //10
let second = numbers[1]; //20
let [first,second] = numbers;
console.log(first); //10
console.log(second); //20
@Kishanjvaghela
Kishanjvaghela / TLSSocketFactory.java
Last active November 20, 2018 12:14 — forked from fkrauthan/TLSSocketFactory.java
Custom SSLSocketFactory Implementation to enable tls 1.1 and tls 1.2 for android 4.1 (16+)
package net.cogindo.ssl;
import java.io.IOException;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import javax.net.ssl.SSLContext;
@Kishanjvaghela
Kishanjvaghela / gradle.md
Last active September 29, 2018 15:18 — forked from suwhs/gradle.md
5 steps for bintray-upload build.gradle (for jcenter)

add bintray and maven plugin to buildscript dependencies (project's build.gradle)

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.1.2'
 classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2' // ADD THIS LINE
HtmlImageGetter imageGetter = new HtmlImageGetter(getActivity(), R.drawable.image_html_response_background) {
@Override
public void onTextUpdate() {
CharSequence sequence = textView.getText();
textView.setText(sequence);
}
};
Spanned spanned;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
package jp.likenote.android.utils;
import android.app.Activity;
import android.content.Context;
import android.media.AudioAttributes;
import android.media.AudioManager;
import android.media.SoundPool;
import android.os.Build;
import android.util.Log;