Skip to content

Instantly share code, notes, and snippets.

View singhangadin's full-sized avatar
🏠
Working from home

Angad Singh singhangadin

🏠
Working from home
View GitHub Profile
#include <AceButton.h>
#include <Keyboard.h>
#include <LinkedList.h>
using namespace ace_button;
typedef LinkedList<int> KeyCodes;
class Key: public IEventHandler {
private:
#include "Key.h"
static const uint8_t NUM_PINS = 4;
static const uint8_t NUM_BUTTONS = 12;
static const uint8_t PINS[NUM_PINS] = {4, 5, 6, 7};
Key *keys;
static AceButton b01(1);
static AceButton b02(2);
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
@singhangadin
singhangadin / DatabaseInstrumentedTest.java
Created September 29, 2019 20:55
Testing Room Migrations
@RunWith(AndroidJUnit4.class)
public class DatabaseInstrumentedTest {
private static final String TEST_DB_NAME = "test_database";
@Rule
public MigrationTestHelper testHelper =
new MigrationTestHelper(
InstrumentationRegistry.getInstrumentation(),
TestDatabase.class.getCanonicalName(),
@singhangadin
singhangadin / Dockerfile
Last active April 25, 2020 23:47
Docker file for Android Tests
FROM openjdk:8-jdk
MAINTAINER Angad Singh <angads25@gmail.com>
CMD ["gradle"]
ENV GRADLE_HOME /opt/gradle
ENV GRADLE_VERSION 5.6.4
ARG GRADLE_DOWNLOAD_SHA256=abc10bcedb58806e8654210f96031db541bcd2d6fc3161e81cb0572d6a15e821
RUN set -o errexit -o nounset \
@singhangadin
singhangadin / OnItemClickListener.java
Created January 16, 2019 21:04
RecyclerView Touch Helper
import android.support.v7.widget.RecyclerView;
import android.view.View;
public interface OnItemClickListener {
void onClick(RecyclerView parent, View v, int position);
}
@singhangadin
singhangadin / Utility.java
Last active January 22, 2019 14:02
Utility functions used regularly
public class Utility {
public static void copyDatabaseToSdcard(Context context, String databaseName) {
if(BuildConfig.DEBUG) {
String currentDBPath = context.getDatabasePath(databaseName).getAbsolutePath();
String downloadDir = Environment.getExternalStorageDirectory() + "/Dump/" + databaseName + ".db";
File dataBase = new File(currentDBPath);
File file = new File(downloadDir);
try {
file.delete();
@singhangadin
singhangadin / SortedUniqueList.java
Created October 4, 2018 19:28
An array list that keeps items sorted and unique
import com.github.angads25.javaplayground.model.UniqueListItem;
import java.util.AbstractList;
import java.util.ArrayList;
import java.util.Collection;
public class SortedUniqueList<T extends UniqueListItem> extends AbstractList<T> {
private ArrayList<T> internalList = new ArrayList<>();
@Override public boolean add(T t) {