Skip to content

Instantly share code, notes, and snippets.

View GlennReilly's full-sized avatar

Glenn Reilly GlennReilly

  • Sydney, Australia
View GitHub Profile
@GlennReilly
GlennReilly / How to find Gradle home.txt
Last active October 18, 2017 04:58
How to find Gradle home
// You can write a simple gradle script to print your GRADLE_HOME directory.
task getHomeDir << {
println gradle.gradleHomeDir
}
// and name it build.gradle.
// Then run it with:
gradle getHomeDir
@GlennReilly
GlennReilly / The Technical Interview Cheat Sheet.md
Created April 5, 2017 10:42 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
@GlennReilly
GlennReilly / Using-rawquery-in-contentprovider.txt
Created May 30, 2016 09:48
Using-rawquery-in-contentprovider
I am using my custom ContentProvider to communicate with sqlite database. I would like to display on a list (using ListFragment), data that comes from two tables (with many to many relation). The only solution I can think of for such case is to use rawQuery. And the questions is, if it is a good practice, or should I solve this in some other way?
Example of tables:
Table A: ID, COLUMN_FROM_A
Table B: ID, COLUMN_FROM_B
Joining table AB: ID, FK_ID_A, FK_ID_B
@GlennReilly
GlennReilly / how-to-read-an-sqlite-db-in-android-with-a-cursorloader.txt
Created May 30, 2016 09:42
How to read an SQLite DB in android with a cursorloader?
Android Guide suggests to create a ContentProvider when you want to share you data with other applications. If you don't need this, you can just override method loadInBackgroud() of the CursorLoader class. For example write in you onCreateLoader:
return new CursorLoader( YourContext, null, YourProjection, YourSelection, YourSelectionArgs, YourOrder )
{
@Override
public Cursor loadInBackground()
{
// You better know how to get your database.
SQLiteDatabase DB = getReadableDatabase();
// You can use any query that returns a cursor.