Skip to content

Instantly share code, notes, and snippets.

View kibotu's full-sized avatar
🎯
Focusing

Jan Rabe kibotu

🎯
Focusing
View GitHub Profile
@dylanwatsonsoftware
dylanwatsonsoftware / ColorGenerator.java
Created June 11, 2015 16:06
Java version of @m1ch4ls C# ColorGenerator
public class ColorGenerator {
public static List<Color> generate(int colors, int skip) {
final int lastindex = colors + skip;
return new Points(colors + skip).asList().subList(skip, lastindex);
}
// RYB color space
private static class RYB {
private static final double[] White = { 1, 1, 1 };
@kibotu
kibotu / build.gradle
Last active December 9, 2016 13:32
Fixing kotlin & retrolambda ClassNotFoundException and cannot find symbol issue.
// @see https://github.com/evant/gradle-retrolambda/issues/109
afterEvaluate {
// library projects
// def variants = project.android.libraryVariants + project.android.testVariants
// application projects
def variants = project.android.applicationVariants + project.android.testVariants
@homj
homj / DrawerIconDrawable.java
Last active April 6, 2017 10:11
This Drawable implements the "Drawer-Indicator to Arrow"-Animation as seen in several Material-Design-Apps; NOTE: Mind the updated constructors in Revision 5!
/*
* Copyright 2014 Johannes Homeier
*
* 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
#!/bin/bash
#sudo apt-get install libxml2-utils
GetGoogleSourceFile () {
[ "-$1" == "-" ] && return 1
curl -s --compressed -G -d "format=text" --url "$GOOGLE_SOURCE_URL/${3:-platform/frameworks/base}/${2:-+/master}/$1" | base64 -d
}
GetRepositoryXmlURL () {
@flarb
flarb / VRInputModule.cs
Created August 20, 2014 22:27
Lets you use a VR world space cursor with World Space Canvases in Unity3D 4.6. Add this to the EventSystem object. Put some box colliders on your buttons in the World Space Canvas. Then, do a trace to see if you're looking at a menu object--if the trace hits one of those buttons, pass it to SetTargetObject. See ralphbarbagallo.com for a longer e…
using UnityEngine;
using UnityEngine.EventSystems;
//by Ralph Barbagallo
//www.flarb.com
//www.ralphbarbagallo.com
//@flarb
public class VRInputModule : BaseInputModule {
@flarb
flarb / SDKSwap.cs
Created May 23, 2015 18:50
Swap between Unity3D Google Cardboard and Gear VR / OVR Mobile SDKs. It swaps out the Android manifest files when you switch platforms--pretty much all you need (aside from wrapping the APIs) to switch platforms.
using UnityEngine;
using System.Collections;
using UnityEditor;
using System.IO;
public class SDKSwap : EditorWindow {
static string _cardboardPath;
static string _OVRPath;
@Azazle
Azazle / DefaultUserAgent.java
Last active June 8, 2018 18:47
Android method: get default user-agent
// http://matsuhilog.blogspot.jp/2013/05/performance-analytics-in-android.html
// https://code.google.com/p/codenameone/issues/detail?id=294
public static String getDefaultUserAgent(Context context) {
String ua;
if (Build.VERSION.SDK_INT >= 17) {
ua = Util.getDefaultUserAgent(context);
} else if (Build.VERSION.SDK_INT >= 16) {
ua = Util.getUserAgent(context);
} else {
try {
@kibotu
kibotu / uiModule.kt
Created March 6, 2019 12:34
koin ui module
val uiModule = module(definition = {
factory { get<NavHostFragment>().navController }
factory { ContextHelper.getAppCompatActivity()!!.supportFragmentManager.findFragmentById(R.id.navHost) as NavHostFragment }
})
inline fun <reified T : Any> Any.inject(
name: String = "",
scope: Scope? = null,
noinline parameters: ParameterDefinition = emptyParameterDefinition()
) = lazy { getKoin().koinContext.get<T>(name, scope, parameters) }
@tinmegali
tinmegali / CircularFragReveal.java
Last active March 15, 2019 10:28
Add a circular Reveal and Unreveal transition animation to a Android Fragment
import android.animation.Animator;
import android.animation.TimeInterpolator;
import android.annotation.TargetApi;
import android.graphics.Color;
import android.os.Build;
import android.support.annotation.NonNull;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewAnimationUtils;
@jemshit
jemshit / BaseFragment.java
Created December 1, 2016 12:21
Do something when Fragment is visible
public class BaseFragment extends Fragment {
private boolean fragmentResume=false;
private boolean fragmentVisible=false;
private boolean fragmentOnCreated=false;
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);