Skip to content

Instantly share code, notes, and snippets.

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

Junji Zhi junjizhi

🏠
Working from home
View GitHub Profile
@junjizhi
junjizhi / main.dart
Created July 13, 2019 21:37
Flutter BLoC and Provider: A Shopping Cart Example - Hooking up Bloc with the app
// https://github.com/junjizhi/flutter-shopping-cart
import 'cart_bloc.dart';
import 'package:provider/provider.dart';
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ChangeNotifierProvider<CartBloc>(
builder: (context) => CartBloc(),
child: MaterialApp(
@junjizhi
junjizhi / resize.bash
Created December 2, 2019 03:12
Resize all image files to half of the sizes
#!/usr/bin/env bash
set -euxo pipefail
# Usage:
# cd /path/to/images/directory
# bash resize.bash
shopt -s extglob
for filename in [^resize]*.?(jpg|jpeg|png); do
newFile="resized-$filename"
@junjizhi
junjizhi / cupertino-clickable-card.dart
Created June 16, 2019 15:03
iOS style clickable card demo
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Clickable Card',
@junjizhi
junjizhi / find-sqlite-db-ios-simulator.bash
Created October 10, 2019 00:31
Find the sqlite file location of your iOS / Flutter app
# Returns all db files sorted by modified time. Usually the last one is your sqlite db file.
gfind /Users/<username>/Library/Developer/CoreSimulator/Devices/ -name "*.db" -printf "%T+\t%p\n" | sort