Skip to content

Instantly share code, notes, and snippets.

@davebren
davebren / Action_Time_Analysis
Last active January 1, 2016 19:29
Action Time Analysis: Helper for tracking computation time.
package com.project.gutenberg.util;
import android.util.Log;
import java.util.HashMap;
import java.util.Map;
public class Action_Time_Analysis {
private final static String app_name = "gutendroid";
private static HashMap<String,Long[]> times = new HashMap<String,Long[]>();
@davebren
davebren / build.gradle
Last active July 23, 2019 03:22
gradle flavors and resources example
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion "19.0.3"
defaultConfig {
minSdkVersion 14
targetSdkVersion 19
versionCode 23
@davebren
davebren / gist:cfd392f0a436421bde4f
Last active August 29, 2015 14:06
Android View Collapser Utility
package com.eski.android_utils.view.animations;
import android.view.View;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.Animation;
import android.view.animation.Transformation;
public class ViewCollapser {
public static void collapse(final View view, Animation.AnimationListener listener) {
public abstract class TruthTable {
boolean[] variables;
private List<Boolean> rows;
private int numRows;
public TruthTable() {
init(getNumVariables());
}
@davebren
davebren / Typefaces.java
Created February 4, 2015 19:09
Material Design - Android Typography
package com.eski.android_utils.view.typeface;
import android.graphics.Typeface;
import dagger.DaggerApplication;
public class Typefaces {
private static Typeface robotoRegular;
private static Typeface robotoLight;
private static Typeface robotoMedium;
@davebren
davebren / Sound_Manager.java
Last active August 29, 2015 14:17
Sound_Manager
package com.morse_tutor.util.sound;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Vector;
import android.content.Context;
import android.media.AudioManager;
import android.media.SoundPool;
package dbreneisen.testapp;
import android.app.Activity;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.Log;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package so2;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
@davebren
davebren / A.kt
Created March 11, 2016 06:19
Override lazy val in kotlin subclass and call it from the super class constructor
open class A {
open protected fun x(): Int = 5
val x: Int by lazy { x() }
}
class B: A() {
override fun x(): Int = 10
}
/// The model object representation of a musical note.
class Note {
/// The index of the note in the [allNotes] list starting from 0 with C0 and ending with 107 with B8.
final int index;
/// The physical frequency in Hz of the note.
///
/// The following table lists the frequency for each note:
/// Octave C C# D D# E F F# G G# A A# B
/// 0 16.35 17.32 18.35 19.45 20.60 21.83 23.12 24.50 25.96 27.50 29.14 30.87