Skip to content

Instantly share code, notes, and snippets.

View fdoyle's full-sized avatar

Frank Doyle fdoyle

  • San Antonio, TX
View GitHub Profile
@fdoyle
fdoyle / derived.kt
Created April 14, 2023 18:49
A cool way to do derivedState with LiveData
import androidx.arch.core.executor.testing.InstantTaskExecutorRule
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Observer
import org.junit.Assert.assertEquals
import org.junit.Rule
import org.junit.Test
//pattern inspired by https://github.com/ensody/ReactiveState-Kotlin, no code was copied.
//from your application class, call
// new NavigationLogger().start(this);
//logs activity and fragment lifecycle events.
class NavigationLogger {
val logger = PVLog("Navigation")
fun start(app: Application) {
app.registerActivityLifecycleCallbacks(object: Application.ActivityLifecycleCallbacks {
@fdoyle
fdoyle / noise.dart
Created April 2, 2019 19:54
some stuff for working with simplex noise in dart
class VisualizerPainter extends CustomPainter {
final double position;
var noise = new SimplexNoise();
NoiseLoop rLoop;
NoiseLoop gLoop;
NoiseLoop bLoop;
VisualizerPainter(this.position, this.rLoop, this.gLoop, this.bLoop);
@fdoyle
fdoyle / mario2.html
Last active April 5, 2017 22:43
fun little mario demo
<!DOCTYPE html>
<html>
<body>
<h1>Arrow keys do stuff</h1>
<canvas id="myCanvas" width="800" height="400"
style="border:1px solid #d3d3d3;">
Your browser does not support the HTML5 canvas tag.</canvas>
<script>
var c = document.getElementById("myCanvas");
<!DOCTYPE html>
<html>
<body>
<canvas id="myCanvas" width="10000" height="1000"
style="border:1px solid #d3d3d3;">
Your browser does not support the HTML5 canvas tag.</canvas>
<script>
var c = document.getElementById("myCanvas");
@fdoyle
fdoyle / InterpolatorSmoothScroller.java
Last active March 9, 2016 23:37
Some Recyclerview Stuff
package com.lacronicus;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import android.view.animation.Interpolator;
import java.util.Random;
/**
@fdoyle
fdoyle / Combiner.java
Last active December 21, 2015 21:27
Use case: You have an object with setListener, and you have to listeners. Do Combiner.combine(listener1, listener2), with any given type, and it'll do what you want
package com.lacronicus.combodriver;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
/**
* Created by fdoyle on 12/17/15.
*/
public class ListenerCombiner {
@fdoyle
fdoyle / kotlinlistmethods.kt
Created November 13, 2015 20:50
made these as an exercise, then found out they were in sequence. oh well.
package com.lacronicus.kotlinlistmethods
import java.util.ArrayList
/**
* Created by fdoyle on 11/13/15.
*/
fun <T, R> List<T>.map(mapFunc: (T) -> R) : List<R> {
@fdoyle
fdoyle / FixedTransformerViewPager.java
Last active August 22, 2022 11:02
PageTransform + padding on viewpager doesn't work. this fixes it
package com.foo.ui.view;
import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.View;
/**
* Created by fdoyle on 11/2/15.
*/
@fdoyle
fdoyle / Main.java
Created October 21, 2015 14:31
first stab at a graph deep copy
public class Main {
public static void main(String[] args) {
System.out.println("Hello World");
Node a = new Node("A","A");
Node b = new Node("B","B");
Node c = new Node("C","C");
Node d = new Node("D","D");