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
// | |
// Created by Konstantin Berkow on 3/4/18. | |
// | |
#include "lookup_cache.h" | |
#include <stdlib.h> | |
#include <string.h> | |
#ifdef __cplusplus |
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 BitmapFactory.Options.verboseToString(): String { | |
val builder = StringBuilder(1024) | |
.append("BitmapFactory.Options{") | |
.append("\"inBitmap\": ").append(inBitmap).append(", ") | |
.append("\"inDensity\": ").append(inDensity).append(", ") | |
.append("\"inJustDecodeBounds\": ").append(inJustDecodeBounds).append(", ") | |
.append("\"inMutable\": ").append(inMutable).append(", ") | |
.append("\"inPreferredConfig\": ").append(inPreferredConfig).append(", ") | |
.append("\"inSampleSize\": ").append(inSampleSize).append(", ") | |
.append("\"inScaled\": ").append(inScaled).append(", ") |
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
let leadingAnchor: NSLayoutXAxisAnchor | |
let topAnchor: NSLayoutYAxisAnchor | |
let trailingAnchor: NSLayoutXAxisAnchor | |
let bottomAnchor: NSLayoutYAxisAnchor | |
let centerXAnchor: NSLayoutXAxisAnchor | |
let centerYAnchor: NSLayoutYAxisAnchor | |
if #available(iOS 11, *) { | |
let guide = rootView.safeAreaLayoutGuide | |
leadingAnchor = guide.leadingAnchor | |
topAnchor = guide.topAnchor |
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 me.berkow.playground; | |
import java.io.UnsupportedEncodingException; | |
import java.net.URLEncoder; | |
import java.nio.charset.StandardCharsets; | |
import java.util.Formatter; | |
import java.util.Iterator; | |
import java.util.Map; | |
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 LoginInteractor(private val api: Api) { | |
fun login(email: String, password: String): Observable<LoginResult> { | |
return when { | |
!EMAIL_PATTERN.matcher(email).matches() -> Observable.just(LoginError(ErrorClass.INVALID_EMAIL)) | |
password.length < 6 -> Observable.just(LoginError(ErrorClass.INVALID_PASSWORD) as LoginResult) | |
else -> api.login(Credentials(email, password)) | |
.map { response -> LoginSuccess(response.token, response.info) as LoginResult } | |
.onErrorReturn { throwable -> | |
when (throwable) { |
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
@AuthScope | |
class LoginPresenter | |
@Inject constructor(private val interactor: LoginInteractor) : BasePresenter<LoginState, LoginEvent> { | |
private val resultsSubj = PublishSubject.create<LoginResult>().toSerialized() | |
private val stateObs: Observable<LoginState> | |
init { | |
val initial = LoginState() | |
stateObs = resultsSubj |
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 | |
class ImagePresentationPresenter | |
@Inject constructor(private val client: OkHttpClient) { | |
private val resultsRelay = PublishRelay.create<Result>().toSerialized() | |
private val states: Observable<UiState> | |
private val loadTransformer = ObservableTransformer<LoadImage, Result> { | |
it.flatMap { event -> | |
val url = event.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
#!/usr/bin/python | |
# -*- coding: UTF-8 -*- | |
import json | |
import jwt | |
import time | |
from hyper import HTTPConnection | |
ALGORITHM = 'ES256' |
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
let queueu = DispatchQueue.global(qos: DispatchQoS.background.qosClass) | |
Alamofire.request("\(apiURL)/params/pages").responseJSON(queue: queueu) { | |
response in | |
guard response.result.isSuccess, | |
let jsonArr = response.result.value as? [JSON] else { | |
return | |
} | |
var newPages: [String: String] = [:] | |
for obj in jsonArr { | |
if let key = obj["key"] as? String, |
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 android.graphics.BitmapFactory; | |
import android.os.Build; | |
import android.support.annotation.NonNull; | |
import android.support.annotation.Nullable; | |
/** | |
* Created by konstantinberkow on 12/11/17. | |
*/ | |
public final class BitmapFactoryOptionsToString { |