Skip to content

Instantly share code, notes, and snippets.

View davydes's full-sized avatar

Eugene davydes

View GitHub Profile
require 'benchmark'
arr = Array(1..9999999)
arr = arr.sample(9999990).sort
def find_minus(p_arr)
Array(p_arr.first..p_arr.last) - p_arr
end
def find_binary (p_arr)
@davydes
davydes / cordova_app.js
Last active January 26, 2017 09:50
Example Cordova Push Plugin With Parse Server
// Plugin homepage https://github.com/phonegap/phonegap-plugin-push
var app = {
initialize() {
document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
},
addPushService() {
if(window.PushNotification){
#!/bin/sh
#
# Clean-up Xiaomi smartphone without rooting:
#
# 1) You have to install adb tool from android sdk
# 2) You have to activate developer options, next activate usb debugging
# 3) Comment out or delete lines with packages, if you really need them
# 4) Optional: I hightly recommed to activate OEM unlocking feature in developer options.
# It doesn't unlock you device immediately, but in case of breaking you phone
# you will have opportunity to unlock you phone and reflash it via MiFlash.
@davydes
davydes / Coroutines.kt
Created April 2, 2021 08:29
Kotlin Cooking Book
import kotlinx.coroutines.flow.*
import kotlin.coroutines.CoroutineContext
/*
Map each elements with a concurrency level
Output elements can be shuffled
*/
suspend fun <T, R> Iterable<T>.mapConcurrently(
level: Int,
@davydes
davydes / CoroutineTest.kt
Created August 12, 2021 08:34
Coroutine test with mockito.kotlin
import kotlinx.coroutines.CoroutineName
import kotlinx.coroutines.runBlocking
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test
import org.mockito.kotlin.doSuspendableAnswer
import org.mockito.kotlin.mock
import kotlin.coroutines.coroutineContext
interface Subject {
suspend fun myName(): String?
@davydes
davydes / android-backup-apk-and-datas.md
Created March 23, 2022 12:13 — forked from AnatomicJC/android-backup-apk-and-datas.md
Backup android app, data included, no root needed, with adb

Backup android app, data included, no root needed, with adb

adb is the Android CLI tool with which you can interact with your android device, from your PC

You must enable developer mode (tap 7 times on the build version in parameters) and install adb on your PC.

Fetch application APK

To get the list of your installed applications: