Skip to content

Instantly share code, notes, and snippets.

🙈
Just do it!

Hossain Khan amardeshbd

🙈
Just do it!
Block or report user

Report or block amardeshbd

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@amardeshbd
amardeshbd / MockSharedPreference.java
Last active Nov 19, 2019
Android Mock Shared Preference for unit testing. (NOTE: The intention here is to avoid mocking lots of API related to `SharedPreferences`, as outcome from interacting with `SharedPreferences` is not relevant in the unit test.). Please comment if there is a cleaner way of doing this.
View MockSharedPreference.java
import android.content.SharedPreferences;
import android.support.annotation.Nullable;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
/**
@amardeshbd
amardeshbd / RoundedTransformation.java
Created Jul 25, 2016 — forked from aprock/RoundedTransformation.java
Rounded Corner Image Transformation for square's Picasso
View RoundedTransformation.java
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.RectF;
import android.graphics.Shader;
/**
@amardeshbd
amardeshbd / livetemplate.groovy
Last active Sep 14, 2019
Kotlin - Timber Log Live Template
View livetemplate.groovy
/*
Go to Android Studio Preferences
Editor > Live Template > Kotlin
Duplicate "soutp" and use following template for `$FORMAT`.
```
timber.log.Timber.d($FORMAT$)
```
Applicable in kotlin statement (it should be pre-selected for you, since you copied `soutp`)
@amardeshbd
amardeshbd / kml-to-android-maps-v2.php
Last active Jul 19, 2019
Snippet for parsing KML file and then converting to polygon shapes of Android Google Maps V2
View kml-to-android-maps-v2.php
<?php
/**
* Dirty way to parse the KML file and create equivalent polygons for android maps V2
*
* What it does:
* - Reads local KML file and looks for "Polygon" data, and converts them
* to equivalent simple polygon data for Android Maps V2
*
* What it does NOT do / Limitations:
* - Consider all possible DOM tree structure
View express-simple-api.js
/**
* Say hello API
* Try: https://mock-apis-server.firebaseapp.com/say/hello
*/
app.get('/say/hello', (req, res) => {
// Return success response
return res.status(200).json({"message":"Hello there... Welcome to mock server."});
});
/* [END `/say/hello` ] - must be added before `exports.api = ...` */
@amardeshbd
amardeshbd / express-and-firebase.js
Created Mar 13, 2019
Firebase and express barebone.
View express-and-firebase.js
'use strict';
// [START import]
const functions = require('firebase-functions');
const express = require('express');
const app = express();
// [END import]
// [START middleware]
const cors = require('cors')({origin: true});
@amardeshbd
amardeshbd / update-npm.sh
Created Mar 13, 2019
Update npm modules
View update-npm.sh
cd functions
npm install
cd ..
View firebase-use-project.sh
firebase use --add your-project-id-23d6x
@amardeshbd
amardeshbd / firebase-list.sh
Created Mar 13, 2019
Firebase list projects
You can’t perform that action at this time.