Skip to content

Instantly share code, notes, and snippets.

@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
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) {
dependencies {
compile 'com.kbeanie:image-chooser-library:1.4.4@aar'
compile 'com.soundcloud.android:android-crop:1.0.1@aar'
}
private ImagePicker imagePicker;
// init
imagePicker = new ImagePicker(getActivity(), new ImageChooserListener() {
@Override
public void onImageChosen(final ChosenImage chosenImage) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
filePath = chosenImage.getFileThumbnail();
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;
@Kishanjvaghela
Kishanjvaghela / AutoLink.js
Last active November 29, 2017 10:06
React Native Code
@Kishanjvaghela
Kishanjvaghela / opacity.txt
Created December 8, 2017 09:00 — forked from alvinthen/opacity.txt
Convert opacity values in percentage to hexadecimal
0% - 00
1% - 03
2% - 05
3% - 08
4% - 0A
5% - 0D
6% - 0F
7% - 12
8% - 14
9% - 17
@Kishanjvaghela
Kishanjvaghela / ubuntu-eol.md
Created January 21, 2018 18:56 — forked from dergachev/ubuntu-eol.md
What to do when your ubuntu distro is End-of-Life

Let's say you're using Ubuntu 13.04 (Raring Ringtail, released in April 2013) and it just went End-of-Life on you, because it's supported for only 6 months, and the deprecated packages are taken down after 12 months.

You'll probably figure this out the hard way. When you run sudo apt-get update, it will eventually report these errors:

Ign http://archive.ubuntu.com raring-updates/universe Sources/DiffIndex
Err http://security.ubuntu.com raring-security/main Sources
  404  Not Found [IP: 91.189.91.15 80]
Err http://security.ubuntu.com raring-security/universe Sources
  404  Not Found [IP: 91.189.91.15 80]
@Kishanjvaghela
Kishanjvaghela / network_security_config.xml
Created May 8, 2018 21:11
making charles debugging work on marshmallo and above
+ android:networkSecurityConfig="@xml/network_security_config">