Weeknotes 5

Monday

This Vue + ElementUI + Typescript template is quite well put together. Very handy for getting a Proof of Concept up and running. https://github.com/Armour/vue-typescript-admin-template

Tuesday

I had to write some python for someone… it was weird. https://www.mongodb.com/blog/post/working-with-mongodb-stitch-through-existing-drivers--python

This tool is a nice way to deal with SVG file, possibly better than Fontawesome. https://github.com/MMF-FE/vue-svgicon

https://iconsvg.xyz/ Here’s an easy place to get a few free SVG icons quickly.

Wednesday

https://github.com/mcibique/vue-date-fns - now that’s useful! Create a reusable date-formatting Vue filter that is light-weight and easy to understand.

1
Vue.filter('datetime', createDateFilter('MM/DD/YYYY h:mm a'));

Thursday

I’ve had to create an average of numbers using .reduce before, but I apparently forgot and had to figure it out all over again.

1
2
3
4
5
6
7
8
9
10
11
private avgReducer = (prev: number, curr: number): number => (prev + curr) / 2;

private avgAnObject = (value: any[], key: string): number => {
return parseFloat(
Number(
value.map(
(x): number => x[key]
).reduce(this.avgReducer)
).toFixed(2)
);
}

Friday

More about reduce and a few really helpful utility functions using reduce, so that you don’t need to reach for lodash every time.

Speaking of which, maybe this library of LINQ inspired functions could be useful. FromFrom is a nice chainable API for dealing with lists of stuff. Here is a great explanation of why their approach is interesting:

fromfrom uses the iteration protocols to iterate through the input data. All transformations create a new iterable that when iterated reads from the previous iterable, applies the transformation and then provides the output data. fromfrom works with any input data that implements the iterable protocol. From the built-in types for example Array, Set and Map implement the iteration protocols, but for example Objects do not. fromfrom provides its own iterable implementation for objects, so they can also be used as input data.

I can dig that. I miss LINQ from C# and .Net.