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
| from decimal import Decimal | |
| from django.db import models | |
| class Color(models.Model): | |
| red = models.DecimalField(blank=False, null=False, decimal_places=2, max_digits=12) | |
| green = models.DecimalField(blank=False, null=False, decimal_places=2, max_digits=12) | |
| blue = models.DecimalField(blank=False, null=False, decimal_places=2, max_digits=12) | |
| alpha = models.DecimalField(blank=False, null=False, decimal_places=2, max_digits=12, default=Decimal(1.0)) |
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
| createPersistedState({ | |
| paths: Object.entries(modules).map( | |
| ([mName , m]) => 'persistentPaths' in m | |
| ? m.persistentPaths.map(path => mName + "." + path) | |
| : [] | |
| ).flat(), | |
| }) |
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
| export default { | |
| state: {count: 0}, | |
| mutations: { | |
| increment: state => state.count++, | |
| decrement: state => state.count-- | |
| }, | |
| persistentPaths: ["count", ] | |
| } |
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
| export const createAppInEl = (options, store, selector) => { | |
| const mountEl = document.querySelector(selector); | |
| const app = createApp(options, {...mountEl.dataset}); | |
| app.use(store); | |
| // additional configurations here | |
| app.mount(selector); | |
| return app; | |
| } |
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
| const datasetDatatypePostfix = "Datatype"; | |
| const convertDatasetToTyped = (dataset) => { | |
| const keys = Object.keys(dataset); | |
| keys.forEach(function(key){ | |
| let datatypeKey = key + datasetDatatypePostfix; | |
| if (datatypeKey in dataset) { | |
| let datatype = dataset[datatypeKey]; | |
| switch (datatype) { | |
| case "String": //already string, do nothing |
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
| <div id="hello_world_b" data-msg="{{ msg1 }}"> | |
| <hello-world></hello-world> | |
| </div> |
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
| const selector = "#my_app_element"; | |
| const mountEl = document.querySelector(selector); | |
| const app = createApp(AppComponent, {...mountEl.dataset}); |
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 _RainbowBoxState extends State<RainbowBox> | |
| with SingleTickerProviderStateMixin { | |
| AnimationController _controller; | |
| Animation<double> _anim; | |
| @override | |
| void initState() { | |
| super.initState(); | |
| _controller = AnimationController( | |
| duration: const Duration(seconds: 5), |
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
| Animatable<Color> bgColor = RainbowColorTween([ | |
| Colors.red, | |
| Colors.blue, | |
| Colors.green, | |
| Colors.yellow, | |
| Colors.red, | |
| ]) |
NewerOlder