Skip to content

Instantly share code, notes, and snippets.

Working from home

nekocode nekocode

Working from home
View GitHub Profile
josdejong / merge.kt
Last active Aug 13, 2020
Merge two data classes in Kotlin
View merge.kt
import kotlin.reflect.full.declaredMemberProperties
import kotlin.reflect.full.primaryConstructor
* Merge two data classes
* The resulting data class will contain:
* - all fields of `other` which are non null
* - the fields of `this` for the fields which are null in `other`
Pulimet / AdbCommands
Last active Dec 1, 2020
Adb useful commands list
View AdbCommands
adb help // List all comands
== Adb Server
adb kill-server
adb start-server
== Adb Reboot
adb reboot
adb reboot recovery
adb reboot-bootloader
biezhi /
Last active Jun 6, 2019
Java二维码输出到控制台,需引入 zing 库,颜色代码见
import java.util.Hashtable;
try {
ViewConfiguration config = ViewConfiguration.get(this);
Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey");
if (menuKeyField != null) {
menuKeyField.setBoolean(config, false);
SupaHam / DynamicProxies.kt
Last active Jul 7, 2020
Dynamic Proxies with Kotlin for accessing private classes.
View DynamicProxies.kt
* Code by @vmironov on Kotlinlang slack.
* This code uses dynamic proxies in Java to make it easier to access inaccessible classes via an accessible representation.
inline fun <reified T : Any> createMirror(value: Any) = createMirror(value,
fun <T> createMirror(value: Any, clazz: Class<T>): T {
val loader = clazz.classLoader
lisawray /
Last active Jun 22, 2018
Vector drawables from XML with the Android support library 23.3.0
package com.xwray.vectorbinding;
import android.databinding.BindingAdapter;
import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.widget.TextView;
neworld /
Last active Sep 15, 2020
How to make faster Android build without sacrificing new api lint check

Original solution sacrifices new api lint check.

Here my solution:

int minSdk = hasProperty('minSdk') ? minSdk.toInteger() : 16

apply plugin: ''

android {
    compileSdkVersion 23
gokulkrishh / media-query.css
Last active Dec 1, 2020
CSS Media Queries for Desktop, Tablet, Mobile.
View media-query.css
##Device = Desktops
##Screen = 1281px to higher resolution desktops
@media (min-width: 1281px) {
/* CSS */
jeromerobert /
Last active Jul 17, 2020
Pandoc filter to create PDF files from SVG
#! /usr/bin/env python
Pandoc filter to convert svg files to pdf as suggested at:
__author__ = "Jerome Robert"
import mimetypes
import subprocess
You can’t perform that action at this time.