Skip to content

Instantly share code, notes, and snippets.

View erikhuizinga's full-sized avatar
🤖
Testing droids...

Erik Huizinga erikhuizinga

🤖
Testing droids...
View GitHub Profile
@erikhuizinga
erikhuizinga / fisheriris_nomogram.m
Created February 12, 2017 11:03
MATLAB: Fisher's Iris data set nomogram
%% Load data
clear
close all
load fisheriris
selection = 51:length(meas);
length = meas(selection, 1); % sepal length

Keybase proof

I hereby claim:

  • I am erikhuizinga on github.
  • I am erikhuizinga (https://keybase.io/erikhuizinga) on keybase.
  • I have a public key ASAXnl_5gUu7v5WZzCpnYwSrQXJMMUnBxwXjUeyU5Ga8Jwo

To claim this, I am signing this object:

@erikhuizinga
erikhuizinga / dataCursorAllTheThings.m
Last active January 19, 2018 11:13
Demo of how to add data cursor labels to any point in a graph
% Demo of how to add data cursor labels to any point in a graph
clear
close all
x = 1 : 10;
y = randn(size(x));
f = figure;
dcm = datacursormode(f);
l = plot(x, y);
/*
* Copyright (C) 2017 The Android Open Source Project & Erik Huizinga
*
* 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
@erikhuizinga
erikhuizinga / CopyOnWriteArrayListBehaviour.java
Created June 18, 2018 11:18
Demo of CopyOnWriteArrayList behaviour: while iterating through a previously nonempty list, clearing the list does not influence the iteration: all elements that existed when the iterator was created exist, despite the list being cleared while iterating.
package com.example;
import com.google.common.collect.Lists;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
public class CopyOnWriteArrayListBehaviour {
// Change this to a regular ArrayList to see what different behaviour the CopyOnWriteArrayList has
@erikhuizinga
erikhuizinga / Pro Pro.terminal
Last active December 4, 2019 13:27
erikhuizinga's Pro Pro macOS Terminal profile
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ANSIBrightWhiteColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS
AAGGoKMHCA9VJG51bGzTCQoLDA0OV05TV2hpdGVcTlNDb2xvclNwYWNlViRjbGFzc00w
LjUwMzc5NTU0NjQAEAOAAtIQERITWiRjbGFzc25hbWVYJGNsYXNzZXNXTlNDb2xvcqIS
FFhOU09iamVjdF8QD05TS2V5ZWRBcmNoaXZlctEXGFRyb290gAEIERojLTI3O0FIUF1k
@erikhuizinga
erikhuizinga / CartesianProduct.kt
Last active August 14, 2023 08:24
Kotlin function for cartesian product of any number of sets of any size
import kotlin.reflect.KFunction
typealias CartesianProduct = Set<List<*>>
/**
* Create the cartesian product of any number of sets of any size. Useful for parameterized tests
* to generate a large parameter space with little code. Note that any type information is lost, as
* the returned set contains list of any combination of types in the input set.
*
* @param a The first set.
@erikhuizinga
erikhuizinga / ViewModelOnClearedTest.kt
Created May 27, 2019 19:29
Koin scoped view model
package com.example
import androidx.fragment.app.FragmentActivity
import androidx.lifecycle.ViewModel
import org.junit.After
import org.junit.Assert.assertEquals
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.koin.androidx.scope.currentScope
package com.example
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.channels.BroadcastChannel
import kotlinx.coroutines.channels.Channel.Factory.CONFLATED
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.asFlow
import kotlinx.coroutines.flow.collect
import kotlin.math.PI
fun main() {
val shapes = listOf(
Square(1.0),
Square(2.0),
Circle(3.0)
)
val shapeVisitors = listOf(