Skip to content

Instantly share code, notes, and snippets.

@rlemon
rlemon / Kill It!
Created August 20, 2012 13:07
GIF KILLER
javascript:function C(a){var b=a.target;"IMG"===b.nodeName&&(b.src="http://i.imgur.com/AM3Ae.png");B();a.preventDefault();a.stopPropagation();return!1}function A(){d.body.insertBefore(s,d.body.firstChild);d.addEventListener("click",C,!1)}function B(){d.body.removeChild(s);d.removeEventListener("click",C,!1)}var d=document,s=d.createElement("style");s.textContent="body * { cursor: crosshair; }";A();;
@daverix
daverix / Testing.java
Last active December 30, 2017 11:38
Dagger2 sub components example
package com.example;
import javax.inject.Scope;
import javax.inject.Singleton;
import dagger.Component;
import dagger.Module;
import dagger.Provides;
import dagger.Subcomponent;
;,_ ,
_uP~"b d"u,
dP' "b ,d" "o
d" , `b d"' "b
l] [ " `l, d" lb
Ol ? " "b`"=uoqo,_ "l
,dBb "b "b, `"~~TObup,_
,d" (db.`" "" "tbc,_ `~"Yuu,_
.d" l`T' '= ~ `""Yu,
@JakeWharton
JakeWharton / README.md
Last active January 8, 2020 02:13
A special activity which facilitates restarting your application process.
@lenguyenthanh
lenguyenthanh / Dagger 2.md
Last active May 7, 2020 19:55
Dagger 2 configuration

Small gist shows how to config Dagger 2 to an Android project

library(reshape)
library(ggplot2)
id = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
# Clean build, no Gradle daemon
java_clean_nodaemon = c(24.831, 26.247, 24.109, 23.338, 24.567, 25.349, 23.388, 24.930, 22.830, 25.635)
kotlin_clean_nodaemon = c(30.936, 33.065, 35.062, 31.953, 31.666, 33.907, 31.047, 31.104, 32.922, 32.150)
# Clean build, Gradle daemon running
@jayde-bog
jayde-bog / layout.xml
Created February 4, 2020 01:40
Android SwitchCompat custom style
<androidx.appcompat.widget.SwitchCompat
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="false"
android:thumb="@drawable/more_switch_thumb"
app:track="@drawable/more_switch_track" />
@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
@JakeWharton
JakeWharton / gist:f50f3b4d87e57d8e96e9
Created February 7, 2015 01:59
Rise and Shine™, unlock and wake up your device automatically when you deploy from the IDE. Put this somewhere in your `src/debug/` code and run it when the application or main activity starts. Apache 2.
/**
* Show the activity over the lockscreen and wake up the device. If you launched the app manually
* both of these conditions are already true. If you deployed from the IDE, however, this will
* save you from hundreds of power button presses and pattern swiping per day!
*/
public static void riseAndShine(Activity activity) {
activity.getWindow().addFlags(FLAG_SHOW_WHEN_LOCKED);
PowerManager power = (PowerManager) activity.getSystemService(POWER_SERVICE);
PowerManager.WakeLock lock =
@omarmiatello
omarmiatello / ParcelableUtil.java
Last active January 28, 2023 01:24
Parcelable to byte array, byte array to parcelable
/**
* Copyright 2013 Omar Miatello - omar.miatello@justonetouch.it
* Based on http://stackoverflow.com/a/18000094/1228545
*
* 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
*