Skip to content

Instantly share code, notes, and snippets.

View Miha-x64's full-sized avatar
🍵
へ‿(◉‿◉)‿ㄏ

Mike Miha-x64

🍵
へ‿(◉‿◉)‿ㄏ
View GitHub Profile
package inlineEnumSet
import java.util.EnumSet
inline class InlineEnumSet<T : Enum<T>>(val set: UInt) {
companion object
}
//bit extraction functions
typealias Either7<A, B, C, D, E, F, G> = Either<A, Either<B, Either<C, Either<D, Either<E, Either<F, G>>>>>>
typealias Either6<A, B, C, D, E, F> = Either7<A, B, C, D, E, F, Nothing>
typealias Either5<A, B, C, D, E> = Either7<A, B, C, D, E, Nothing, Nothing>
typealias Either4<A, B, C, D> = Either7<A, B, C, D, Nothing, Nothing, Nothing>
typealias Either3<A, B, C> = Either7<A, B, C, Nothing, Nothing, Nothing, Nothing>
fun <A, B, C, D, E, F, G, R> Either7<A, B, C, D, E, F, G>.fold(
ifa: (A) -> R,
ifb: (B) -> R,
ifc: (C) -> R,
@lWeRl
lWeRl / LambdaGenHell.java
Last active May 14, 2018 13:48
Lambda & Generic error
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
//java version "1.8.0_151"
//fix https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8142476
public class LambdaGenHell {
interface IdEntity {
@State(Scope.Benchmark)
@BenchmarkMode(Mode.Throughput)
@Fork(1)
@Warmup(iterations = 5)
@Measurement(iterations = 5)
public class KotlinRangeBenchmark {
@Param({"0", "123", "1000000", "1073741823", "2147483640", "2147483647"})
private Integer param;
@Param({"1005000", "2147483647"})
@kropp
kropp / Gtk3Demo.kt
Created May 16, 2017 10:31
GTK+ Demo Application in Kotlin/Native rewritten in OO-style
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
import android.support.v4.view.ViewCompat;
import android.support.v4.view.ViewPropertyAnimatorCompat;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import com.mikepenz.itemanimators.DefaultAnimator;
public class ItemAnimator extends DefaultAnimator<ItemAnimator> {
public boolean useAnimation = true;
@zhong-j-yu
zhong-j-yu / Stats.java
Last active July 9, 2020 02:38
class Stats - used with Stream.collect() to find min and max
import java.util.Comparator;
import java.util.stream.Collector;
import java.util.stream.LongStream;
/**
* Stats of a stream of objects, including `count`, `min`, and `max`.
* Note that `min` and `max` are undefined if `count==0`.
* <p>
* This is intended to be used with `Stream.collect()`, for example
* </p>
@korniltsev
korniltsev / CenterCropDrawable.java
Created September 8, 2016 13:38
CenterCropDrawable
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
public class CenterCropDrawable extends Drawable {
private final Drawable drawable;
@nstarke
nstarke / release-android-debuggable.md
Last active April 16, 2024 08:06
How to make a Release Android App debuggable

How to make a Release Android App debuggable

Let's say you want to access the application shared preferences in /data/data/com.mypackage.
You could try to run adb shell and then run-as com.mypackage ( or adb shell run-as com.mypackge ls /data/data/com.mypackage/shared_prefs), but on a production release app downloaded from an app store you're most likely to see:

run-as: Package 'com.mypackage' is not debuggable
@Volcanoscar
Volcanoscar / stackblur.cpp
Created April 1, 2016 01:22 — forked from usrlocalben/stackblur.cpp
stackblur - c++, floating-point, vectorized
/*
* "stackblur"
* originally, Mario Klingemann, mario@quasimondo.com
* this implementation, Benjamin Yates (benjamin@rqdq.com)
* http://incubator.quasimondo.com/processing/stackblur.pde
*
* this blur routine seems to be quite popular.
*
* unfortunately, mario didn't comment anything.
* but, it's easy to see it's just a flavor of a two-pass