Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am nwagu on github.
  • I am nwagu (https://keybase.io/nwagu) on keybase.
  • I have a public key ASD8_Wp_R2DCET_8WuG5Oj8JoQFK0X_L7MGq_UYYDL5nVgo

To claim this, I am signing this object:

sourceSets {
main {
java {
srcDir '../side-app/src/main/java'
}
assets {
srcDir '../side-app/src/main/assets'
}
res {
srcDirs '../side-app/src/main/res'
@nwagu
nwagu / DigitSwapCompare.kt
Last active May 30, 2020 07:23
A simple Kotlin function to check if a two-digit number is larger than its digit swap.
import org.junit.Assert.assertEquals
import org.junit.Test
class DigitSwapCompare {
@Test
fun testFunction() {
assertEquals(isLargerOfDigitSwap(14), false)
assertEquals(isLargerOfDigitSwap(53), true)
assertEquals(isLargerOfDigitSwap(99), true)
@nwagu
nwagu / ExampleListAdapter.java
Created May 6, 2019 10:13
How do I set OnClick Listener inside recycler adapter when using unknown ViewDatabinding instead of ItemDatabinding?
public class ExampleListAdapter extends MyBaseAdapter {
private Context context;
private List<Example> exampleList;
public ExampleListAdapter(Context context, List<Example> exampleList) {
this.context = context;
this.exampleList = exampleList;
}
@Override
@nwagu
nwagu / EightQueens.java
Created April 2, 2019 19:57
Program prints the 92 solutions to the Eight Queens puzzle using brute force and recursion.
//This program prints the 92 solutions to the 8 Queens puzzle
//Brute force and Recursion
//Updated 7/11/2017 by Chukwuemeka Nwagu
public class EightQueens {
private static int[][] board;
private static int[][] solution = new int[8][4]; //this will contain the row and column numbers for cleared solutions
public static void main(String[] args) {