Skip to content

Instantly share code, notes, and snippets.

View milon87's full-sized avatar
🎯
Focusing

Din Islam milon87

🎯
Focusing
  • TopUp Limited
  • Dhaka
View GitHub Profile
@milon87
milon87 / RecycleViewAdapter
Created November 12, 2017 08:01
Generic RecycleView adapter
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
#parse("File Header.java")
@milon87
milon87 / api.js
Created September 9, 2017 07:17
separating http call from ui logic and back to result
export function getvals(url){
return fetch(url,
{
method: "GET",
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
})
.then((response) => response.json())
@milon87
milon87 / api.js
Created September 9, 2017 05:37
how to use x-www-form-urlencoded in react native
var details = {
'userName': 'test@gmail.com',
'password': 'Password!',
'grant_type': 'password'
};
var formBody = [];
for (var property in details) {
var encodedKey = encodeURIComponent(property);
var encodedValue = encodeURIComponent(details[property]);
@milon87
milon87 / login.js
Created August 24, 2017 09:27
x-www-form-urlencoded post in react native
getLoginAPI = () => {
let details = {
'username': 'username',
'password': 'demo'
};
let formBody = [];
for (let property in details) {
let encodedKey = encodeURIComponent(property);
@milon87
milon87 / Free O'Reilly Books.md
Created June 23, 2017 16:41 — forked from augbog/Free O'Reilly Books.md
Free O'Reilly Books

Free O'Reilly books and convenient script to just download them.

Thanks /u/FallenAege/ and /u/ShPavel/ from this Reddit post

How to use:

  1. Take the download.sh file and put it into a directory where you want the files to be saved.
  2. cd into the directory and make sure that it has executable permissions (chmod +x download.sh should do it)
  3. Run ./download.sh and wee there it goes. Also if you do not want all the files, just simply comment the ones you do not want.
@milon87
milon87 / FileDownloadRetrieve.java
Last active March 22, 2017 05:41
Download file android
class FileDownloader{
public static void image_download(Context context, String uRl, String bookNmae) {
File direct = new File(Environment.getExternalStorageDirectory()
+ "/appFolderName/images");
String imageName = uRl.substring(uRl.lastIndexOf('/') + 1, uRl.length());
@milon87
milon87 / FragmentHome.java
Created February 5, 2017 12:04
Easy recycleView item/full list item click listener
public class FragmentHome extends Fragment implements ListItemClickListener {
public FragmentHome() {
//Required empty public constructor
}
@Bind(R.id.home_rv_offer)
RecyclerView recyclerView;
@milon87
milon87 / GPSTracker.java
Last active April 13, 2022 17:40
Show marker and map in fragment android
public class GPSTracker extends Service implements LocationListener {
private final Context mContext;
// flag for GPS status
boolean isGPSEnabled = false;
// flag for network status
boolean isNetworkEnabled = false;
@milon87
milon87 / AppHelper.java
Created January 3, 2017 14:19 — forked from anggadarkprince/AppHelper.java
Upload file with Multipart Request Volley Android
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import java.io.ByteArrayOutputStream;
/**
* Sketch Project Studio
* Created by Angga on 12/04/2016 14.27.
*/
public class AppHelper {
@milon87
milon87 / AppCompatPreferenceActivity.java
Last active December 31, 2016 21:06
Preference Activity with appcompact
public abstract class AppCompatPreferenceActivity extends PreferenceActivity {
private AppCompatDelegate mDelegate;
@Override
protected void onCreate(Bundle savedInstanceState) {
getDelegate().installViewFactory();
getDelegate().onCreate(savedInstanceState);
super.onCreate(savedInstanceState);
}