Skip to content

Instantly share code, notes, and snippets.

View nilsreichardt's full-sized avatar
🔥
Focusing

Nils Reichardt nilsreichardt

🔥
Focusing
View GitHub Profile
@nilsreichardt
nilsreichardt / codemagic.yaml
Created May 6, 2023 17:08
The codemagic.yaml of the Flutter Counter app file for M2 vs M1 vs Mac Pro comparison
definitions:
environment_setup: &environment_setup
flutter: v3.7.12
xcode: 14.3
scripts:
- &install_dependencies
name: Install dependencies
script: flutter pub get
- &build_ipa
name: Build IPA
@nilsreichardt
nilsreichardt / codemagic.yaml
Created May 6, 2023 17:07
The codemagic.yaml of the Sharezone app file for M2 vs M1 vs Mac Pro comparison
definitions:
environment_setup: &environment_setup
flutter: v3.7.12
xcode: 14.3
groups:
- ios-publishing
- certificate_credentials
scripts:
- &install_dependencies
name: Install dependencies
@nilsreichardt
nilsreichardt / ControlFlowGraphPrompt.md
Last active April 2, 2023 22:01
A prompt to convert text into a Mermaid control flow graph

Prompt

Please convert the following text into a Mermaid diagram like a control flow graph. The "Jump to" commands should not be translated 1:1. Instead, you should use the connections arrows (-->). Do not name the numbers in the diagram. Convert double quotes to single quotes. Decisions are using {} instead of []. Use meaningful graph IDs instead of (1,2,3 or A, B, C).

  1. Is PR a fork? If yes, jump to 2, if no, jump to 3
  2. Remove the "safe to build" label, jump to 3
  3. Execute the "changes" workflow, jump to 4
  4. Is PR a fork? If yes, jump to 5, if no, jump to 7
  5. Has PR "safe to build label"? If yes, jump to 7, if no, jump to 6.
  6. Cancel
@nilsreichardt
nilsreichardt / release_app.sh
Created July 29, 2022 17:44
A script to bump the app version, deploy the app to App Store Connect and Firebase Distribution and create a GitHub release with a changelog.
#!/bin/bash
# Script to deploy a new app update to the alpha environment manually.
#
# This script is not used by CI. It's meant to be run manually to avoid high CI
# build times.
#
# When the compnay has more money, we should only deploy to the alpha track via
# CI and delete this script.
@nilsreichardt
nilsreichardt / colours.dart
Created July 20, 2022 12:38
Display all primary Flutter colours. Run it with Zapp: https://zapp.run/edit/flutter-zu0066yu106
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
void main() {
runApp(MaterialApp(
darkTheme: ThemeData.dark(),
theme: ThemeData.light(),
home: Scaffold(
appBar: AppBar(title: const Text('Colors')),
body: ListView.builder(
@nilsreichardt
nilsreichardt / id_generator.ts
Created June 21, 2022 13:18
Id generator in TypeScript
export function generateId(length: number): string {
let outString: string = '';
const inOptions: string = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
for (let i = 0; i < length; i++) {
outString += inOptions.charAt(Math.floor(Math.random() * inOptions.length));
}
return outString;
}
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
void main() => runApp(const ProviderScope(child: MyApp()));
final userProvider = StateProvider<int>((ref) => 1);
final controllerProvider = StateNotifierProvider<ControllerNotifier, int>(
@nilsreichardt
nilsreichardt / generate_big_csv_file.dart
Created April 20, 2022 13:43
A script to generate a big CSV file with dummy data.
import 'dart:io';
import 'dart:math';
void main() {
final titles = List.generate(12, (i) => '$i');
// Generate data
final data = [
titles,
for (int i = 0; i < 200000; i++)
@nilsreichardt
nilsreichardt / ci.yaml
Created February 6, 2022 12:38
A GitHub action to report code coverage
name: ci
on:
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
env:
@nilsreichardt
nilsreichardt / codemagic.yaml
Created January 30, 2022 21:14
App previews with Codemagic, but only andorid
workflows:
app-preview:
name: App Preview
# All available instance types:
# https://docs.codemagic.io/yaml/yaml-getting-started/#instance-type
instance_type: mac_pro
max_build_duration: 75
environment:
groups:
- github