Skip to content

Instantly share code, notes, and snippets.

import 'package:firebase_messaging/firebase_messaging.dart';
class PushNotificationsManager {
factory PushNotificationsManager() => _instance;
static final PushNotificationsManager _instance = PushNotificationsManager._();
* 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) {
PowerManager power = (PowerManager) activity.getSystemService(POWER_SERVICE);
PowerManager.WakeLock lock =
SebastianEngel /
Last active August 22, 2016 10:12
Implementation of fixed tabs - Stackoverflow question. Note that these classes must be placed into a package "" as ViewPager.DecorView is not public.
* Subclass of {@link PagerTwoTitlesStrip} and so implementation of a {@link android.widget.LinearLayout}
* used as a {@link} indicator. This view holds two {@link android.widget.TextView}s, each being
* the title of the two pages. The title of the 'current' tab is underlined by a tab indicator.
* <p>Inspired by Google's {@link PagerTabStrip}</p>
public class PagerTwoTabsStrip extends PagerTwoTitlesStrip {
# Usage: <start/stop>
function start_ipfw_throttle() {
sudo ipfw pipe 1 config bw 100KByte/s
sudo ipfw add 1 pipe 1 ip from me to
sudo ipfw add 1 pipe 1 ip from me to
SebastianEngel /
Created September 4, 2014 10:11
Controller class used to encapsulate the usage of croutons.
package your_package;
import android.content.res.Resources;
import android.os.Bundle;
import cyour_package.R;
import javax.inject.Inject;
SebastianEngel /
Created July 8, 2014 09:58
Methods in DefaultHeaderTransformation adjusted to make the ActionBar-PTR progress bar color styling work again
public void setProgressBarColor(int color) {
if (color != mProgressDrawableColor) {
mProgressDrawableColor = color;
private void applyProgressBarSettings() {
if (mHeaderProgressBar != null) {
final int strokeWidth = mHeaderProgressBar.getResources()
-- ...
CREATE TABLE "image_likers" (
image_id INTEGER,
user_id INTEGER,
UNIQUE(image_id, user_id) ON CONFLICT REPLACE,
FOREIGN KEY (image_id) REFERENCES "images" (_id),
FOREIGN KEY (user_id) REFERENCES "users" (_id)
diff --git a/core/src/main/java/novoda/lib/sqliteprovider/provider/action/ b/core/src/main/java/novoda/lib/sqliteprovider/provider/action/
index 864fb45..555da5f 100644
--- a/core/src/main/java/novoda/lib/sqliteprovider/provider/action/
+++ b/core/src/main/java/novoda/lib/sqliteprovider/provider/action/
@@ -6,6 +6,8 @@ import android.database.Cursor;
import android.database.SQLException;
+import java.util.List;
SebastianEngel /
Created October 15, 2013 12:12
Wrapper class for Timber logging offering static method calls, e.g. TimberLogger.d("Hello %s", Evaluates BuildConfig.DEBUG to decide if an instance of Timber.DEBUG or Timber.PROD will be used.
import timber.log.Timber;
* Wrapper class for Timber that evaluates <code>BuildConfig.DEBUG</code> on construction
* and uses Timber.DEBUG or Timber.PROD appropriately. In PROD mode, no logging is done at all.
* @author Sebastian Engel <>
SebastianEngel / fragment_locations_map.xml
Last active December 22, 2015 17:59
Layout used for a Fragment that contains a MapView
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android=""