Skip to content

Instantly share code, notes, and snippets.

Avatar

Logan Johnson loganj

  • Square, Inc.
  • New York, NY
View GitHub Profile
@loganj
loganj / script.sh
Last active Mar 3, 2021 — forked from dlew/script.sh
Simple AndroidX Migration Script
View script.sh
#!/usr/bin/env bash
# Original by Dan Lew
#
# I've found that the "Migrate to AndroidX" converter in Android Studio doesn't work very
# well, so I wrote my own script to do the simple job of converting package names.
#
# You can download a CSV of package names here: https://developer.android.com/topic/libraries/support-library/downloads/androidx-class-mapping.csv
#
# It'll run faster on a clean build because then there are fewer files to scan over.
#
View bettercommitmessage.diff
commit cb5f051c5ee95e795dedaf3a264062cf75d44b1e
Author: Logan Johnson
Date: Mon Aug 8 14:41:04 2016 -0400
don't register Transaction in multiple scopes
RA-14998
TransactionBundler used to implement both Bundler and PausesAndResumes.
In order to correct a lifecycle tangle (obvious from the dual
View badcommitmessage.diff
commit ee46355557abe4ebc816f6cef9821e64c25b22f0
Author: Logan Johnson
Date: Wed Dec 9 17:49:35 2015 -0500
GET /account/status
diff --git a/common/services/src/main/java/com/squareup/server/account/AccountService.java b/common/services/src/main/java/com/squareup/server/account/AccountService.java
index da02d2f..20c7c43 100644
--- a/common/services/src/main/java/com/squareup/server/account/AccountService.java
+++ b/common/services/src/main/java/com/squareup/server/account/AccountService.java
View GuiltyAction.java
/**
* Copyright 2014 Square Inc.
*
* 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
@loganj
loganj / RxGitHub.java
Created Nov 8, 2013
What if Retrofit handled rx Func1 return types?
View RxGitHub.java
import java.util.Collections;
import java.util.List;
import retrofit.http.GET;
import retrofit.http.Path;
import rx.Observable;
import rx.util.functions.Func1;
public class RxGitHub {
static <T> Func1<Iterable<T>,Observable<T>> iterableToObservable() {
@loganj
loganj / gist:6630117
Last active Dec 23, 2015
This is probably a bad idea.
View gist:6630117
package com.squareup.otto;
/**
* A bus which supports detaching from its parent and attaching new children.
*
* THIS IS A THOUGHT EXPERIMENT. Don't freak out.
*/
public interface DetachableBus extends Bus {
/**
@loganj
loganj / main.sbt
Created Jan 31, 2012
Sample config for android-plugin/library pull request
View main.sbt
import sbt._
import Keys._
import AndroidKeys._
libraryDependencies ++= Seq(
"com.actionbarsherlock" % "library" % "4.0.0-SNAPSHOT" artifacts(Artifact("library", "apklib", "apklib")),
"android" % "compatibility-v4" % "r3-SNAPSHOT"
)
View gist:1004528
window.Funnel = (->
_initialized = false
_urls = {}
_viewModel = {}
_campaignId = ""
_campaignTitle = ""
modelFunnel = (funnel, unthanked) ->
// ...
View gist:622702
import java.util.Collections;
import java.util.Set;
class IncompatibleTypes {
interface A {}
interface B<T> {}
static abstract class C<T> {
abstract Set<A> getAsForB(B<T> b);
View gist:558907
package com.joelapenna.foursquared.widget;
import android.widget.CheckBox;
import android.widget.Checkable;
import android.widget.ProgressBar;
import android.widget.ViewSwitcher;
final public class BusyCheckBox extends ViewSwitcher implements Checkable {
final private CheckBox checkBox;