Standard escape codes are prefixed with Escape
:
- Ctrl-Key:
^[
- Octal:
\033
- Unicode:
\u001b
- Hexadecimal:
\x1B
- Decimal:
27
For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.
After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft
""" | |
Deploys local maven repository to a remote one. | |
Requires python 3.x and Maven 3.2.x and higher (lower versions of Maven might work in certain setups, | |
but have issues with SNI). | |
""" | |
import os | |
import os.path as p | |
import subprocess as subp |
public class BetterRecyclerView extends RecyclerView{ | |
private static final int INVALID_POINTER = -1; | |
private int mScrollPointerId = INVALID_POINTER; | |
private int mInitialTouchX, mInitialTouchY; | |
private int mTouchSlop; | |
public BetterRecyclerView(Context context) { | |
this(context, null); | |
} | |
public BetterRecyclerView(Context context, @Nullable AttributeSet attrs) { |
/** | |
* Custom Scroll listener for RecyclerView. | |
* Based on implementation https://gist.github.com/ssinss/e06f12ef66c51252563e | |
*/ | |
public abstract class EndlessRecyclerOnScrollListener extends RecyclerView.OnScrollListener { | |
public static String TAG = "EndlessScrollListener"; | |
private int previousTotal = 0; // The total number of items in the dataset after the last load | |
private boolean loading = true; // True if we are still waiting for the last set of data to load. | |
private int visibleThreshold = 5; // The minimum amount of items to have below your current scroll position before loading more. |
#!/bin/sh | |
set -e | |
if [ -z "$1" ]; then | |
shot_path=$(date +%Y-%m-%d-%H-%M-%S).mp4 | |
else | |
shot_path="$*" | |
fi |
Android Studio exposes developers to -nodpi
and -anydpi
in various places. For example, if you use the New Resource Directory wizard thing, and you choose to add a density qualifier to the directory, you will see "No Density" (-nodpi
) and "Any Density" (-anydpi
) options.
Some of you might expect these to be well-documented.
In a word, no.
However, courtesy of a fair amount of experimentation (largely done as part of work on this Stack Overflow question and this answer), their use becomes at least a bit clearer. Many thanks to Stack Overflow user rds for the help!
// Variant 1: For app or library project's build.gradle | |
android { | |
variantFilter { | |
if (it.buildType.name.equals('debug')) { | |
it.ignore = true | |
} | |
} | |
} | |
// Variant 2: For root build.gradle with applying only to library projects |
/** | |
* This class allows to inject into objects through a base class, | |
* so we don't have to repeat injection code everywhere. | |
* | |
* The performance drawback is about 0.013 ms per injection on a very slow device, | |
* which is negligible in most cases. | |
* | |
* Example: | |
* <pre>{@code |