Skip to content

Instantly share code, notes, and snippets.

@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
@bnlucas
bnlucas / example.txt
Last active August 2, 2020 21:57
Full Text Searching with the Google App Engine Search API. Using with Flask to demonstrate.
When going to /search/artist/<query_string> using the documents below you get:
/search/artist/m - this returns both Macklemore and Against Me!
/search/artist/a - this returns both Against Me! and AWOLNATION
/search/artist/ma - this returns only Macklemore
/search/artist/aw - this returns only AWOLNATION
/search/artist/me - this returns only Against Me!
Adding 'AWOLNATION' to models.Artist produces:
@amlcurran
amlcurran / MultiContentAdapter.java
Last active December 11, 2015 03:38
Simple Adapter which can handle multiple input cursors asynchronously (ideal for usage with CursorLoaders)
/* Copyright 2013 Alex Curran
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
distributed under the License is distributed on an "AS IS" BASIS,
@JakeWharton
JakeWharton / ContractFragment.java
Created May 6, 2012 09:12
Base fragment to ensure the parent activity implements a contract interface.
/* Base fragment to ensure the parent activity implements a contract interface. */
public abstract class ContractFragment<T> extends Fragment {
private T mContract;
@Override
public void onAttach(Activity activity) {
try {
mContract = (T)activity;
} catch (ClassCastException e) {
throw new IllegalStateException(activity.getClass().getSimpleName()