Skip to content

Instantly share code, notes, and snippets.

View armanso's full-sized avatar

Arman Soudi armanso

View GitHub Profile
@armanso
armanso / adb_push_install.sh
Created October 26, 2020 20:50
adb push install
adb push ./app.apk /data/local/tmp &&
adb shell pm install /data/local/temp/app.apk
@armanso
armanso / adb_install.sh
Created October 26, 2020 20:46
adb install simple
adb install ./my_app.apk
@armanso
armanso / Index.ts
Last active April 19, 2020 18:12
Index.ts
import * as functions from 'firebase-functions';
import * as admin from 'firebase-admin';
import axios from "axios"
import * as path from 'path'
import * as os from 'os'
import * as fs from 'fs'
import { PublishedReviews, Config } from 'app-reviews/lib/global-types';
@armanso
armanso / index.ts
Last active April 19, 2020 18:09
admin
import * as admin from 'firebase-admin';
const serviceAccount from './google-services.json'
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
storageBucket: "[project bucket name]"
})
@armanso
armanso / index.ts
Last active April 19, 2020 17:18
config files
const storePublishedReviewsList = async (reviews: PublishedReviews) => {
// callback to store data file
}
const retrivePublishedReviewsList = async (): Promise<PublishedReviews> => {
// callback to retrive data from data source
}
const onNewMessageAvailable = async (messages: string[]) => {
// callback of having new messages
@armanso
armanso / index.ts
Last active April 19, 2020 17:02
Firebase init index
exports.appReviews = functions.runWith({ timeoutSeconds: 5 * 60 })
.pubsub
.schedule('every 15 minutes').onRun(async context => {
// magic gonna happen here!
})
class TestFrameLayout @JvmOverloads constructor(
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
) : FrameLayout(context, attrs, defStyleAttr) {
private val paint: Paint = Paint()
init {
clipChildren = false
clipToPadding = false
paint.color = Color.WHITE
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
testView.setShadow(R.color.shadow, R.dimen.radius, R.dimen.evl)
}
}
@armanso
armanso / Extention.kt
Last active April 17, 2021 14:14
Part 2 of blog post - Control view's shadow
fun View.setShadow(
@ColorRes shadowColor: Int,
@DimenRes cornerRadius: Int,
@DimenRes elevation: Int,
shadowGravity: Int = Gravity.BOTTOM,
@ColorRes backgroundColorResource: Int = 0
) {
val resource = context.resources
val firstLayer = 0
val ratioTopBottom = 3
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.shapes.RoundRectShape;
import android.support.annotation.ColorRes;
import android.support.annotation.DimenRes;
import android.support.v4.content.ContextCompat;
import android.view.Gravity;