Skip to content

Instantly share code, notes, and snippets.

View amake's full-sized avatar
🌵

Aaron Madlon-Kay amake

🌵
View GitHub Profile

This is a pattern I came up with when I was working on a fairly large one person app (25k LOC, legal/regulation calculator, lots of unit testing). It is very simple and very effective.

The short version is you have a RootStore that listens to all of it's child stores. Each store has an async initState method and a dispose method. Make observer mixins for platform channel related items like App Lifecycle, Geolocation, Geofencing that add more lifecycle methods to these stores and manage their own initState/dispose.

I realize that a gist is going to look like a bit of a cluster for something of this nature but I bet if you pull it all down into a project and start playing around with it you'll really enjoy it. Especially now that provider has context.select.

Here's an example of my folder structure in lib/features as a bit of a bonus

@slightfoot
slightfoot / sized_multi_child.dart
Created June 20, 2018 20:34
CustomSizedMultiChildLayout.. lets a child of CustomMultiChildLayout determine its size.
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
void main() => runApp(TestApp());
enum TestId {
First,
Second,
Third,
}
@voluntas
voluntas / death_march.md
Last active December 29, 2023 15:36
デスマーチが起きる理由 - 3つの指標

デスマーチが起きる理由 - 3つの指標

著者: 青い鴉(ぶるくろ)さん @bluecrow2

これは結城浩さんの運用されていた YukiWiki に当時 Coffee 様 (青い鴉(ぶるくろ)さん)がかかれていた文章です。 ただ 2018 年 3 月 7 日に YukiWiki が運用停止したため消えてしまいました。その記事のバックアップです。

今は 404 ですが、もともとの記事の URL は http://www.hyuki.com/yukiwiki/wiki.cgi?%A5%C7%A5%B9%A5%DE%A1%BC%A5%C1%A4%AC%B5%AF%A4%AD%A4%EB%CD%FD%CD%B3 になります。

昔、自分がとても感銘を受けた文章なので、このまま読めなくなるのはとてももったいないと思い、バックアップとして公開しています。

#!/bin/bash
set -e
CONTENTS=$(tesseract -c language_model_penalty_non_dict_word=0.8 --tessdata-dir /usr/local/share/tessdata/ "$1" stdout -l eng | xml esc)
hex=$((cat <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
@pmeulen
pmeulen / repair-timemachine-disk-network.sh
Created September 22, 2017 17:58
Script to repair a Time Machine network volume
#!/bin/bash
set -e
###############################################################################
# This script tries to repair a Time Machine *network* backup (i.e. an APF
# share containing a sparsebundle) that is shared over a network using e.g. an
# Apple TimeCapsule, a NAS, Raspberry PI, ...
# The script must be run on the computer that created the backup
#
@shunirr
shunirr / criminal_jc.md
Last active February 26, 2024 05:51
女子中学生チケット詐欺事件

criminal_jc

@rtrouton
rtrouton / gist:2ca6f001b3cecb5037825c7f9d2e422e
Created April 28, 2017 16:13
Xcode iOS simulator download URLs (as of Xcode 8.3.1)
iOS 10.2 Simulator: https://devimages-cdn.apple.com/downloads/xcode/simulators/com.apple.pkg.iPhoneSimulatorSDK10_2-10.2.1.1484185528.dmg
iOS 10.1 Simulator: https://devimages-cdn.apple.com/downloads/xcode/simulators/com.apple.pkg.iPhoneSimulatorSDK10_1-10.1.1.1476902849.dmg
iOS 10.0 Simulator: https://devimages-cdn.apple.com/downloads/xcode/simulators/com.apple.pkg.iPhoneSimulatorSDK10_0-10.0.1.1474488730.dmg
iOS 9.3 Simulator: https://devimages.apple.com.edgekey.net/downloads/xcode/simulators/com.apple.pkg.iPhoneSimulatorSDK9_3-9.3.1.1460411551.dmg
iOS 9.2 Simulator: https://devimages.apple.com.edgekey.net/downloads/xcode/simulators/com.apple.pkg.iPhoneSimulatorSDK9_2-9.2.1.1451951473.dmg
iOS 9.1 Simulator: https://devimages.apple.com.edgekey.net/downloads/xcode/simulators/com.apple.pkg.iPhoneSimulatorSDK9_1-9.1.1.1446593668.dmg
iOS 9.0 Simulator: https://devimages.apple.com.edgekey.net/downloads/xcode/simulators/com.apple.pkg.iPhoneSimulatorSDK9_0-9.0.1.1443554484.dmg
iOS 8.4 Simulator: https://devimages.a

This document has moved!

It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.

@lawrencelomax
lawrencelomax / Instructions.md
Last active July 27, 2016 07:52
instruments-without-delay on Xcode 7

instruments-without-delay uses the DYLD_INSERT_LIBRARIES environment variable to shim from the instruments command line all the way down to ScriptAgentShim which is the iOS Simulator service responsible for interfacing UIAutomation JavaScript with the native UIAutomation.framework. It uses a stack of shims, starting at the instruments executable, going through Simulator.app. It is an essential part of ios-driver as it removes a pesky 200ms delay that drastically slows down the process of executing end-to-end tests. This is a fixed cost that would occur on every command.

Other than a few things being moved around and renamed in Xcode 7, there is the new issue of the codesigning of the Simulator app that triggers amfid whenever an unsigned image is loaded. This essentially means that we can't use DYLD_INSERT_LIBRARIES on the Simulator Process with SimShim

It is however, possible to inject these environment variables at the launchdaemon level. There is a plist fo

@yu-tang
yu-tang / config.groovy
Created September 18, 2014 15:51
How to set Microsoft Translator credentials with Java Web Start version of OmegaT
/***
* required: OmegaT 3.1.3 or later
* this file must be saved at the inside of <your-scripts-folder>/application_startup/ folder.
***/
new ConfigSlurper().parse("""
// ***** CONFIG START: EDIT BELOW *****
/*** Google Translate v2 API key ***/
//google.api.key='xxxxx'