Skip to content

Instantly share code, notes, and snippets.

@wajahatkarim3
wajahatkarim3 / ActivitiesLaunchingWay.kt
Last active April 3, 2023 08:12
Kotlin Extensions for simpler, easier and funw way of launching of Activities
/**
* Kotlin Extensions for simpler, easier and funw way
* of launching of Activities
*/
inline fun <reified T : Any> Activity.launchActivity (
requestCode: Int = -1,
options: Bundle? = null,
noinline init: Intent.() -> Unit = {})
{
node {
stage 'Checkout'
checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[url: 'https://github.com/abnormallydriven/android-ci-example.git']]])
sh "./gradlew clean"
stage 'Unit Test'
sh "./gradlew test"
@CarolusX74
CarolusX74 / AuthTokenRefreshInterceptor.java
Last active March 15, 2022 04:42
How I automatically refresh OAuth "access token" with okhttp interceptors using "refresh token". All requests will wait until token refresh finished, and then will continue with the new token. - EN (By Carlos Torres)
package com.cjtp.android.api.interceptors;
import android.util.Log;
import com.google.gson.JsonObject;
import com.inviteez.android.core.Session;
import com.inviteez.android.utils.Constant;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
@mediavrog
mediavrog / gist:49c4f809dffea4e00738a7f5e3bbfa59
Last active June 20, 2024 18:13
CORS in Google Cloud Functions for Firebase
const cors = require('cors')({origin: true});
exports.sample = functions.https.onRequest((req, res) => {
cors(req, res, () => {
res.send('Passed.');
});
});
@iamtodor
iamtodor / PicassoCaching.java
Last active May 29, 2021 15:33
Disk caching in Picasso with OkHttp interceptors
// module level build.gradle dependencies
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.squareup.okhttp3:okhttp:3.4.2'
compile 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.0.2'
// imports
import com.jakewharton.picasso.OkHttp3Downloader;
import com.squareup.picasso.Picasso;
import java.io.IOException;
@xjamundx
xjamundx / promise-anti-patterns.md
Last active March 4, 2021 17:49
Promise Anti-Patterns
@amaksoft
amaksoft / Jenkinsfile
Last active December 29, 2021 08:15
My example Jenkins Pipeline setup for Android app project
#!/usr/bin/groovy
/*
* Copyright (c) 2016, Andrey Makeev <amaksoft@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
@jasonswearingen
jasonswearingen / gcloud.d.ts
Last active September 29, 2022 08:28
typescript definitions for gcloud datastore, v0.27.0 complete, but not yet tested/verified.
export interface IModuleImport {
(authOptions?: IAuthOptions): IGCloud;
}
export interface IAuthOptions {
projectId?: string;
keyFilename?: string;
}
@ph0b
ph0b / app_build.gradle
Last active November 20, 2019 09:21
config example on Multiple APK support and mixing gradle-stable and gradle-experimental plugin, for NDK-enabled Android projects. To support AS 2.0 debug, just add lib/build/intermediates/binaries/release/obj/[abi] to Symbol directories
apply plugin: 'com.android.application'
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
applicationId "com.example.yourapp"
minSdkVersion 16
targetSdkVersion 23
@Suleiman19
Suleiman19 / Spinner Setup (Activity)
Last active October 11, 2022 14:10
Theme Aware Material Design Spinner
Spinner spinner = (Spinner) findViewById(R.id.main_spinner);
ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<>(getSupportActionBar().getThemedContext(),
R.layout.spinner_list_style,
getResources().getStringArray(R.array.countries));
spinnerAdapter.setDropDownViewResource(R.layout.spinner_dropdown_item);
spinner.setAdapter(spinnerAdapter);