Skip to content

Instantly share code, notes, and snippets.

View johnjohndoe's full-sized avatar

Tobias Preuss johnjohndoe

View GitHub Profile
@johnjohndoe
johnjohndoe / FindMatchesAction.groovy
Created July 6, 2020 12:57 — forked from jbarr21/FindMatchesAction.groovy
IntelliJ plugin to perform multiple structural search and replace actions. Can be installed with https://github.com/dkandalov/live-plugin
import com.intellij.openapi.actionSystem.*
import com.intellij.openapi.application.*
import com.intellij.openapi.command.*
import com.intellij.openapi.diagnostic.*
import com.intellij.openapi.fileTypes.*
import com.intellij.openapi.progress.*
import com.intellij.openapi.project.*
import com.intellij.openapi.ui.*
import com.intellij.openapi.vfs.*
import com.intellij.psi.*
@johnjohndoe
johnjohndoe / README.md
Last active March 7, 2020 13:50 — forked from Wikinaut/README.md
Vereinfachte Verkehrsordnungswidrigkeitenanzeige bei Halt- und Parkverstößen per E-Mail an die Bußgeldstelle. https://twitter.com/tbsprs/status/1236287577981964289
@johnjohndoe
johnjohndoe / 60-jetbrains.conf
Created June 23, 2019 13:16 — forked from bittner/60-jetbrains.conf
Inotify configuration for IntelliJ IDEA (PhpStorm, PyCharm, RubyMine, WebStorm). Create this file with e.g. `sudo vim /etc/sysctl.d/60-jetbrains.conf`
# Set inotify watch limit high enough for IntelliJ IDEA (PhpStorm, PyCharm, RubyMine, WebStorm).
# Create this file as /etc/sysctl.d/60-jetbrains.conf (Debian, Ubuntu), and
# run `sudo service procps start` or reboot.
# Source: https://confluence.jetbrains.com/display/IDEADEV/Inotify+Watches+Limit
#
# More information resources:
# -$ man inotify # manpage
# -$ man sysctl.conf # manpage
# -$ cat /proc/sys/fs/inotify/max_user_watches # print current value in use
@johnjohndoe
johnjohndoe / vcard-split.py
Last active December 25, 2023 06:30 — forked from umrashrf/vcard-split.py
Python script to split Google contacts into individual VCF files.
#!/usr/bin/python
#split vcf files
import re
working_dir = '/home/umair/Documents/Contacts/'
input_file = 'contacts starred 26-06-2014.vcf'
output_seed = 'contacts-part-'
vcards_per_file = 1
@johnjohndoe
johnjohndoe / EnumWithDefaultValueJsonAdapter.java
Last active March 24, 2022 08:27 — forked from NightlyNexus/EnumWithDefaultValueJsonAdapter.java
An enum JsonAdapter for Moshi that allows for a fallback value when deserializing unknown strings. NOTE: Allows null for the default. https://github.com/square/moshi/blob/master/moshi-adapters/src/main/java/com/squareup/moshi/adapters/EnumJsonAdapter.kt
import com.squareup.moshi.Json;
import com.squareup.moshi.JsonAdapter;
import com.squareup.moshi.JsonReader;
import com.squareup.moshi.JsonWriter;
import java.io.IOException;
public final class EnumWithDefaultValueJsonAdapter<T extends Enum<T>> extends JsonAdapter<T> {
private final Class<T> enumType;
private final String[] nameStrings;
private final T[] constants;
[
{
"author": "CCC",
"conference": "33C3",
"description": "Live-Streaming vom 33C3",
"endsAt": "2016-12-30T20:00:00+0000",
"groups": [
{
"group": "Live",
"rooms": [
@johnjohndoe
johnjohndoe / screenrecord.sh
Created December 15, 2016 11:55 — forked from tasomaniac/screenrecord.sh
Screen Record for Android
#!/bin/sh
set -e
if [ -z "$1" ]; then
shot_path=$(date +%Y-%m-%d-%H-%M-%S).mp4
else
shot_path="$*"
fi
@johnjohndoe
johnjohndoe / config
Created August 1, 2016 22:05 — forked from donnfelker/config
Watch or Unwatch a file in git
# Goes in your .git/config file
[alias]
# Temporarily stop tracking a file in git.
# usage: git unwatch path/to/file
unwatch = update-index --assume-unchanged
# Resume tracking a file in git.
# usage: git watch path/to/file
watch = update-index --no-assume-unchanged

Overview

Here, you might lay out the reasons behind writing this code. You can link to specs, issues, or bugs in order to give someone a better idea of how a decision was made. This is your chance to give context to your reviewer. Ego depletion - the idea that willpower is used up over time - can be easily applied to your reviewer. We are human, after all. You'll likely get one shot at a quality review, so help your reviewer help you. Flush out this section.

Testing

How did you test this code? Did you write a unit test, or test it manually? Can you provide an animated gif or a screenshot to demonstrate your code does what it purports to do? What about test output or a useful snippet from a logfile? Help show that your code works.

🚨🚨🚨 (Risks)

Is there some part of the code that you know probably doesn't work as it should? Call out potential weak spots, and get help addressing them.

@johnjohndoe
johnjohndoe / TaskoMatchers.java
Created March 28, 2016 15:51 — forked from anonymous/TaskoMatchers.java
Matchers file from Episode 29 of Caster.IO - Creating Custom ViewMatchers
package com.donnfelker.tasko;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.StateListDrawable;
import android.support.test.espresso.matcher.BoundedMatcher;
import android.text.TextUtils;
import android.view.View;