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 / 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`)
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
View build.gradle.js
productFlavors {
dev {
// To avoid using legacy multidex, set minSdkVersion to 21 or higher.
minSdkVersion 21
// The following configuration limits the "dev" flavor to using
// English string resources and xxhdpi screen-density resources.
resConfigs "en", "xxxhdpi"
@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 / travis-ci-build.yml
Last active Aug 28, 2016
Travis-CI build config file used for validating OpenAPI specification file. This file is taken from https://github.com/amardeshbd/medium-api-specification and **modified** for embedding on web, see github project for details.
View travis-ci-build.yml
language: bash
before_script:
# Load the shUnit2 for running shell-script unit test
- curl -L "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/shunit2/shunit2-2.1.6.tgz" | tar zx
script:
# Get proper branch name based on http://graysonkoonce.com/getting-the-current-branch-name-during-a-pull-request-in-travis-ci/
- export PR=https://api.github.com/repos/$TRAVIS_REPO_SLUG/pulls/$TRAVIS_PULL_REQUEST
- export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo `curl -s $PR | jq -r .head.ref`; fi)
You can’t perform that action at this time.