Skip to content

Instantly share code, notes, and snippets.

@dalegaspi
dalegaspi / brew_symlink_error_sierra.md
Last active Nov 10, 2021
Homebrew Symlink errors in Mac OSX High Sierra
View brew_symlink_error_sierra.md
@JakeWharton
JakeWharton / Oauth1SigningInterceptor.java
Last active Mar 17, 2021
An OkHttp interceptor which does OAuth1 signing. Requires Guava and Java 8, although those dependencies wouldn't be too hard to break if you didn't have them.
View Oauth1SigningInterceptor.java
/*
* Copyright (C) 2015 Jake Wharton
*
* 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 Feb 7, 2015
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.
View gist:f50f3b4d87e57d8e96e9
/**
* 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 =
@polbins
polbins / README.md
Last active Sep 6, 2019
Android Response Caching using Retrofit 1.9 + OkHttp 2.2
View README.md

Android REST Controller with Cache-Control

Android REST Controller with Simple Cache Control Headers using Retrofit 1.9.0 + OkHttp 2.2.0

View git-remove-history
#!/bin/bash
set -o errexit
# Author: David Underhill, Falko Richter
# Originally from http://dound.com/2009/04/git-forever-remove-files-or-folders-from-history/
# Script to permanently delete files/folders from your git repository. To use
# it, cd to your repository's root and then run the script with a list of paths
# you want to delete, e.g., git-delete-history path1 path2
if [ $# -eq 0 ]; then
@jaredrummler
jaredrummler / MenuTint.java
Last active Aug 26, 2019
Helper class to set the color and transparency for menu icons in an ActionBar or Toolbar.
View MenuTint.java
/*
* Copyright (C) 2015. Jared Rummler <jared.rummler@gmail.com>
*
* 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 / README.md
Last active Jan 8, 2020
A special activity which facilitates restarting your application process.
View README.md
View SystemUiHelper.java
/*
* Copyright (C) 2014 The Android Open Source Project
*
* 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
@blundell
blundell / WatchFaceLifecycle-ExampleActivity.java
Last active Aug 29, 2015
Unofficial Base WatchFace Listener
View WatchFaceLifecycle-ExampleActivity.java
public class ExampleActivity extends Activity implements WatchFaceLifecycle.Listener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_my_layout);
WatchFaceLifecycle.attach(this, savedInstanceState, this);
}
@Override
@staltz
staltz / introrx.md
Last active Nov 27, 2021
The introduction to Reactive Programming you've been missing
View introrx.md