Skip to content

Instantly share code, notes, and snippets.


Pascal Welsch passsy

View GitHub Profile
passsy / const_uri.dart
Last active Mar 16, 2021
const implemenation of dart:core Uri
View const_uri.dart
// @dart=2.12
/// A const implementation of Uri which crashes at first access in case the uri is invalid
class ConstUri implements Uri {
/// Caches the static parsed uri
/// The parsed uri can't be a mutable member field because that's not allowed for const classes
static final _cache = <String, Uri>{};
const ConstUri(String uri) : _uri = uri;
passsy / material text
Last active Jan 22, 2021
Material font sizes
View material text
passsy / build.gradle
Last active Jan 15, 2021
lazy jake wharton versioning
View build.gradle
def versionMajor = 3
def versionMinor = 0
def versionPatch = 0
def versionBuild = 0 // bump for dogfood builds, public betas, etc.
android {
defaultConfig {
versionCode versionMajor * 10000 + versionMinor * 1000 + versionPatch * 100 + versionBuild
versionName "${versionMajor}.${versionMinor}.${versionPatch}"
passsy /
Created Jul 8, 2013
BasicNetwork fix for Volley with fallback to Cache if the device is offline
* Copyright (C) 2011 The Android Open Source Project
* 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
* Unless required by applicable law or agreed to in writing, software
passsy / KIntent.kt
Last active Sep 29, 2020
Kotlin extension functions to start a generic Activity
View KIntent.kt
package com.pascalwelsch.extensions
import android.content.Context
import android.content.Intent
import android.os.Build
import android.os.Bundle
* Extensions for simpler launching of Activities
passsy /
Last active Jul 24, 2020
How to use xrechnung-visualization

How to use xrechnung-visualization

1. Install Ant

Install brew

/bin/bash -c "$(curl -fsSL"

Then install ant using brew

passsy / main.dart
Created Jun 17, 2020
wrap_content match_parent in Flutter
View main.dart
import 'package:flutter/material.dart';
Future<void> main() async {
builder: (context) => const MyApp(),
class MyApp extends StatelessWidget {
const MyApp({
passsy / Locale.kt
Last active May 28, 2020
Allows easy iteration about all available locales. Kotlin Collection implementation for LocaleList which doesn't implement Collection<Locale> itself.
View Locale.kt
import android.content.Context
import androidx.core.os.ConfigurationCompat
import androidx.core.os.LocaleListCompat
import java.util.Locale
* Returns an [Iterable] for the languages of the user, sorted by priority. First choice first.
passsy / main.dart
Created Apr 23, 2020
Type switch case
View main.dart
void main() {
final Object something = TypeA();
TypeA : () => print("found A"),
TypeB : () => print("found B"),
passsy /
Last active Apr 21, 2020
ArrayAdapter for RecyclerView
package com.pascalwelsch.utils;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;