Skip to content

Instantly share code, notes, and snippets.

View kota1921's full-sized avatar

kota1921 kota1921

  • in the middle of nowhere
View GitHub Profile
{
"context": {
"build": {
"device": "toco",
"fingerprint": "Xiaomi/toco_ru/toco:11/RKQ1.200826.002/V12.5.1.0.RFNRUXM:user/release-keys",
"model": "Mi Note 10 Lite",
"version": {
"sdk": 30
}
},
@RunWith(AndroidJUnit4::class)
class KotlinSerializationBenchmark {
private val context = ApplicationProvider.getApplicationContext<Context>()
private val simpleJsonString = Utils.readJsonAsStringFromDisk(context, R.raw.simple)
@get:Rule val benchmarkRule = BenchmarkRule()
@Before
fun init() {
private fun measureWorkNs(): Long {
// Access a non-trivial amount of data to try and 'reset' any cache state.
// Have observed this to give more consistent performance when clocks are unlocked.
copySomeData()
val state = BenchmarkState()
state.performThrottleChecks = false
val input = FloatArray(16) { System.nanoTime().toFloat() }
val output = FloatArray(16)
@Before
fun init() {
val field = androidx.benchmark.BenchmarkState::class.java.getDeclaredField("REPEAT_COUNT")
field.isAccessible = true
field.set(benchmarkRule, GLOBAL_REPEAT_COUNT)
}
fun onNextIteration(durationNs: Long): Boolean {
iteration++
totalDuration += durationNs
if (iteration == 1) {
fastMovingAvg = durationNs.toFloat()
slowMovingAvg = durationNs.toFloat()
return false
}
val startTime = System.currentTimeMillis()
//выполняем код который хотим оценить
val totalTime = System.currentTimeMillis() - startTime
@kota1921
kota1921 / create gzip
Created April 20, 2019 01:19
Create Gzip Archive Android kotlin
//this is zip function for new standards, if you don't
private fun zipFromRaw(rawTextId: Int, resultFileName: String) {
val inputStream = context.resources.openRawResource(rawTextId)
val stringBuilder = StringBuilder()
try {
val reader = BufferedReader(InputStreamReader(inputStream))
var line = reader.readLine()
while (line != null) {
Здравствуйте!
Меня порекомендовал Вас Антон
Я по поводу разработки приложения на Андроид
На данный момент имеется приложение на IOS - Social Gainer
Вот само приложение в AppStore:
Social Gainer
https://appsto.re/ru/eZYeeb.i
Нужно написать тоже самое, только под Андроид
Приложение взаимодействует с апи сайта (раздел Инстаграм) - socgain.com
@kota1921
kota1921 / gist:ce36d2971ce54ff1cc4e897f6f0ff80e
Created November 21, 2017 09:04
Common RecyclerView adapter
public class ManagerContactAdapter extends RecyclerView.Adapter<ManagerContactAdapter.VH>{
private List<Manager> managers = new ArrayList<>();
private OnClickDeleteContactListener listener;
public ManagerContactAdapter(OnClickDeleteContactListener listener) {
this.listener = listener;
}
public void setItems(List<Manager> managers){
@kota1921
kota1921 / rx-chain
Last active July 6, 2017 10:18
rx-array-download
public Observable<List<SomeModel>> loadItems() {
return apiService.getListOfElement()
.flatMapIterable(Result::getElements)
.flatMap(element -> apiService.getDetailedElement(element.getId()))
.toList()
.toObservable();
}