Skip to content

Instantly share code, notes, and snippets.

View bclymer's full-sized avatar

Brian Clymer bclymer

  • Twitch
  • Omaha, NE
View GitHub Profile
@rob-murray
rob-murray / gradle_andr_version_code.groovy
Last active December 23, 2015 09:19
How to increment the Android version code using Gradle Android build system
// add method to get the versionCode from cli param
// eg. `gradle tasks -PversionCode=999`
/**
* Get the version code from command line param
*
* @return int If the param -PversionCode is present then return int value or -1
*/
def getVersionCode = { ->
@bclymer
bclymer / ThreadManager.java
Last active May 25, 2019 13:16
A class to help you do thread-y things in Java.
package com.example.threadmanagertests;
import java.lang.Thread.UncaughtExceptionHandler;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
@bclymer
bclymer / EventBus.java
Last active December 23, 2015 23:19
Manage event subscriptions in Android.
import java.lang.Thread.UncaughtExceptionHandler;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
@lauw
lauw / SnappingRecyclerView.java
Created May 4, 2015 23:00
Snapping RecyclerView (Horizontal)
/*
* Copyright 2015 Laurens Muller.
*
* 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