Skip to content

Instantly share code, notes, and snippets.

View filipproch's full-sized avatar

Filip Prochazka filipproch

View GitHub Profile
interface TasksRepository {
fun createNewTask(message: String)
fun getTasks(): List<Task>
}
class MyApp : Application(), KodeinAware {
override val kodein by Kodein.lazy {
/* ... */
}
}
@filipproch
filipproch / build.gradle
Last active March 18, 2018 17:56
Kotlin example
dependencies {
implementation 'com.github.salomonbrys.kodein:kodein:4.1.0'
implementation 'com.github.salomonbrys.kodein:kodein-android:4.1.0'
}
@filipproch
filipproch / build.gradle
Last active March 18, 2018 17:57
Dagger example
dependencies {
implementation 'com.google.dagger:dagger-android:2.x'
implementation 'com.google.dagger:dagger-android-support:2.x' // if you use the support libraries
annotationProcessor 'com.google.dagger:dagger-android-processor:2.x'
}
// AsrSessionOperator.kt
// nova metoda
fun setSensitivityLevel(newLevel: Float): Observable<CommandResponse> {
val bundle = Bundle()
bundle.putFloat(AsrControlCommand.EXTRA_SENSITIVITY, newLevel)
val cmd = AsrControlCommand(AsrControlCommand.CMD_UPDATE_SENSITIVITY_LEVEL, bundle)
return AsrServiceConnection.operator.sendAsrControlCommand(cmd)
}
@filipproch
filipproch / testobjects.cpp
Created June 17, 2016 06:04
test creating objects in c++
//
// Created by Filip Prochazka (@filipproch)
//
#include <jni.h>
#ifdef __cplusplus
extern "C"
{
#endif
#!/bin/sh
java -Xms512M -Xmx1024M -XX:MaxPermSize=128M -jar spigot.jar
public void sendRequests() {
new DataSender().execute();
}
public static class DataSender extends AsyncTask<Void, Void, Void> {
@Override
protected Void doInBackground(Void... params) {
db=openOrCreateDatabase("StudentDB", Context.MODE_PRIVATE, null);
Cursor c=db.rawQuery("SELECT * FROM student", null);
@filipproch
filipproch / build.gradle
Last active May 13, 2020 22:23
With Archon installed, this way you can debug your Android app without slow bad emulator
task runChromeAppDebug(type: Exec) {
executable "bash"
args "--login", "-c", "google-chrome --load-and-launch-app=${projectDir}/${android.defaultConfig.applicationId}.android"
}
task copyChromeAppDebug(type: Copy) {
from "${buildDir}/outputs/apk/${project.name}-debug.apk"
into "${projectDir}/${android.defaultConfig.applicationId}.android/vendor/chromium/crx/"
}
@filipproch
filipproch / gist:7d29ac95c324ec132396
Created January 24, 2015 17:59
[ANDROID] - Record audio to ByteBuffer
class AudioRecordThread implements Runnable {
@Override
public void run() {
int bufferLength = 0;
int bufferSize;
short[] audioData;
int bufferReadResult;
try {
bufferSize = AudioRecord.getMinBufferSize(sampleAudioBitRate,