Skip to content

Instantly share code, notes, and snippets.

View jzallas's full-sized avatar

Jon Zallas jzallas

View GitHub Profile
@jzallas
jzallas / captors.kt
Last active October 25, 2021 22:38
Using argument captors
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNotNull
import org.junit.Test
import org.mockito.kotlin.*
class RepositoryImplTest {
@Test
fun `without validating prefix`() {
// setup
val mockApi: Api = mock()
#!/bin/bash
# disables bloat packages on samsung devices
# tested with z fold 3
packages_to_uninstall=(
"com.microsoft.skydrive" \
"com.microsoft.office.excel" \
"com.microsoft.office.word" \
"com.microsoft.office.powerpoint" \
@jzallas
jzallas / Trie.kt
Created March 6, 2021 04:49
Basic Trie in kotlin
// because this keeps coming up in coding challenges and I hate solving this from scratch
class Node(
var word: String? = null,
val next: MutableList<Node?> = MutableList(26) { null }
)
// inserting
fun Node.insert(word: String) {
var current = this
#!/bin/bash
# disables bloat packages on samsung devices
# tested with z fold 2
packages_to_uninstall=(
"com.microsoft.skydrive" \
"com.microsoft.office.excel" \
"com.microsoft.office.word" \
"com.microsoft.office.powerpoint" \
@jzallas
jzallas / SchedulerExecutionTests.kt
Created October 9, 2018 03:16
Writing assertions against executing rxjava2 schedulers in kotlin
package com.example.test
import io.reactivex.Observable
import io.reactivex.Observer
import io.reactivex.Scheduler
import io.reactivex.disposables.Disposable
import io.reactivex.observers.TestObserver
import io.reactivex.schedulers.Schedulers
import io.reactivex.subjects.BehaviorSubject
import org.junit.Assert.*