Skip to content

Instantly share code, notes, and snippets.

View TristanWiley's full-sized avatar

Tristan Wiley TristanWiley

View GitHub Profile
@AdamMc331
AdamMc331 / Test.java
Last active May 21, 2017 04:33
Demonstrates how much boilerplate is removed by using Kotlin's `firstOrNull{}` extension.
public static String getKeyForClass(Class<?> classToCheck) {
int index = -1;
int internalClassesLength = ManagerRegistry.INTERNAL_CLASSES.size();
// Check if this class has a superclass defined in this project.
for (int i = 0; i < internalClassesLength; i++) {
if (ManagerRegistry.INTERNAL_CLASSES.get(i).isAssignableFrom(classToCheck)) {
index = i;
break;
}
@TristanWiley
TristanWiley / googleplaymusic.js
Last active March 11, 2019 23:40
Check to see how much time you've spent listening to an album
//Make sure the entire page is loaded, zoom waaay out so all songs are visible.
//Check with this
var total = 0;
[...document.querySelectorAll(".songlist-container tbody > tr.song-row")].forEach(obj => {
const a = obj.children[2];
const duration = a.innerText;
const t = obj.children[6];
if (!t) {
@douo
douo / FloatingActionMenu.java
Created June 23, 2015 08:01
FloatingActionMenu build by android support FloatingActionButton
package com.diaoser.tmr.view;
import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.TimeInterpolator;
import android.animation.ValueAnimator;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;