Skip to content

Instantly share code, notes, and snippets.

View IlyaEremin's full-sized avatar
🤡
SEVERE RECTAL PAIN

Ilia Eremin IlyaEremin

🤡
SEVERE RECTAL PAIN
  • Popuga Inc
  • Georgia
View GitHub Profile
@IlyaEremin
IlyaEremin / app_version.gradle
Last active August 2, 2023 15:59
Npm version for gradle
def getVersionName = { getVersionProps()['appVersionName'] }
def getVersionProps() {
def versionPropsFile = file('gradle.properties')
if (!versionPropsFile.exists()) {
versionPropsFile.createNewFile()
}
def versionProps = new Properties()
versionProps.load(new FileInputStream(versionPropsFile))
return versionProps
@IlyaEremin
IlyaEremin / big.json
Created March 5, 2017 13:14
Json for experiments
This file has been truncated, but you can view the full file.
[
{
"_id": "58acbe62d2cc022efd9f1d32",
"index": 0,
"guid": "d6fffee6-9f05-43e0-83fa-7b5f27ac7e95",
"isActive": true,
"balance": "$2,360.24",
"picture": "http://placehold.it/32x32",
"age": 34,
"eyeColor": "green",
@IlyaEremin
IlyaEremin / build.gradle
Created February 18, 2017 20:34
Example of managing dependencies in separate file
apply from: 'deps.gradle'
// ...
dependencies {
compile supportLibs
compile rxJavaLibs
compile retrofitLibs
compile okHttpLibs
@IlyaEremin
IlyaEremin / PushText.php
Created April 21, 2016 13:12
Push notification test code
<?php
// API access key from Google API's Console
define( 'API_ACCESS_KEY', 'YOUR_SERVER_API_KEY' );
$registrationIds = array("YOUR_DEVICE_TOKEN");
// prep the bundle
$msg = array
(
@IlyaEremin
IlyaEremin / HelloIlyaController.java
Created April 10, 2016 09:26
Spring mvc example
package controllers;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import java.util.Map;
/**
* Created by user on 06.04.2016.
@IlyaEremin
IlyaEremin / MySearchBox.java
Last active May 5, 2016 16:05
SearchBox back button bugfix
import android.app.Activity;
import android.content.Context;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.View;
import com.quinny898.library.persistentsearch.SearchBox;
/**
@IlyaEremin
IlyaEremin / dagger.java
Created August 28, 2015 12:33
dagger cache
@Provides @CacheDir File provideCacheDir(Context context) {
File f = Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())
? context.getExternalCacheDir()
: context.getCacheDir();
if (f != null) {
f.mkdirs();
}
return f;
}
@IlyaEremin
IlyaEremin / news_details
Created June 15, 2015 08:54
webView with NestedScrollView height bug (on samsung s3 4.3)
public class NewsDetailsFragment extends Fragment {
private String html = "<html><body>\\u003cp\\u003e\\u0026nbsp;\\u003c/p\\u003e\\r\\n\\r\\n\\u003cp\\u003eКоманда Александра Хацкевича уступила действующим чемпионам Европы с минимальным счетом 0:1. Единственный гол испанцы забили на 45-й минуте усилиями Давида Сильвы.\\u003c/p\\u003e\\r\\n\\r\\n\\u003cp\\u003eПолузащитник \\u0026laquo;Рубина\\u0026raquo; Сергей Кисляк вышел на поле в стартовом составе и был заменен на 78-й минуте встречи.\\u003c/p\\u003e\\r\\n\\r\\n\\u003cp\\u003eТакже накануне сборная России на \\u0026laquo;Открытие Арена\\u0026raquo; в Москве с таким же счетом проиграла сборной Австрии. Футболисты \\u0026laquo;Рубина\\u0026raquo; Сергей Рыжиков, Эльмир Набиуллин и Магомед Оздоев на поле так и не появились.\\u0026nbsp;\\u003c/p\\u003e\\r\\n\\r\\n\\u003cp style=\\\"text-align:right\\\"\\u003eФото:\\u0026nbsp;\\u003ca href=\\\"http://ru.uefa.com/uefaeuro/qualifiers/season=2016/matches/round=2000446/match=2013962/postmatch/photos/index.h
@IlyaEremin
IlyaEremin / Requests sequence
Created April 30, 2015 06:20
RxJava usage samples
public class SignUpScreen extends BaseFragment{
private void signUp(RegistrationInfo regInfo) {
startProgressAnimation();
bind(api.registerWith(regInfo)))
.flatMap(registerResponse -> api.getToken("password", userName, password, Consts.CLIENT_ID, Consts.CLIENT_SECRET))
.flatMap(token -> {
User.saveTokens(token);
return api.getProfileInfo(Consts.SELF);
})
@IlyaEremin
IlyaEremin / gist:8b0b120b1530443368f9
Last active August 29, 2015 14:11
jackson generic object wrapper ohohohoho!!!
public class Wrapper<T> {
@JsonCreator
public Wrapper(){}
protected Map<String, T> map = new HashMap<>();
@JsonAnySetter public void set(String name, T t) {
map.put(name, t);
}