Skip to content

Instantly share code, notes, and snippets.

View starkej2's full-sized avatar
Using significant energy

Jeffrey Starke starkej2

Using significant energy
View GitHub Profile
@starkej2
starkej2 / osx-machine-setup.sh
Last active August 1, 2023 17:58
Installs the software I use on OSX
#!/bin/sh
# ------------------------- GENERAL ------------------------- #
# install xcode command line tools
xcode-select —install
# install and setup homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/jstarke/.zprofile
@starkej2
starkej2 / code-review-pull-request-template.md
Last active July 11, 2019 14:44 — forked from riggaroo/PULL_REQUEST_TEMPLATE
Pull request template format. Add this file to your .github folder

Type of change

  • Bug fix
  • New feature
  • Enhancement
  • Refactoring

Description

@starkej2
starkej2 / code-review-emoji-legend.md
Last active May 9, 2022 20:33
Code Review Emoji
Prefix Emoji Meaning
Required: :exclamation: A concern that must be addressed before merging.
Question: :question: A question that must be answered before merging.
Nitpick: ⛏️ :pick: An optional, low priority change request.
Idea: 💡 :bulb: An idea to consider for this PR or a future one.
@starkej2
starkej2 / java-RxErrorCollector.kt
Last active July 11, 2019 14:44
RxErrorCollector.kt
/**
* Collects any out-of-lifecycle, undeliverable exceptions that are thrown by RxJava streams.
* If [verifyAutomatically] is true, any tests running under this rule will automatically fail if
* any errors are collected. Alternatively, individual test methods can be checked manually using
* methods such as [assertNoErrors] and [assertFailsWith].
*
* This class was inspired by ideas from: https://github.com/ReactiveX/RxJava/issues/5234
*/
class RxErrorCollector(private val verifyAutomatically: Boolean = true) : TestRule {
private lateinit var errors: List<Throwable>
# clear app data
adb shell pm clear <app-package-name>
# launch app
adb shell am start -n <app-package-name>/<qualified-launch-activity-class>
@starkej2
starkej2 / RxImmediateSchedulerRule.kt
Last active December 30, 2021 18:33
RxJava Immediate Scheduler Test Rule
/**
* Replaces the default RxJava schedulers with a synchronous one.
*/
class RxImmediateSchedulerRule : TestRule {
private val immediateScheduler = object : Scheduler() {
@NonNull
override fun scheduleDirect(run: Runnable, delay: Long, unit: TimeUnit): Disposable {
// Hack to prevent stack overflows in unit tests when scheduling with a delay;
return super.scheduleDirect(run, 0, unit)
}
@starkej2
starkej2 / android-GroupedInputFormatWatcher.java
Last active September 22, 2016 20:51
A robust TextWatcher that groups input into the specified group sizes, with separators between them.
/**
* Formats the watched EditText to groups of characters, with separators between them.
*/
public class GroupedInputFormatWatcher implements TextWatcher {
private char separator;
private String separatorString;
private int groupSize;
/**
* Breakdown of this regex:
@starkej2
starkej2 / android-AsyncTaskLoader.java
Last active June 9, 2016 15:31
Example AsyncTaskLoader implementation
public class MyAsyncTaskLoader extends AsyncTaskLoader<ResponseObject> {
private String mId;
private ResponseObject mResponse;
/**
* Creates a new {@link MyAsyncTaskLoader}.
*
* @param context The context to use.
* @param id The ID of the item to load.
*/
@starkej2
starkej2 / android-DividerItemDecoration.java
Last active June 9, 2016 15:26 — forked from akmalxxx/DividerItemDecoration.java
Adds dividers between RecyclerView Items
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.LinearLayoutManager;
import android.view.View;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.Canvas;
@starkej2
starkej2 / android-font-styling.md
Last active June 9, 2016 15:27
Android System Font Styling

Font family

android:fontFamily="sans-serif"                 // roboto regular
android:fontFamily="sans-serif-light"           // roboto light
android:fontFamily="sans-serif-condensed"       // roboto condensed
android:fontFamily="sans-serif-condensed-light" // roboto condensed light
android:fontFamily="sans-serif-thin"            // roboto thin (android 4.2)
android:fontFamily="sans-serif-medium"          // roboto medium (android 5.0)