Skip to content

Instantly share code, notes, and snippets.

import 'package:firedart/firedart.dart';
import 'package:hive/hive.dart';
/// Stores tokens using a Hive store.
/// Depends on the Hive plugin: https://pub.dev/packages/hive
class HiveStore extends TokenStore {
static const keyToken = "auth_token";
static Future<HiveStore> create() async {
// Make sure you call both:
@Dawnkeeper
Dawnkeeper / ClipCopy.cs
Last active March 13, 2017 23:07
SpaceEngineers Scripting Helper
/*
* SpaceEngineers Scripting Helper
*
* start with script filename as argument
*
* possible instructions:
*
* /**Begin copy here**
* /**End copy here**
*
@marcelpinto
marcelpinto / ApiManager.java
Last active May 18, 2018 13:41
Cache RxJava observables on Android approach to reuse and avoid multiple calls.
private ObservableManager obsManager = new ObservableManager(EventBus.getDefault());
@Override
public Subscription getStores() {
// Get the observable if exists and is not too old
Observable<StoresList> observable = obsManager.get(ObservableManager.Types.STORES);
if (observable == null) {
// If is null create it and us cache to keep it in memeroy
observable = api.getStoresList()
.compose(applySchedulers(api.getStoresList()))
@gabrielemariotti
gabrielemariotti / README.md
Last active March 9, 2023 06:02
A SectionedGridRecyclerViewAdapter: use this class to realize a simple sectioned grid `RecyclerView.Adapter`.

You can use this class to realize a simple sectioned grid RecyclerView.Adapter without changing your code.

Screen

The RecyclerView has to use a GridLayoutManager.

This is a porting of the class SimpleSectionedListAdapter provided by Google

If you are looking for a sectioned list RecyclerView.Adapter you can take a look here

@stefanhoth
stefanhoth / build.gradle
Last active March 3, 2017 12:03
Simple plugin for build.gradle to instruct Jetbrains IDEA-based IDEs (IntelliJ, Android Studio) to download sources of the dependencies. More settings can be found here: http://gradle.org/docs/current/dsl/org.gradle.plugins.ide.idea.model.IdeaModule.html
// your code
apply from: "build-plugins/idea-gradle-sources.gradle"
@awstanley
awstanley / SpeedTimeCoord.cs
Created January 4, 2015 03:54
Updated Space Engineers script for listing Speed|Time|Position.
void Main()
{
// Get blocks
var blocks = new List<IMyTerminalBlock>();
// Get the antenna
GridTerminalSystem.GetBlocksOfType<IMyRadioAntenna>(blocks);
if(blocks.Count > 0)
{
@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
@Shywim
Shywim / CursorRecyclerAdapter.java
Last active February 27, 2024 13:42
A custom Adapter for the new RecyclerView, behaving like the CursorAdapter class from previous ListView and alike. Now with Filters and updated doc.
/*
* The MIT License (MIT)
*
* Copyright (c) 2014 Matthieu Harlé
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@JakeWharton
JakeWharton / AutoGson.java
Last active November 28, 2021 12:32
A Gson TypeAdapterFactory which allows serialization of @autovalue types. Apache 2 licensed.
import com.google.auto.value.AutoValue;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* Marks an {@link AutoValue @AutoValue}-annotated type for proper Gson serialization.
* <p>
@JakeWharton
JakeWharton / README.md
Last active May 10, 2018 08:39
A workaround for Android "L" Okio packaging problem. Place all of the following in a `libs/` folder.

JarJar'd OkHttp Dependencies

Due to a bug in the packaging of Android OS "L", dependencies which reference Okio need to be repackaged.

For more information see square/okhttp#967

Usage