Skip to content

Instantly share code, notes, and snippets.

View artsok's full-sized avatar

Artem Sokovets artsok

  • Emirates Airline/ex. Sberbank Technologies JSC.
  • Dubai
View GitHub Profile
@timoxley
timoxley / gist:1721593
Created February 2, 2012 04:58
Recursively run all tests in test directory using mocha
// this will find all files ending with _test.js and run them with Mocha. Put this in your package.json
"scripts": {
"test": "find ./tests -name '*_test.js' | xargs mocha -R spec"
},
@x-cray
x-cray / sonar-report.groovy
Last active July 3, 2019 09:23
Jenkins email-ext plugin groovy template. Generates daily Sonar violations report grouped by culprits.
<!DOCTYPE html>
<head>
<title>Sonar violations report</title>
<style type="text/css">
body
{
margin: 0px;
padding: 15px;
}
@mojsha
mojsha / zalenium-template.yaml
Created November 6, 2017 09:03
OpenShift template for Zalenium
apiVersion: v1
kind: Template
metadata:
name: zalenium
annotations:
"openshift.io/display-name": "Zalenium"
"description": "Disposable Selenium Grid for use in OpenShift"
message: |-
A Zalenium grid has been created in your project. Continue to overview to verify that it exists and start the deployment.
@tuyen-vuduc
tuyen-vuduc / SharedPreferencesExtensions.kt
Created March 25, 2018 04:38
SharedPreferencesExtensions - Kotlin
import android.content.SharedPreferences
inline fun <reified T> SharedPreferences.get(key: String, defaultValue: T): T {
when(T::class) {
Boolean::class -> return this.getBoolean(key, defaultValue as Boolean) as T
Float::class -> return this.getFloat(key, defaultValue as Float) as T
Int::class -> return this.getInt(key, defaultValue as Int) as T
Long::class -> return this.getLong(key, defaultValue as Long) as T
String::class -> return this.getString(key, defaultValue as String) as T
else -> {
@mirmilad
mirmilad / debounce.kt
Last active June 21, 2023 22:46
Simple debounce extension for LiveData by using Coroutines
import androidx.lifecycle.LiveData
import androidx.lifecycle.MediatorLiveData
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
fun <T> LiveData<T>.debounce(duration: Long = 1000L, coroutineScope: CoroutineScope) = MediatorLiveData<T>().also { mld ->
val source = this