Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View kezhuw's full-sized avatar

Kezhu Wang kezhuw

View GitHub Profile
@kezhuw
kezhuw / outdated_dependencies_test.dart
Created November 13, 2017 14:13
Widget got rebuilt due to outdated dependencies
import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/widgets.dart';
class ConditionInherited extends InheritedWidget {
const ConditionInherited({this.value, Key key, Widget child}) : super(key: key, child: child);
final bool value;
static bool valueOf(BuildContext context) {
final ConditionInherited widget = context.inheritFromWidgetOfExactType(ConditionInherited);
@kezhuw
kezhuw / flutter_store.dart
Created November 3, 2017 02:19
Flutter Store Demo (Mutable InheritedWidget State)
import 'package:meta/meta.dart';
import 'package:flutter/widgets.dart';
final _emptyModuleSet = new Set<Module>();
typedef StateUpdater<T> = void Function(T state);
class Module {
Module({@required this.id, @required Store store, dynamic state}) : _store = store, _state = state;
@kezhuw
kezhuw / rotate.after.log
Created May 19, 2016 07:26
Key with larger sequence got compacted to elder level, while smaller sequence variant stays in younger level
=========================================
level 0 compaction: smallest snapshot: 1
=========================================
level 1 compaction: smallest snapshot: 1
@kezhuw
kezhuw / rotate.after.log
Created May 18, 2016 08:14
Rotate LevelDB compaction outputs at user key boundary
=========================================
level 0 compaction: smallest snapshot: 1
=========================================
level 1 compaction: smallest snapshot: 1
#include "remove_multiple_spaces.h"
#include <assert.h>
size_t
remove_multiple_spaces(char *str) {
assert(str != 0);
if (str[0] == '\0') {
return 0;
}