Skip to content

Instantly share code, notes, and snippets.

@mr-archano
mr-archano / dump-config.xml
Created October 15, 2012 16:14
Flex dump config file
<flex-config>
<!-- benchmark: output performance benchmark-->
<!-- benchmark usage:
<benchmark>boolean</benchmark>
-->
<compiler>
<!-- compiler.accessible: generate an accessible SWF-->
<accessible>false</accessible>
<!-- compiler.actionscript-file-encoding: specifies actionscript file encoding. If there is no BOM in the AS3 source files, the compiler will use this file encoding.-->
<!-- compiler.actionscript-file-encoding usage:
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Bitmap.Config;
import android.util.AttributeSet;
import android.widget.LinearLayout;
public class FadableLinearLayout extends LinearLayout {
@mr-archano
mr-archano / SerialAsyncTask
Created March 13, 2013 11:18
Quick & dirty copy of AsyncTask class using serial executor even on legacy Android versions. - Just get rid of all references to AsyncTask and replace them with SerialAsyncTask instead - Changed SerialExecutor.mTasks type from ArrayDeque to a simple LinkedList
/*
* Copyright (C) 2008 The Android Open Source Project
*
* 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
package com.gertherb.api;
import com.squareup.okhttp.internal.Base64;
import retrofit.Endpoint;
import retrofit.RequestInterceptor;
import retrofit.RestAdapter;
import static retrofit.RestAdapter.LogLevel.FULL;
@mr-archano
mr-archano / build.gradle
Last active August 29, 2015 14:01
crashlytics hack
...
File crashlyticsProperties = new File("${project.projectDir.absolutePath}/crashlytics.properties")
applicationVariants.all { variant ->
variant.productFlavors.each { flavor ->
def variantSuffix = variant.name.capitalize()
def generateResourcesTask = project.tasks.getByName("crashlyticsGenerateResources${variantSuffix}")
def generatePropertiesTask = task("crashlyticsGenerateProperties${variantSuffix}") << {
Properties properties = new Properties()
println "...copying apiSecret for ${variant.name}"
@mr-archano
mr-archano / root project build.gradle
Last active January 14, 2016 21:43
The idea is to create an android test module (eg: `tests`) with a dependency on the main android module (eg: `app`). With a little setup you can easily run unit tests (in your `tests/androidTest` folder) on the JVM and hava JaCoCo reports altogether.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
jcenter()
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
}
}
@mr-archano
mr-archano / 0. Auto unsubscribe facilities
Last active August 29, 2015 14:10
I didn't want to pollute the discussion started in RxAndroid/#12 (https://github.com/ReactiveX/RxAndroid/issues/12), so I drafted a solution that collects some of the neat ideas showcased in there.
// NOTE: `OperatorSubscribeUntil` class is borrowed from @dlew's PR (https://github.com/dlew/RxAndroid/blob/dlew/lifecycle-observable/rxandroid/src/main/java/rx/android/lifecycle/OperatorSubscribeUntil.java)
@mr-archano
mr-archano / build.log
Created January 19, 2015 11:15
NewRelic + Crashlytics = B O O M !
:android:newRelicDeinstrumentTask
[newrelic.info] Deinstrumenting...
:android:crashlyticsStoreDeobsAlphaDebug
:android:crashlyticsUploadDeobsAlphaDebug
:android:crashlyticsCleanupResourcesAfterUploadAlphaDebug
...removing crashlytics.properties
:android:compileAlphaDebugNdk
:android:processAlphaDebugJavaRes UP-TO-DATE
:android:validateDebugSigning
:android:packageAlphaDebug
@mr-archano
mr-archano / gist:6929c2eb002c24eb9f8f
Created May 22, 2015 13:10
Thread safe SimpleDateFormat wrapper
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
public class SimpleDateFormatThreadSafe {
private final ThreadLocal<SimpleDateFormat> localSimpleDateFormat;
@mr-archano
mr-archano / JavaAptPlugin
Created July 11, 2015 20:14
APT plugin for plain Java modules
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.plugins.ide.idea.IdeaPlugin
import org.gradle.tooling.BuildException
class JavaAptPlugin implements Plugin<Project> {
@Override
void apply(Project project) {
def aptConfiguration = project.configurations.create 'javapt'