Skip to content

Instantly share code, notes, and snippets.

View KoheiKanagu's full-sized avatar
🏠
Working from home

KoheiKanagu KoheiKanagu

🏠
Working from home
View GitHub Profile
Future<void> loadAppFonts() async {
final fontManifest = await rootBundle.loadStructuredData(
'FontManifest.json',
(string) async => json.decode(string) as Iterable<dynamic>,
);
for (final e in fontManifest) {
final loader = FontLoader(
(e as Map<String, dynamic>)['family'] as String,
);
#!/bin/bash
set -euxo pipefail
BUNDLE_ID=dev.kingu.bundleId # FIXME: change to your bundle ID for iOS
PACKAGE_NAME=dev.kingu.package_name # FIXME: change to your package name for Android
EMAIL=kohei.kanagu@gmail.com # FIXME: change to your Google account
PROJECT_NAME_DEV=project-name-dev # FIXME: change to your project name
PROJECT_NAME_PROD=project-name-prod # FIXME: change to your project name
class CustomSliverPersistentHeader extends SingleChildRenderObjectWidget {
const CustomSliverPersistentHeader({
super.key,
required super.child,
});
@override
RenderObject createRenderObject(BuildContext context) =>
_RenderCustomSliverPersistentHeader();
}
#!/bin/bash
set -euxo pipefail
echo '
[
{
"name": "delete_all",
"action": {
"type": "Delete"
},
@KoheiKanagu
KoheiKanagu / auto_merge.yaml
Created May 31, 2023 04:49
PRのワークフローが完了した際に`auto_merge`というタグがあればマージする
name: Auto Merge
on:
workflow_run:
workflows:
- Pull Requests
types:
- completed
concurrency:
@KoheiKanagu
KoheiKanagu / pub_get.yaml
Created May 12, 2023 01:46
pubのdependabotがpubspec.lockのsha256を削除してしまうため、pub getしてコミットするGithub Actionsのワークフロー
name: pub get
on:
pull_request:
paths:
- packages/**/pubspec.yaml
- packages/**/pubspec.lock
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
@KoheiKanagu
KoheiKanagu / github-actions-oidc.sh
Last active April 4, 2024 06:28
GitHub ActionsでFirebase CLIを利用する際にOpenID Connectを利用して認証するための下準備スクリプト
#!/bin/bash
set -euxo pipefail
while [ $# -gt 0 ]; do
case "$1" in
--project-id=*)
PROJECT_ID="${1#*=}"
;;
--github-user-name=*)
GITHUB_USER_NAME="${1#*=}"
// ignore_for_file: depend_on_referenced_packages
import 'package:firebase_core_platform_interface/firebase_core_platform_interface.dart';
import 'package:flutter_test/flutter_test.dart';
// https://github.com/firebase/flutterfire/issues/3311#issuecomment-721414988
void setupFirebaseAppMocks() {
TestWidgetsFlutterBinding.ensureInitialized();
MethodChannelFirebase.channel.setMockMethodCallHandler(
#!/bin/bash
set -euxo pipefail
# https://github.com/flutter/flutter/labels
gh label create "P0" --description "Priority 0 issue such as a build break or regression." --color "#FF0000"
gh label create "P1" --description "Priority 1 issue likely blocking a tier-1 customer now." --color "#DD0000"
gh label create "P2" --description "Priority 2 issue likely blocking a tier-1 customer soon." --color "#AA0000"
gh label create "P3" --description "Priority 3 issue (the default for issues we're likely to work on after P0-P2 issues)" --color "#990000"
gh label create "P4" --description "Priority 4 issue (default for bugs, things we're likely to work on)" --color "#770000"
@KoheiKanagu
KoheiKanagu / settings.json
Created November 10, 2021 14:18
M1 macにVS CodeのRemote SSHで接続した時、TERMINALでzshをarm64で動かす
{
"terminal.integrated.defaultProfile.osx": "arch",
"terminal.integrated.profiles.osx": {
"arch": {
"path": "/usr/bin/arch",
"args": ["-arm64", "zsh", "-l"]
}
}
}