Skip to content

Instantly share code, notes, and snippets.

View thanksmister's full-sized avatar

Mister thanksmister

View GitHub Profile
@ferrerojosh
ferrerojosh / AndroidWorkerInjection.kt
Created May 30, 2018 06:40
androidx workmanager injector temporary impl
import androidx.work.Worker
object AndroidWorkerInjection {
fun inject(worker: Worker) {
checkNotNull(worker, { "worker" })
val application = worker.applicationContext
if (application !is HasWorkerInjector) {
throw RuntimeException("${application.javaClass.canonicalName} does not implement ${HasWorkerInjector::class.java.canonicalName}")
}
@JosiasSena
JosiasSena / WifiConnectionReceiver.java
Last active June 1, 2023 16:36
WifiConnectionReceiver
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiManager;
import android.support.annotation.NonNull;
import android.util.Log;
import static android.content.ContentValues.TAG;
@hpsaturn
hpsaturn / MailGunBasicSendMail.java
Last active April 2, 2020 17:10
Send Mail basic implementation via MailGun API and Retrofit for Android
import android.util.Base64;
import com.google.gson.Gson;
import com.hpsaturn.robotsanta.Config;
import com.hpsaturn.robotsanta.models.MailGunResponse;
import retrofit.Callback;
import retrofit.RestAdapter;
import retrofit.converter.GsonConverter;
import retrofit.http.Field;
@ZacSweers
ZacSweers / RxJava.md
Last active September 3, 2018 18:52 — forked from cesarferreira/RxJava.md
Party tricks with RxJava, RxAndroid & Retrolambda

View Click

Instead of the verbose setOnClickListener:

RxView.clicks(submitButton).subscribe(o -> log("submit button clicked!"));

Filter even numbers

Observable
    .just(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
@rubenlagus
rubenlagus / Main.java
Last active May 31, 2021 13:22
Example of sending a SendMessage method using Telegram API with ReplyMarkupKeyboard
package org.telegram.example.SendMessage;
import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;
import org.json.JSONObject;
import java.io.IOException;
@blackcj
blackcj / MainActivity.java
Last active October 9, 2022 09:52
Design support library with CoordinatorLayout, SwipeRefreshLayout and RecyclerView.
import android.os.Bundle;
import android.support.design.widget.AppBarLayout;
import android.support.design.widget.TabLayout;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import com.blackcj.designsupportexample.adapters.RecyclerViewAdapter;
@rharter
rharter / RevealDrawable.java
Created April 3, 2015 17:41
A Drawable that transitions between two child Drawables based on this Drawable's current level value. The idea here is that the center value (5000) will show the 'selected' Drawable, and any other value will show a transitional value between the 'selected' Drawable and the 'unselected' Drawable.
package com.pixite.fragment.widget;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Drawable.Callback;
import android.view.Gravity;
@dperetti
dperetti / call_modal_client.js
Last active February 27, 2020 05:54
Meteor Handlebars modal pattern
Session.set('modalData', {template: "modal-backups", title: "Backup", files: [{name: "blah", date: new Date()}]});
$('#myModal').modal();
@AmazingDreams
AmazingDreams / install-bfgminer.sh
Last active July 5, 2023 01:49
Installing BFGMiner Raspberry Pi
sudo apt-get install git \
build-essential autoconf automake libtool pkg-config libcurl4-gnutls-dev \
libjansson-dev uthash-dev libncursesw5-dev libudev-dev libusb-1.0-0-dev \
libevent-dev libmicrohttpd-dev hidapi
mkdir ~/build
cd ~/build
git clone --depth=1 https://github.com/luke-jr/bfgminer.git
@jaredrummler
jaredrummler / MenuTint.java
Last active April 13, 2022 03:58
Helper class to set the color and transparency for menu icons in an ActionBar or Toolbar.
/*
* Copyright (C) 2015. Jared Rummler <jared.rummler@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software