Skip to content

Instantly share code, notes, and snippets.

View MichaelRocks's full-sized avatar

Michael Rozumyanskiy MichaelRocks

View GitHub Profile
@MichaelRocks
MichaelRocks / AlphanumComparator.kt
Created April 8, 2016 19:00
A Kotlin port of `AlphanumComparator` by Dave Koelle from http://www.davekoelle.com/alphanum.html
class AlphanumComparator : Comparator<String> {
override fun compare(s1: String, s2: String): Int {
var thisMarker = 0
var thatMarker = 0
val s1Length = s1.length
val s2Length = s2.length
while (thisMarker < s1Length && thatMarker < s2Length) {
val thisChunk = getChunk(s1, s1Length, thisMarker)
thisMarker += thisChunk.length
@MichaelRocks
MichaelRocks / FitSystemWindowsLayout.java
Last active June 22, 2021 19:33
A layout that can fit system windows or not depending on a flag.
package io.michaelrocks;
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Rect;
import android.os.Build;
import android.util.AttributeSet;
import android.view.WindowInsets;
import android.widget.FrameLayout;
@MichaelRocks
MichaelRocks / MathExtensions.kt
Last active August 5, 2022 01:08
Math extension functions and float-math functions for Kotlin
/*
* Copyright 2015 Michael Rozumyanskiy
*
* 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
@MichaelRocks
MichaelRocks / AndroidManifest.xml
Created January 9, 2012 15:14 — forked from jimmyjjames/AndroidManifest.xml
Android Theming Test
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.theming"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="11" />
<application
android:icon="@drawable/ic_launcher"