Skip to content

Instantly share code, notes, and snippets.

View ilikerobots's full-sized avatar

Mike Hoolehan ilikerobots

View GitHub Profile
Widget build(BuildContext context) {
return AnimatedBuilder(
animation: _controller,
builder: (context, child) {
return Container(
padding: EdgeInsets.all(24.0),
decoration: BoxDecoration(color: _colorAnim.value),
child: Text('Tween Sequence'),
);
});
class _TweenSequenceBoxState extends State<TweenSequenceBox>
with SingleTickerProviderStateMixin {
AnimationController _controller;
Animation<Color> _colorAnim;
@override
void initState() {
super.initState();
_controller = AnimationController(
Animatable<Color> bgColor = TweenSequence<Color>([
TweenSequenceItem(
weight: 1.0,
tween: ColorTween(begin: Colors.red, end: Colors.blue),
),
TweenSequenceItem(
weight: 1.0,
tween: ColorTween(begin: Colors.blue, end: Colors.green),
),
TweenSequenceItem(
<div>
<input id="button_loader" type="button" value="Load stopwatch">
</div>
<div id="stopwatch">
<stopwatch></stopwatch>
</div>
<script>
let stopwatchBtn = document.getElementById('button_loader');
from typing import Dict
from django import template
register = template.Library()
@register.inclusion_tag('lazy_render_bundle.html', takes_context=False)
def lazy_render_bundle(bundle: Dict[str, str]) -> Dict[str, Dict[str, str]]:
return {'bundle': bundle}
function load_bundle_file(url, filetype) {
let fileref;
if (filetype === "js") { // build js script tag
fileref = document.createElement('script');
fileref.setAttribute("type", "text/javascript");
fileref.setAttribute("src", url);
} else if (filetype === "css") { // build css link tag
fileref = document.createElement("link");
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
import Vue from "vue/dist/vue.js";
const Stopwatch = () => import( /* webpackChunkName: "chunk-stopwatch" */ "./components/Stopwatch.vue");
Vue.config.productionTip = false;
new Vue({
el: "#stopwatch",
components: {Stopwatch}
});
const pages = {
"stopwatch": {
entry: "./src/stopwatch.js",
chunks: ["chunk-moment", "chunk-vendors"],
},
[...]
}
config.optimization.splitChunks({
cacheGroups: {
moment: {
test: /[\\/]node_modules[\\/]moment/,
name: "chunk-moment",
chunks: "all",
priority: 5
},
vendor: {
test: /[\\/]node_modules[\\/]/,
config.optimization.splitChunks({
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/,
name: "chunk-vendors",
chunks: "all",
priority: 1
},
},
});