Skip to content

Instantly share code, notes, and snippets.

View sgr-ksmt's full-sized avatar
👉
👁👃👁

Suguru Kishimoto sgr-ksmt

👉
👁👃👁
View GitHub Profile
@sgr-ksmt
sgr-ksmt / firebase_model_macro.dart
Created September 20, 2024 05:06
Dart Macros x Firestore
import 'dart:async';
import 'package:macros/macros.dart';
macro class FirestoreModel implements ClassDeclarationsMacro {
const FirestoreModel(this.collectionPath);
final String collectionPath;
@override
FutureOr<void> buildDeclarationsForClass(ClassDeclaration clazz, MemberDeclarationBuilder builder) async {
@sgr-ksmt
sgr-ksmt / main.dart
Last active September 6, 2022 05:36
SliverList + separated
import 'dart:math' as math;
import 'package:flutter/material.dart';
extension SliverListEx on SliverList {
static SliverList separated({
required int itemCount,
required NullableIndexedWidgetBuilder itemBuilder,
required NullableIndexedWidgetBuilder separatorBuilder,
}) {
return SliverList(
@sgr-ksmt
sgr-ksmt / dart.json
Created November 6, 2020 13:15
VSCode Snippet: river_pod provider template
{
"prvdr": {
"prefix": "prvdr",
"body": [
"import 'package:hooks_riverpod/hooks_riverpod.dart';",
"final ${1:${TM_FILENAME_BASE/((^[a-z])|_([a-z]))/${2:/downcase}${3:/upcase}/g}} = Provider$2((ref) => ${TM_FILENAME_BASE/((^[a-z])|_([a-z]))/${2:/upcase}${3:/upcase}/g}(ref.read));",
"",
"class ${TM_FILENAME_BASE/((^[a-z])|_([a-z]))/${2:/upcase}${3:/upcase}/g} {",
" const ${TM_FILENAME_BASE/((^[a-z])|_([a-z]))/${2:/upcase}${3:/upcase}/g}(this._read);",
" final Reader _read;",
@sgr-ksmt
sgr-ksmt / wrap_example.dart
Created June 7, 2020 16:14
wrap_example.dart
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
@sgr-ksmt
sgr-ksmt / firebase_test_helper.ts
Created June 3, 2020 10:00
Helper functions of Firebase test for Cloud Functions and firestore.rules
import * as firebase from '@firebase/testing'
import * as fs from 'fs'
const REAL_FIREBASE_PROJECT_ID = '<please input your firebase project id here>'
export const makeTestProjectID = (projectName = 'test') => {
const hrTime = process.hrtime()
return `${projectName}${(hrTime[0] * 1000000 + hrTime[1] / 1000) * 1000}`
}
@sgr-ksmt
sgr-ksmt / _usage.dart
Last active May 5, 2020 23:42
BouncedWidget
Widget buld(BuildContext context) {
return BouncedWidget.create(
child: const SomeListTile(),
bounce: 0.1,
duration: const Duration(milliseconds: 350),
);
}
@sgr-ksmt
sgr-ksmt / progress_button.dart
Created April 7, 2020 08:33
[Flutter] ProgressButton
import 'package:flutter/material.dart';
@immutable
class ProgressButton extends StatelessWidget {
const ProgressButton({
@required this.title,
@required this.onPressed,
this.processing = false,
this.enabled = true,
});
@sgr-ksmt
sgr-ksmt / main.dart
Last active April 7, 2020 08:33
[Flutter] ProgressButton
import 'package:flutter/material.dart';
@immutable
class ProgressButton extends StatelessWidget {
const ProgressButton({
@required this.title,
@required this.onPressed,
this.processing = false,
this.enabled = true,
});
@sgr-ksmt
sgr-ksmt / baseFunctions.ts
Created April 4, 2020 07:27
Wrap firebase-functions with specified region.
import * as f from 'firebase-functions'
const functions = (runtimeOptions: f.RuntimeOptions = {}) =>
f.runWith(runtimeOptions).region('asia-northeast1')
export default functions
@sgr-ksmt
sgr-ksmt / job_description_2020-04-01.md
Last active June 26, 2020 05:03
2020/05以降のお仕事を探しています。

募集

2020年5月以降(早くて4月中旬以降)を目処に、副業先を探しています。

連絡先

TwitterのDM或いは、以下のメールアドレス宛にお願いします。([at]→@)

melodydance.k.s+biz[at]gmail.com