This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Single | |
data class KoinBridge( | |
val xxx: XXXRepository, | |
... | |
) { | |
init { | |
startKoin { | |
modules( | |
module { | |
single { xxx } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Singleton | |
@Component( | |
modules = [ | |
AppModule::class | |
] | |
) | |
interface AppComponent { | |
fun inject(activity: MainActivity) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from bark import SAMPLE_RATE, generate_audio | |
from bark.generation import ( | |
preload_models | |
) | |
from scipy.io.wavfile import write as write_wav | |
import nltk | |
import numpy as np | |
import argparse |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Worker { | |
var total = 0 | |
fun accumulate() { | |
for (i = 0; i < 10000; i++) { | |
total = total + 1 | |
} | |
} | |
fun doWork() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<User> userList = ... | |
List<Int> leaderAgesList = listOf() | |
for (User u : userList) { | |
if (u.title.contain('lead')) { | |
leaderAgesList.add(u.age) | |
} | |
} | |
Int sum = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun onDestroy() { | |
context = null | |
observable.dispose() | |
db.close() | |
connection.disconnect() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Try not to do this! | |
try { | |
val response = api.fetchUser(userId) | |
} catch (exception) { | |
// skip the error | |
} | |
try { | |
val response = api.fetchUser(userId) | |
} catch (e) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Version { | |
var major: Int? | |
var minor: Int? | |
var patch: Int? | |
fun String.toVersion(): Version? { | |
val split = this.split(".") | |
return Version(split[0].toInt(), split[1].toInt(), split[2].toInt()) | |
} | |
} |
NewerOlder