Skip to content

Instantly share code, notes, and snippets.

🤖
Testing droids...

Erik Huizinga erikhuizinga

🤖
Testing droids...
Block or report user

Report or block erikhuizinga

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ViewModelOnClearedTest.kt
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
@erikhuizinga
erikhuizinga / CartesianProduct.kt
Last active Apr 10, 2019
Kotlin function for cartesian product of any number of sets of any size
View CartesianProduct.kt
import kotlin.reflect.KFunction
/**
* 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.
*/
fun cartesianProduct(vararg sets: Set<*>): Set<List<*>> =
when (sets.size) {
0, 1 -> emptySet()
@erikhuizinga
erikhuizinga / Pro Pro.terminal
Created Sep 21, 2018
erikhuizinga's Pro Pro macOS Terminal profile
View Pro Pro.terminal
<?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 / CopyOnWriteArrayListBehaviour.java
Created Jun 18, 2018
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.
View CopyOnWriteArrayListBehaviour.java
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
View FixAppBarLayoutBehavior.kt
/*
* 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 / dataCursorAllTheThings.m
Last active Jan 19, 2018
Demo of how to add data cursor labels to any point in a graph
View dataCursorAllTheThings.m
% 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);
View keybase.md

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 / fisheriris_nomogram.m
Created Feb 12, 2017
MATLAB: Fisher's Iris data set nomogram
View fisheriris_nomogram.m
%% Load data
clear
close all
load fisheriris
selection = 51:length(meas);
length = meas(selection, 1); % sepal length
You can’t perform that action at this time.