Skip to content

Instantly share code, notes, and snippets.

View gildor's full-sized avatar

Andrey Mischenko gildor

View GitHub Profile
03-11 18:11:21.676 20745-20819/com.bandlab.bandlab.test E/BroadcastUtils.putError():48﹕ Error intent
retrofit.RetrofitError: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected a name but was BEGIN_OBJECT at line 1 column 4254 path $[3].Notes[1].Picture
at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:383)
at retrofit.RestAdapter$RestHandler.access$100(RestAdapter.java:220)
at retrofit.RestAdapter$RestHandler$1.invoke(RestAdapter.java:265)
at retrofit.RxSupport$2.run(RxSupport.java:55)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
eval$s=%q(eval(%w(B=92.chr;N=10.chr;n=0;e=->(s){s.gsub(/[#{B+B+N}"]/){B+(N==$&??n:$&)}};E=->(s){'("'+e[s]+'")'}
;d=->(s,t=?"){s.gsub(t){t+t}};D=->(s,t=?@){s.gsub(B){t}};Q=->(s,t=?$){s.gsub(t){B+$&}};puts(eval(%q("objectXQRX
extendsXApp{Hln#{E[%((displayX"#{e[%(HfX% sX"#{Q[ e["Trans criptXshow:X'#{d[%(putsX[regsubX-allX{.}X"#{Q[e[%[
intXK(){sJXs=#{E[%(withXAda.Text _Io;p roce dure XQRXisXbeginXAda.Text_Io.Put_Line("#{d[%(BEGINXH("#
{d[%(BEGIN{s=#{E[D[%(forXbXinX Sys t em.Text.ASCIIEncoding().GetBytes(#{Q[E["#i
nclude<stdio.h>`nintXK (){pu t s#{E["#include<iostream>`nintXK(){std::cout
<<#{E[%(classXProgram {pu blicXstaticXvoidXMain(){System.Co
nsole.Write(#{E[D[%( ( defnXf[lXr](if(>(countXr)45)(lazy-
seq(cons(str"XXXX^" "r"^"&")(fXl"")))(let[c(fir
stXl)](ifXc(f(ne
@gildor
gildor / gist:3794197
Created September 27, 2012 14:06
Ошибка api vk.com
Пример, шлем запрос на авторизацию
http://oauth.vkontakte.ru/authorize?client_id=2664589&scope=notify,friends,photos,offline&redirect_uri=http://api.vkontakte.ru/blank.html&display=touch&response_type=token
И получаем вместо эрана со списком разрешений пустую страницу
http://vk.com/login.php?act=slogin&role=fast&no_redirect=1&to=&s=1&hash=d854beb0b5860cb5cb096905a2362490
@gildor
gildor / HelloWorld.kt
Created June 5, 2018 03:45
Minimal TornadoFX setup with Gradle
//File src/main/kotlin/HelloWorld.kt
import tornadofx.*
class HelloWorld : View() {
override val root = hbox {
label("Hello world")
}
}
class MyApp : App(HelloWorld::class)
@gildor
gildor / build.gradle
Last active August 17, 2019 03:53
Assert for Gradle to check that configuration is not resolved on configuration time
def afterEvaluation = false
gradle.projectsEvaluated {
afterEvaluation = true
}
allprojects { project ->
configurations.all { configuration ->
configuration.incoming.beforeResolve {
if (!afterEvaluation) {
throw new Exception("Configuration $configuration.name of project $project.name is being resolved at configuration time.")
@gildor
gildor / coroutine-delay.kt
Last active July 23, 2020 02:38
Proof of concept for Kotlin JS coroutines delay()
import kotlin.coroutines.experimental.*
import kotlin.js.Date
fun main(args: Array<String>) {
println("before launch")
launch {
println("hello: ${Date()}")
delay(3000)
println("bye: ${Date()}")
}
@gildor
gildor / OkHttpDownloader.kt
Last active June 19, 2021 07:35
Simple non-blocking extension function for OkHttp Call that wraps request to Kotlin Coroutine and saves response to File
import kotlinx.coroutines.experimental.*
import okhttp3.*
import okio.Buffer
import okio.Okio
import java.io.File
import java.io.IOException
/**
* Custom coroutine dispatcher for blocking calls
*/
@gildor
gildor / RetrofitCoroutines.kt
Last active June 22, 2021 19:09
Example of usage kotlin-coroutines-retrofit with awaitResponse()
import kotlinx.coroutines.experimental.runBlocking
import retrofit2.Call
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
import retrofit2.http.GET
import retrofit2.http.Path
import ru.gildor.coroutines.retrofit.awaitResponse
/**
dependencies {
@gildor
gildor / build.gradle.kts
Last active January 28, 2022 12:03
Protobuf Gradle Plugin + Kotlin DSL
import com.google.protobuf.gradle.protobuf
import com.google.protobuf.gradle.protoc
plugins {
java
idea
id("com.google.protobuf") version "0.8.7"
}
repositories {
@gildor
gildor / OnViewWithTimeout.kt
Last active March 17, 2022 02:29
Simple implementation of Android Espresso onView with timeout
import android.view.View
import androidx.test.espresso.Espresso
import androidx.test.espresso.NoMatchingViewException
import androidx.test.espresso.ViewAssertion
import androidx.test.espresso.ViewInteraction
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.ViewMatchers.Visibility
import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility
import org.hamcrest.Matcher