Skip to content

Instantly share code, notes, and snippets.

View s3va's full-sized avatar

Vsevolod Semenov s3va

  • Seva's studio apartment
  • Moskva (Moscow)
View GitHub Profile
@mypplication
mypplication / JsoJsonPreProcessingAdapterFactorynPre
Created February 28, 2022 14:00
Gson TypeAdapterFactory to handle when API return empty array instead of null value
/**
* Usage : gsonBuilder.registerTypeAdapterFactory(JsonPreProcessingAdapterFactory())
**/
class JsonPreProcessingAdapterFactory : TypeAdapterFactory {
override fun <T> create(gson: Gson, type: TypeToken<T>): TypeAdapter<T>? {
if (!Object::class.java.isAssignableFrom(type.rawType) ||
Iterable::class.java.isAssignableFrom(type.rawType)
@Jerry0022
Jerry0022 / PHP Google oAuth2.php
Last active February 27, 2021 22:37
Google oAuth2, sign up, sign in, logout and show user data. Need to set REDIRECT_URL from google developer console and the https://github.com/google/google-api-php-client cloned in the web directory.
<?php
// Enable error reporting
error_reporting(E_ALL);
ini_set('display_errors', 1);
$google_redirect_url = 'REDIRECT_URL';
//start session
session_start();