Skip to content

Instantly share code, notes, and snippets.

@rkjha
rkjha / nginx-passenger-ssl.conf
Last active March 25, 2021 15:47
Nginx/Passenger config when using SSL with a Ruby/Rails Application.
# for redirecting hhtp traffic to https version of the site
server {
listen 80;
server_name example.com;
return 301 https://$server_name$request_uri;
}
# for redirecting to non-www version of the site
server {
listen 80;
@pyricau
pyricau / LeakSlackUploadService.java
Created May 9, 2015 00:03
Sending Leak Traces to a Slack Channel (and HipChat, see the comments)
import android.util.Log;
import com.squareup.leakcanary.AnalysisResult;
import com.squareup.leakcanary.DisplayLeakService;
import com.squareup.leakcanary.HeapDump;
import retrofit.RestAdapter;
import retrofit.RetrofitError;
import retrofit.http.Multipart;
import retrofit.http.POST;
import retrofit.http.Part;
import retrofit.mime.TypedFile;
@bparmentier
bparmentier / stockticker_logcat
Last active August 29, 2015 14:12
StockTicker logcat
I/Timeline( 4809): Timeline: Activity_launch_request id:com.github.premnirmal.tickerwidget time:352854051
I/ActivityManager(14315): START u0 {cmp=com.github.premnirmal.tickerwidget/com.github.premnirmal.ticker.ui.TickerSelectorActivity} from pid 4809
I/ActivityManager(14315): Displayed com.github.premnirmal.tickerwidget/com.github.premnirmal.ticker.ui.TickerSelectorActivity: +186ms
I/Timeline( 4809): Timeline: Activity_idle id: android.os.BinderProxy@420f4fe8 time:352854305
I/Timeline(14315): Timeline: Activity_windows_visible id: ActivityRecord{42281788 u0 com.github.premnirmal.tickerwidget/com.github.premnirmal.ticker.ui.TickerSelectorActivity t68} time:352854594
E/AndroidRuntime( 4809): FATAL EXCEPTION: main
E/AndroidRuntime( 4809): Process: com.github.premnirmal.tickerwidget, PID: 4809
E/AndroidRuntime( 4809): java.lang.IllegalStateException: Exception thrown on Scheduler.Worker thread. Add `onError` handling.
E/AndroidRuntime( 4809): at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:50)
@chrisbanes
chrisbanes / CollapsingTitleLayout.java
Last active March 26, 2023 11:58
CollapsingTitleLayout
/*
* Copyright 2014 Chris Banes
*
* 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
@markushi
markushi / MyActivity.java
Last active May 3, 2020 22:50
Reveal Color View Demo
package at.markushi.reveal;
import android.app.Activity;
import android.graphics.Color;
import android.graphics.Point;
import android.os.Bundle;
import android.view.View;
import at.markushi.ui.RevealColorView;
@deepankarb
deepankarb / svg-to-android.sh
Last active July 14, 2018 13:13
A script to generate android assets from a SVG file. Requires inkscape to resize and convert.
#!/bin/bash
if [[ -z "$1" ]];
then
echo "No SVG file specified. Exiting."
exit -1
fi
ispng=$(file $1)
echo $ispng | grep -q SVG
@stkent
stkent / android_studio_shortcuts.md
Last active November 1, 2023 11:58
Android Studio Shortcuts (Mac)

Android Studio Shortcuts (Mac)

Notes:

  • Two of the most useful shortcuts utilize the Fn (function) keys. It is therefore recommended that you enable the "Use all F1, F2, etc. keys as standard function keys" option [System Preferences > Keyboard].
  • Be sure to enable the Mac OS X 10.5+ keymap in Android Studio [Preferences > Keymap].
  • A fairly complete shortcut list can be found here.

Useful symbols:

public class CircularProgressDrawable extends Drawable
implements Animatable {
private static final Interpolator ANGLE_INTERPOLATOR = new LinearInterpolator();
private static final Interpolator SWEEP_INTERPOLATOR = new DecelerateInterpolator();
private static final int ANGLE_ANIMATOR_DURATION = 2000;
private static final int SWEEP_ANIMATOR_DURATION = 600;
private static final int MIN_SWEEP_ANGLE = 30;
private final RectF fBounds = new RectF();
@ronshapiro
ronshapiro / maven-deploy.md
Last active June 1, 2016 12:29
Getting a jar on Maven Central: An Epic
@f2prateek
f2prateek / ActivitySubscriptionManager.java
Last active October 23, 2017 14:30
Managing Subscriptions in Android with RxJava
/*
* Copyright 2014 Prateek Srivastava
*
* 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