Skip to content

Instantly share code, notes, and snippets.

@nekdenis
nekdenis / MockitoKotlin.kt
Last active September 27, 2018 02:05
My usage of Mockito with Kotlin
package com.sample
import org.mockito.Mockito
//wrappers:
inline fun <reified T : Any> mock(): T = Mockito.mock(T::class.java)
inline fun <reified T : Any> mock(mocking: T.() -> Unit): T = Mockito.mock(T::class.java).apply { mocking() }
@nekdenis
nekdenis / gist:2cbdff5792cd1d696b35abd868725bcd
Created January 11, 2017 12:34
Bash script that starts Android emulator and waits until it loaded
echo 'Searching for device...'
devicesCount=`adb devices | grep -c emulator`
if [[ $devicesCount =~ 0 ]]; then
echo 'starting emulator'
/Users/tcagent/Library/Android/sdk/tools/emulator -netdelay none -netspeed full -avd Nexus_5X_API_25_x86 &
fi
#wait emulator ready
@nekdenis
nekdenis / gist:960f5d1ca46946f54a5450bea14d0518
Created August 18, 2016 13:21
Generate text file with Android fragments' names and description
#!/bin/bash
function processFile {
# echo '***'
# echo "processing $1"
echo '—————————————————————————————————————————————' >> $outputFile
fragmentName=$(basename $1 .java)
echo "Screen name: "$fragmentName >> $outputFile
echo '' >> $outputFile
# find text between "/**" and "class"
@nekdenis
nekdenis / gist:60a160a5a3503f0dbdd1a0a429aa8794
Created July 19, 2016 14:57
TeamCity script git changes. Script that loads commit messages of last changes
#!/bin/bash
# Where the changelog file will be created
outputFile='%system.teamcity.build.tempDir%/releasenotesfile_%teamcity.build.id%.txt'
# the url of teamcity server
teamcityUrl='%teamcity.serverUrl%'
# username to access Teamcity REST API
username='%system.teamcity.auth.userId%'
# password to access Teamcity REST API
password='%system.teamcity.auth.password%'