Skip to content

Instantly share code, notes, and snippets.

View imtianx's full-sized avatar
🎯
Focusing

Xing imtianx

🎯
Focusing
View GitHub Profile
@imtianx
imtianx / ViewExtensions.kt
Last active August 29, 2018 02:07
利用rxjava2 防止View多次点击的kotlin扩展函数
package cn.imtianx.common.extension
import android.view.View
import io.reactivex.Observable
import io.reactivex.ObservableEmitter
import io.reactivex.ObservableOnSubscribe
import java.util.concurrent.TimeUnit
import io.reactivex.android.schedulers.AndroidSchedulers
/**
@imtianx
imtianx / NavigationViewHelper.kt
Last active July 31, 2018 01:37
BottomNavigationView helper
package cn.imtianx.mdsimple.navigation
import android.annotation.SuppressLint
import android.support.design.internal.BottomNavigationItemView
import android.support.design.internal.BottomNavigationMenuView
import android.support.design.widget.BottomNavigationView
import android.util.Log
import org.jetbrains.anko.forEachChild
/**
@imtianx
imtianx / HttpsUtils.java
Last active October 29, 2018 09:35
HttpsUtils.kt
package cn.imtianx.common.net;
import android.annotation.SuppressLint;
import java.io.IOException;
import java.io.InputStream;
import java.security.KeyManagementException;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
@imtianx
imtianx / Jetbrains-Idea-active-code.txt
Last active January 21, 2019 09:57
the active code of jetbrains Idea using Edu email. Active until 2019.8.15
H3VSC5I7YU-eyJsaWNlbnNlSWQiOiJIM1ZTQzVJN1lVIiwibGljZW5zZWVOYW1lIjoiWWFuIFhpIiwiYXNzaWduZWVOYW1lIjoiIiwiYXNzaWduZWVFbWFpbCI6IiIsImxpY2Vuc2VSZXN0cmljdGlvbiI6IkZvciBlZHVjYXRpb25hbCB1c2Ugb25seSIsImNoZWNrQ29uY3VycmVudFVzZSI6ZmFsc2UsInByb2R1Y3RzIjpbeyJjb2RlIjoiSUkiLCJwYWlkVXBUbyI6IjIwMTktMDgtMTQifSx7ImNvZGUiOiJSUzAiLCJwYWlkVXBUbyI6IjIwMTktMDgtMTQifSx7ImNvZGUiOiJXUyIsInBhaWRVcFRvIjoiMjAxOS0wOC0xNCJ9LHsiY29kZSI6IlJEIiwicGFpZFVwVG8iOiIyMDE5LTA4LTE0In0seyJjb2RlIjoiUkMiLCJwYWlkVXBUbyI6IjIwMTktMDgtMTQifSx7ImNvZGUiOiJEQyIsInBhaWRVcFRvIjoiMjAxOS0wOC0xNCJ9LHsiY29kZSI6IkRCIiwicGFpZFVwVG8iOiIyMDE5LTA4LTE0In0seyJjb2RlIjoiUk0iLCJwYWlkVXBUbyI6IjIwMTktMDgtMTQifSx7ImNvZGUiOiJETSIsInBhaWRVcFRvIjoiMjAxOS0wOC0xNCJ9LHsiY29kZSI6IkFDIiwicGFpZFVwVG8iOiIyMDE5LTA4LTE0In0seyJjb2RlIjoiRFBOIiwicGFpZFVwVG8iOiIyMDE5LTA4LTE0In0seyJjb2RlIjoiR08iLCJwYWlkVXBUbyI6IjIwMTktMDgtMTQifSx7ImNvZGUiOiJQUyIsInBhaWRVcFRvIjoiMjAxOS0wOC0xNCJ9LHsiY29kZSI6IkNMIiwicGFpZFVwVG8iOiIyMDE5LTA4LTE0In0seyJjb2RlIjoiUEMiLCJwYWlkVXBUbyI6IjIwMTktMDgtMTQifSx7ImNvZGUiOiJSU1UiL
@imtianx
imtianx / imtianx.github.io-.github-ci.yml
Created April 24, 2019 01:13
gitlab-ci config of the [imtianx.github.io](https://github.com/imtianx/imtianx.github.io) repo .
# https://hub.docker.com/r/library/node/tags/
image: node:latest
stages:
- build
- deploy
before_script:
- npm install hexo-cli -g
@imtianx
imtianx / add_prefix.sh
Created May 22, 2019 13:38
Batch modify the file name to add a prefix.
#!/usr/bin/env bash
SAVE_IFS=$IFS
IFS=$'\n'
files=$(ls -1 *.md)
file_prefix='ignore_pinyin_'
for file_name in ${files};do
/*可任意修改样式,或恢复预设值,保存后生效
相对“默认样式”而作的修改会用 红色 标注*/
.output_wrapper/*此属性为全局*/
{
font-size: 16px;
color: #3e3e3e;
line-height: 1.6;
word-spacing:0px;
@imtianx
imtianx / EventObserver.kt
Created June 10, 2019 08:46 — forked from JoseAlcerreca/EventObserver.kt
An Observer for Events, simplifying the pattern of checking if the Event's content has already been handled.
/**
* An [Observer] for [Event]s, simplifying the pattern of checking if the [Event]'s content has
* already been handled.
*
* [onEventUnhandledContent] is *only* called if the [Event]'s contents has not been handled.
*/
class EventObserver<T>(private val onEventUnhandledContent: (T) -> Unit) : Observer<Event<T>> {
override fun onChanged(event: Event<T>?) {
event?.getContentIfNotHandled()?.let { value ->
onEventUnhandledContent(value)
@imtianx
imtianx / ConcurrencyHelpers.kt
Created July 10, 2019 02:59 — forked from objcode/ConcurrencyHelpers.kt
Helpers to control concurrency for one shot requests using Kotlin coroutines.
import kotlinx.coroutines.CoroutineStart.LAZY
import kotlinx.coroutines.Deferred
import kotlinx.coroutines.async
import kotlinx.coroutines.cancelAndJoin
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
import kotlinx.coroutines.yield
import java.util.concurrent.atomic.AtomicReference
import kotlin.DeprecationLevel.ERROR
@imtianx
imtianx / TextViewExtensions.kt
Created July 23, 2019 07:42
TextWatcher dsl
@file:JvmName("TextViewExtensions")
package com.tongji.autoparts.extensions
import android.text.Editable
import android.text.TextWatcher
import android.widget.TextView
/**
* <pre>