Skip to content

Instantly share code, notes, and snippets.

View ed-george's full-sized avatar
🌍
Working remotely...

Ed Holloway-George ed-george

🌍
Working remotely...
View GitHub Profile
@AAverin
AAverin / KotlinRxExt.kt
Last active April 17, 2020 11:09
Kotlin Rx Extensions
import rx.Observable
import rx.Observer
import rx.Subscriber
import rx.Subscription
import rx.functions.Action0
import rx.functions.Action1
fun <T> Observable<T>.uiSubscribe(schedulers: Schedulers, subscriber: Subscriber<in T>): Subscription {
return subscribeOn(schedulers.io)
.observeOn(schedulers.mainThread)

Intercom user_hash

Remember that your secret key should never be exposed to the public

  • So Javascript code below should only be used for testing unless modified and used to run on a server
@Suleiman19
Suleiman19 / Spinner Setup (Activity)
Last active October 11, 2022 14:10
Theme Aware Material Design Spinner
Spinner spinner = (Spinner) findViewById(R.id.main_spinner);
ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<>(getSupportActionBar().getThemedContext(),
R.layout.spinner_list_style,
getResources().getStringArray(R.array.countries));
spinnerAdapter.setDropDownViewResource(R.layout.spinner_dropdown_item);
spinner.setAdapter(spinnerAdapter);
@cesarferreira
cesarferreira / RxJava.md
Last active February 2, 2022 07:28
Party tricks with RxJava, RxAndroid & Retrolambda

View Click

Instead of the verbose setOnClickListener:

RxView.clicks(submitButton).subscribe(o -> log("submit button clicked!"));

Filter even numbers

Observable
    .just(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
@maxtruxa
maxtruxa / Antonyms.md
Last active May 6, 2024 09:31
A list of common terms used in programming and their respective antonyms.

Antonym List

Note: The table headings (positive/negative) are not necessarily meaningful.

Positive Negative
acquire release
add remove (e.g. an item), subtract (arithmetic)
advance retreat
allocate deallocate (correct), free (common)
allow deny
@alex-shpak
alex-shpak / Interceptor.java
Last active March 29, 2023 21:06
Refreshing OAuth token with okhttp interceptors. All requests will wait until token refresh finished, and then will continue with the new token.
private class HttpInterceptor implements Interceptor {
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
//Build new request
Request.Builder builder = request.newBuilder();
builder.header("Accept", "application/json"); //if necessary, say to consume JSON
@t-oster
t-oster / MakeBraceletRingWithDroidScript
Created February 20, 2015 14:21
This DroidScript (JavaScript for Android) makes my China Bluetooth Bracelet Vibrate whenever I want.
var btn;
var bt;
var txt;
//Called when application is started.
function OnStart()
{
//Create a layout with objects vertically centered.
lay = app.CreateLayout( "linear", "VCenter,FillXY" );
//Create a button 1/3 of screen width and 1/4 screen height.
@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
@berkkaraoglu
berkkaraoglu / BorderedCircleTransform.java
Created November 14, 2014 09:12
BorderedCircleTransform for Picasso (Based on https://gist.github.com/julianshen/5829333)
import android.graphics.Bitmap;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import com.squareup.picasso.Transformation;
public class CircleTransform implements Transformation {
private final int BORDER_COLOR = Color.WHITE;
@tir38
tir38 / gist:3d03f5b94c30595fdeeb
Last active December 25, 2015 06:13
Extends Daniel Olshansky's DevByte example "ListView Expanding Cells Animation" to allow for custom collapsable height http://www.youtube.com/watch?v=mwE61B56pVQ http://developer.android.com/shareables/devbytes/ListViewExpandingCells.zip

In Daniel's example, all rows contain the same view, so their collapsed heights are all the same. However if you have different size collapsed rows, the animation will be jumpy. To fix this

  1. pull the cell height out of the constructor for ExpandableListItem:
public class ExpandableListItem implements OnSizeChangedListener {

    private String mTitle;
    private String mText;
 private boolean mIsExpanded;