Skip to content

Instantly share code, notes, and snippets.

import 'package:flutter/material.dart';
import 'dart:math' as math;
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
import 'package:riverpod/riverpod.dart';
final counter = StateProvider((_) => 0);
final counter2 = StateProvider((ref) => ref.watch(counter));
Future<void> main() async {
final container = ProviderContainer();
// counter2 を listen
container.read(counter2.notifier).stream.listen(
@macoshita
macoshita / ghq-fzf.zsh
Last active December 16, 2021 15:01 — forked from sheepla/ghq-fzf.zsh
ghq で管理しているリポジトリに Ctrl-g で cd する on zsh
#
# ghq-fzf.zsh
#
# ABOUT:
# `cd` to `ghq` repositories directory on `zsh`
# You can launch this function with `Ctrl-g`
#
# INSTALLATION:
# Requires `zsh` and `fzf`
# Download this file then, append `source path/to/fzf-ghq.zsh` to your `~/.zshrc`
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
@macoshita
macoshita / main.dart
Last active February 3, 2020 07:10
Flutter Count Up Stateful Test
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
@macoshita
macoshita / main.dart
Last active July 5, 2019 07:04
Why warn unhandled exception
void main() async {
final a = Future.delayed(const Duration(seconds: 1));
final b = Future.error(2);
try {
await Future.wait([a, b]); // Warn uncatched error if remove this line.
await a;
await b;
} catch (e) {
print(e);
}
var toMarkdown = require('html2markdown');
var fm = require('front-matter');
var fs = require('fs');
var glob = require('glob');
var path = require('path');
var mkdirp = require('mkdirp');
glob.sync('./*.md').forEach(function(file) {
fs.readFile(file, 'utf8', function(err, data) {
var c = fm(data);