Skip to content

Instantly share code, notes, and snippets.

View LOG-TAG's full-sized avatar

Subrahmanya S M LOG-TAG

View GitHub Profile
@PrashamTrivedi
PrashamTrivedi / DbSchema.kt
Last active March 26, 2019 12:28
Some extension functions with room: Requires Export schema Read this section https://medium.com/google-developers/testing-room-migrations-be93cdb0d975#6872
import com.squareup.moshi.Json
data class DbSchema(@field:Json(name = "formatVersion") val formatVersion: Int? = 0, @field:Json(
name = "database") val database: Database? = Database())
data class Database(@field:Json(name = "version") val version: Int = 0, @field:Json(name = "identityHash") val identityHash: String? = "", @field:Json(
name = "entities") val entities: List<Entity?>? = listOf(), @field:Json(name = "setupQueries") val setupQueries: List<String?>? = listOf())
public class OkHttpStack extends BaseHttpStack {
public OkHttpStack() {
}
@Override
public HttpResponse executeRequest(Request<?> request, Map<String, String> additionalHeaders) throws IOException, AuthFailureError {
OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder();
int timeoutMs = request.getTimeoutMs();
@rock3r
rock3r / gw-update.sh
Last active June 30, 2023 01:27
Simple script to update Gradle from the command line (*NIX)
#!/bin/sh
# License for any modification to the original (linked below):
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# Sebastiano Poggi wrote this file. As long as you retain
# this notice you can do whatever you want with this stuff. If we meet some day,
# and you think this stuff is worth it, you can buy us a beer in return.
#### SETUP/USAGE INSTRUCTIONS ####

JNI Example (Mac OS)

JNI (Java Native Interface) allows implementing methods in C/C++, and use them in Java.

1. Create JNIExample.java file

class JNIExample {

  // Native method, no body.
@AndrewReitz
AndrewReitz / ImmutableList.java
Last active December 25, 2018 22:56
Immutable List Stuff
import android.support.annotation.NonNull;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.RandomAccess;
@intari
intari / OkHttp3Stack.java
Last active April 22, 2022 02:34
OkHttp3Stack.java with Stetho support
package com.viorsan.test.android.Utils;
/**
* The MIT License (MIT)
*
* Copyright (c) 2015 Circle Internet Financial
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@Arinerron
Arinerron / permissions.txt
Last active March 27, 2024 04:59
A list of all Android permissions...
android.permission.ACCESS_ALL_DOWNLOADS
android.permission.ACCESS_BLUETOOTH_SHARE
android.permission.ACCESS_CACHE_FILESYSTEM
android.permission.ACCESS_CHECKIN_PROPERTIES
android.permission.ACCESS_CONTENT_PROVIDERS_EXTERNALLY
android.permission.ACCESS_DOWNLOAD_MANAGER
android.permission.ACCESS_DOWNLOAD_MANAGER_ADVANCED
android.permission.ACCESS_DRM_CERTIFICATES
android.permission.ACCESS_EPHEMERAL_APPS
android.permission.ACCESS_FM_RADIO
@cbeyls
cbeyls / MultiChoiceHelper.java
Last active September 30, 2020 14:48
Helper class to reproduce ListView's modal MultiChoice mode with a RecyclerView. Compatible with API 7+.
package be.digitalia.common.widgets;
import android.content.Context;
import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import android.support.v4.util.LongSparseArray;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.view.ActionMode;

This document has moved!

It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.

@drunknbass
drunknbass / EnvConfig.swift
Created June 17, 2016 04:05
Firebase stage + Prod config
import Foundation
@objc(EnvConfig)
class EnvConfig: NSObject {
#if ENVConfigStaging
class var isProduction:Bool {
return false
}