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
package main | |
import ( | |
"bufio" | |
"errors" | |
"fmt" | |
"log" | |
"mime/multipart" | |
"net/http" | |
"os" |
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
package main | |
import ( | |
"bufio" | |
"encoding/json" | |
"errors" | |
"fmt" | |
"mime/multipart" | |
"net/http" | |
"os" |
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
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
"net/http" | |
"os" | |
"strings" | |
"time" |
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
const WebSocket = require('ws') | |
//setup input from console | |
var stdin_input = process.stdin; | |
stdin_input.setEncoding("utf-8"); | |
//connect socket!! | |
const url = "ws://localhost:8080/output_all"; | |
const connection = new WebSocket(url); |
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 java.util.concurrent.ConcurrentHashMap | |
class Memoizer<T, U> private constructor() { | |
private val map = ConcurrentHashMap<T, U>() | |
private fun callLocalMemoize(block: (T) -> U): (T) -> U = { input -> | |
map.computeIfAbsent(input) { | |
block(it) |
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
private const val IV_KEY = "iv" | |
class EncryptionUtil @Inject constructor( | |
private val keyGenerator: KeyGenerator, | |
private val keyGenParameterSpec: KeyGenParameterSpec, | |
private val keyStore: KeyStore, | |
private val prefs: SharedPreferences, | |
private val editPrefs: SharedPreferences.Editor |
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
fun main() { | |
val addOne : (Int) -> Int = { it + 1 } | |
val doubleStuff : (Int) -> Int = { it * 2} | |
val myFunc = composer(addOne, doubleStuff) | |
println(myFunc(3)) | |
val add : (Int) -> (Int)-> Int= { a -> {b -> a + b}} | |
val num = add(1)(2) | |
println(num) |
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
@Test | |
fun testGetCurrency() { | |
val item: Pair<DomainCurrency, List<DomainCurrency>> = Pair( | |
DomainCurrency("USD", "1.00", 2, "US DOLLAR"), | |
listOf(DomainCurrency("EUR", "12.00", 1, "EURO")) | |
) |
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
val df = DecimalFormat("#,###", DecimalFormatSymbols(Locale.getDefault())) | |
var textChanged = false | |
df.minimumFractionDigits = 0 | |
df.maximumFractionDigits = asset.investmentDecimalPlaces | |
layout.txt_amount.textChanges() | |
.debounce(400, TimeUnit.MILLISECONDS) | |
.map { layout.txt_amount.text.toString() } | |
.subscribeOn(AndroidSchedulers.mainThread()) |
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 CustomShrinkLayoutBehavior(context: Context, attrs: AttributeSet) : | |
CoordinatorLayout.Behavior<NestedScrollView>(context, attrs) { | |
private var screenHeight: Int = context.resources.displayMetrics.heightPixels | |
override fun layoutDependsOn(parent: CoordinatorLayout, child: NestedScrollView, dependency: View): Boolean { | |
return dependency is AppBarLayout | |
} | |
override fun onDependentViewChanged(parent: CoordinatorLayout, child: NestedScrollView, dependency: View): Boolean { |
NewerOlder