Skip to content

Instantly share code, notes, and snippets.

@ratiofu
ratiofu / SetVsListFindAndContainsPerformanceComparisonTest.kt
Last active February 9, 2025 15:58
On the age old question on when to use a hash set vs. an array list in Java (see https://stackoverflow.com/q/32552307), here's my contribution on measuring this specifically for integers.
package com.thomasjung.performance
import kotlin.system.measureNanoTime
import org.junit.jupiter.api.Test
class SetVsListFindAndContainsPerformanceComparisonTest {
@Test
fun `compares the performance on checking containment of integers between ArrayList and HashSet for varying collection sizes`() {
println("""
This Atlassian Marketplace App is not really an app, just a template for a workflow, and as such does not store any data anywhere.
@ratiofu
ratiofu / index.html
Last active October 13, 2018 22:40
Experiments in drawing simple SVG shapes interactively
<!DOCTYPE html>
<html lang="en">
<head>
<!-- code pen @ https://codepen.io/ratiofu/pen/NOaNQd -->
<meta charset="UTF-8">
<title>Test</title>
<style>
body, html, div, p {
margin: 0;
@ratiofu
ratiofu / FontSelector.tsx
Last active September 27, 2018 01:08
FontSelector React/Typescript Component to test look and feel of different system fonts
import * as React from 'react'
// see https://css-tricks.com/snippets/css/system-font-stack/
const FONT_CHOICES = [
'system-ui',
'-apple-system',
'BlinkMacSystemFont',
'Segoe UI',
'Roboto',
'Oxygen-Sans',
@ratiofu
ratiofu / status.sh
Created September 18, 2017 22:55
Updating the Slack Status for multiple teams (workspaces) with a single command
#!/usr/bin/env bash
#
# automate further by creating aliases and set an appropriate environment variable
#
# export SLACK_STATUS_TOKENS="xoxp-1 xoxp-2 xoxp-3"
# alias working="~/status.sh a ${SLACK_STATUS_TOKENS}"
# alias meeting="~/status.sh m ${SLACK_STATUS_TOKENS}"
# alias away="~/status.sh s ${SLACK_STATUS_TOKENS}"

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@ratiofu
ratiofu / Dockerfile
Last active March 13, 2017 21:40
Meteor 1.4.* Dockerfile with MongoDB 3.2
FROM buildpack-deps:jessie
MAINTAINER Thomas Jung (https://thomasjung.com)
EXPOSE 3000
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927 && \
echo "deb http://repo.mongodb.org/apt/debian jessie/mongodb-org/3.2 main" | tee /etc/apt/sources.list.d/mongodb-org-3.2.list && \
apt-get -y update && \
apt-get -y install mongodb-org
@ratiofu
ratiofu / String.reverse.js
Last active November 14, 2015 22:57
JavaScript, ECMAScript 6 String Reverse that works
/**
* Wow, writing a String reverse function in JavaScript that actually works is a
* non-trivial problem: http://j.mp/1SQs8zC
* The following is inspired by: https://github.com/mathiasbynens/esrever
*
* Perhaps it's possible to tease a few more microseconds from this by using
* numerical comparison of surrogate pair ranges and combining marks based on the
* unicode code point instead of regular expressions, but it's "good enough" as it
* is now. It does about a quarter million reverses per second for the test string
* on a 2014 MacBook Pro with a 3.1 GHz Intel Core i7