This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function initStore<StoreTypes, Store extends UseBoundStore<StoreApi<unknown>>>( | |
store: Store, | |
compare?: (a: StoreTypes, b: StoreTypes) => boolean | |
) { | |
return (newValue: StoreTypes, defaultValue: StoreTypes) => { | |
if (compare && compare(newValue, store.getState() as unknown as StoreTypes)) { | |
return | |
} | |
store.setState(newValue as any) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from "react"; | |
export function attachModel<T>(Model: { new (): T }) { | |
return function<Props, State>(Comp: React.ComponentClass<Props>) { | |
const ComponentModel = (Comp as any) as React.ComponentClass; | |
return class extends React.Component<Props, State> { | |
static displayName = `AttachedModel${ComponentModel.displayName || | |
ComponentModel.name}`; | |
render() { | |
return <ComponentModel {...this.props} />; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Future<File> _getCacheFile() async { | |
final dir = (await getApplicationDocumentsDirectory()).path; | |
return new File('$dir/hotlist.xml'); | |
} | |
Future<XmlDocument> _getHotListCache() async { | |
try { | |
final file = await _getCacheFile(); | |
return parse(await file.readAsString()); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return new GestureDetector( | |
onTap: () { | |
_selectGameItem(context, item); | |
}, | |
child: new Container( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_showGameItem(BuildContext context, BoardGameItem item) { | |
Navigator.push(context, new MaterialPageRoute( | |
builder: (BuildContext context) { | |
return new Scaffold( | |
appBar: new AppBar( | |
title: new Text(item.name) | |
), | |
body: new SizedBox.expand( | |
child: new Hero(tag: item.id, | |
child: new Container( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_showGameItem(BuildContext context, BoardGameItem item) { | |
Navigator.push(context, new MaterialPageRoute( | |
builder: (BuildContext context) { | |
return new Scaffold( | |
appBar: new AppBar( | |
title: new Text(item.name) | |
), | |
body: new SizedBox.expand( | |
child: new Hero(tag: item.id, | |
child: new Container( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Future<File> _getCacheFile() async { | |
var dir = (await getApplicationDocumentsDirectory()).path; | |
return new File('$dir/hotlist.xml'); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyHomePage extends StatefulWidget { | |
MyHomePage({Key key, this.title}) : super(key: key); | |
final String title; | |
@override | |
_MyHomePageState createState() => new _MyHomePageState(); | |
} | |
class _MyHomePageState extends State<MyHomePage> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return new Container( | |
margin: const EdgeInsets.symmetric(vertical: 6.0, horizontal: 8.0), | |
child: | |
new Row( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: <Widget>[ | |
new Container( | |
margin: const EdgeInsets.only(right: 16.0), | |
child: new ConstrainedBox( | |
constraints: const BoxConstraints( |
This file has been truncated, but you can view the full file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
This file is an example of a very large file in Python that highlights a performance issue with intellisense in VSCode | |
and the current Python extension. It takes 20+ seconds to show the list of properties. | |
DataSource: FriendlyExample | |
""" | |
class Column: | |
def __init__(self, parent, column_name): | |
pass |
NewerOlder