Skip to content

Instantly share code, notes, and snippets.

@romannurik
romannurik / DrawInsetsFrameLayout.java
Created February 10, 2014 16:28
DrawInsetsFrameLayout — adding additional background protection for system UI chrome when using KitKat’s translucent decor flags.
/*
* Copyright 2014 Google Inc.
*
* 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
@jam1401
jam1401 / EspressoXMLInstrumentationTestRunner.java
Created December 31, 2013 21:17
If you are using the new Espresso testing framework on Android with CI then you need a way to generate the test results in an XML format. The existing GoogleInstrumentationTestRunner does not support this. This Gist provides an example TestRunner that provides the test output in XML
package com.google.android.apps.common.testing.testrunner;
import android.app.Instrumentation;
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.test.AndroidTestRunner;
import android.test.InstrumentationTestRunner;
import android.test.TestSuiteProvider;
import android.util.Log;
function screenrecord() {
echo "Press ^C to stop recording."
adb shell screenrecord /sdcard/$1.mp4
sleep 1
adb pull /sdcard/$1.mp4 .
adb shell rm /sdcard/$1.mp4
open $1.mp4
}
@atmos
atmos / heaven.md
Last active November 23, 2020 22:35
Response to a dude who asked about heaven. https://github.com/holman/feedback/issues/422

@holman got a request about our deployment system, heaven

I know it's not a high priority, but has there been any activity on open-sourcing the core Heaven gem?

There is. I've been working on extracting the non-GitHub specific parts into two gems. This first is a CLI portion called hades. The second is an HTTP API portion called heaven.

When you open source something previously used as in internal tool like Heaven, Hubot, Boxen, etc., how do you manage and hook in the parts that need to stay internal?

Normally I focus around four questions:

@ragingwind
ragingwind / Backend Architectures Keywords and References.md
Last active March 21, 2025 15:01
Backend Architectures Keywords and References
@romannurik
romannurik / AndroidCreateGhostIcon.java
Created June 14, 2013 06:28
Android ColorMatrixColorFilter example: Creates a 'ghost' bitmap version of the given source drawable (ideally a BitmapDrawable). In the ghost bitmap, the RGB values take on the values from the 'color' argument, while the alpha values are derived from the source's grayscaled RGB values. The effect is that you can see through darker parts of the …
/**
* Creates a 'ghost' bitmap version of the given source drawable (ideally a BitmapDrawable).
* In the ghost bitmap, the RGB values take on the values from the 'color' argument, while
* the alpha values are derived from the source's grayscaled RGB values. The effect is that
* you can see through darker parts of the source bitmap, while lighter parts show up as
* the given color. The 'invert' argument inverts the computation of alpha values, and looks
* best when the given color is a dark.
*/
private Bitmap createGhostIcon(Drawable src, int color, boolean invert) {
int width = src.getIntrinsicWidth();
/*
* AndroidManifest.xmlに
* <uses-permission android:name="com.twitter.android.permission.AUTH_APP" />
* を追加する必要がある
*/
public class MainActivity extends Activity {
private static final String TAG = MainActivity.class.getSimpleName();
private static final int AUTH_REQUEST_CODE = 1;
@Override
@johanneswuerbach
johanneswuerbach / .travis.yml
Last active March 24, 2025 17:40
Deploy an iOS app to testflight using Travis CI
---
language: objective-c
before_script:
- ./scripts/travis/add-key.sh
after_script:
- ./scripts/travis/remove-key.sh
after_success:
- ./scripts/travis/testflight.sh
env:
global:
@robUx4
robUx4 / gist:5487013
Created April 30, 2013 06:49
StackTrace: devices running ICS and JB
java.lang.NullPointerException
at android.webkit.DeviceMotionService$2.run(DeviceMotionService.java:103)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.webkit.WebViewCore$WebCoreThread.run(WebViewCore.java:1065)
at java.lang.Thread.run(Thread.java:856)
@ficusk
ficusk / GsonRequest.java
Last active January 6, 2025 22:43
A Volley adapter for JSON requests that will be parsed into Java objects by Gson.
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import com.android.volley.AuthFailureError;
import com.android.volley.NetworkResponse;
import com.android.volley.ParseError;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.Response.ErrorListener;
import com.android.volley.Response.Listener;