<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Tomi Hiltunen on Medium]]></title>
        <description><![CDATA[Stories by Tomi Hiltunen on Medium]]></description>
        <link>https://medium.com/@TomiHiltunen?source=rss-b0aafbffd9f8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*OSMuFVglMb6aZPRfcGFG5g.jpeg</url>
            <title>Stories by Tomi Hiltunen on Medium</title>
            <link>https://medium.com/@TomiHiltunen?source=rss-b0aafbffd9f8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 02:25:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@TomiHiltunen/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Common polypody — the licorice-like rhizome]]></title>
            <link>https://medium.com/the-finn-out-there/common-polypody-the-licorice-like-rhizome-27bcffc0d109?source=rss-b0aafbffd9f8------2</link>
            <guid isPermaLink="false">https://medium.com/p/27bcffc0d109</guid>
            <category><![CDATA[plants]]></category>
            <category><![CDATA[finland]]></category>
            <category><![CDATA[nature]]></category>
            <dc:creator><![CDATA[Tomi Hiltunen]]></dc:creator>
            <pubDate>Wed, 26 Aug 2020 22:03:41 GMT</pubDate>
            <atom:updated>2020-08-26T22:08:06.064Z</atom:updated>
            <content:encoded><![CDATA[<h3>Common polypody — the licorice-like rhizome</h3><p>Polypody <em>(🇫🇮 kallioimarre)</em> is a fern-like plant that grows in rocky places. The cool thing about this plant is that the rhizome can be eaten and it tastes pretty much like licorice! The flavor is strong enough so you won’t need much of this to spice up a dish or to make some tea.</p><p>This plant is common throughout Finland — and Europe for that matter. You can find it in the woods close to rocks, cliffs, and occasionally nearby trees. The leaves are neat looking and get smaller towards the end of the stem. From June to September the underside of the leaves might be covered in red spots containing spore.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uJ7PEmrLPW7alDezJVeReg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wB4_hziHxmLtOHs8_tLAJQ.jpeg" /><figcaption>Polypody leaves. The leaves on the second picture have spores developing.</figcaption></figure><p>A knife or a tiny shovel is useful when harvesting the rhizome. Pulling from the stem will likely lead to the plant snapping before you can pull out the rhizome. Try to dig little-by-little around the stem looking for the roots. Keep digging around the rhizome deeper to cut the smaller roots shooting out from it.</p><p>The rhizome likely ends up coming out with plenty of dirt and bits of root. All of that can be plucked using your fingers until what remains is a brown stick with little bumps on your hand.</p><p>Now you can peel the rhizome using a knife. I peeled the root with gentle scratches using the blade’s edge. No need for much force or to carve pieces of the rhizome off.</p><p>What remains is the green inside. This part can be eaten raw. Take a small bite out of it and see if you can find the taste of licorice!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zr2hTaw4qU3YOBYqzveDWg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2CEorWAUObPE1PkgoEtqng.jpeg" /><figcaption>1) A knife is useful in extracting the rhizome 2) Couple of cleaned rhizomes and one slightly peeled</figcaption></figure><p>Polypody roots can be grown in a planter at home. It’s a common plant used in many gardens across the country. One thing to keep in mind is that harvesting plant roots in Finland require permission from the landowner.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=27bcffc0d109" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-finn-out-there/common-polypody-the-licorice-like-rhizome-27bcffc0d109">Common polypody — the licorice-like rhizome</a> was originally published in <a href="https://medium.com/the-finn-out-there">The Finn Out There</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hedgehog mushrooms + recipe]]></title>
            <link>https://medium.com/the-finn-out-there/hedgehog-mushrooms-recipe-97ddc0cca223?source=rss-b0aafbffd9f8------2</link>
            <guid isPermaLink="false">https://medium.com/p/97ddc0cca223</guid>
            <category><![CDATA[food]]></category>
            <category><![CDATA[finland]]></category>
            <category><![CDATA[mushrooms]]></category>
            <category><![CDATA[foraging]]></category>
            <category><![CDATA[forest]]></category>
            <dc:creator><![CDATA[Tomi Hiltunen]]></dc:creator>
            <pubDate>Wed, 26 Aug 2020 20:05:19 GMT</pubDate>
            <atom:updated>2020-08-26T20:05:19.959Z</atom:updated>
            <content:encoded><![CDATA[<p>Hedgehog mushrooms <em>(🇫🇮 vaaleaorakas)</em> are one of the most sought after mushrooms in Finnish forests. They look clean, taste great, and are easy to recognize. In fact, these mushrooms don’t have any harmful look-alikes making them an absolute unit in beginner-friendliness.</p><p>Sure way to recognize this one is to take a look on the underside. The underside is full of soft, fragile spikes. The color is clean faint caramel with some white.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZmQI6IxlhKGyBbMGjtnfMw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-Y45N5wLMzYTz6395mmsOQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6PdHpogs5VresrELJaWGYg.jpeg" /><figcaption>Hedgehog mushrooms in their natural habitat among the moss.</figcaption></figure><p>Hedgehog mushrooms can be found all over Finland. Although, they become fewer the Norther you go. The ones in the pictures I found in Sipoo area of Southern Finland. These mushrooms grow in the shade of heath forests <em>(🇫🇮 kangasmetsä)</em> from August to October.</p><p>Preparation of this toxin-free mushroom is easy. I found that the easiest way to clean the mushroom was to rinse the underside under a running water tap. Any piece of dirt among the spikes washed off with just that. The topside required a rough brush to clean. The dirt on the leg was tougher and required scratching the surface with a knife to get it off. That also peeled the leg but only so much. Most of the mushroom was saved for use.</p><p>What to do with a hedgehog mushroom then? It’s possible to use this mushroom fresh or to preserve them through freezing or drying. Hedgehog mushroom can have a sour taste when uncooked so frying it thoroughly is necessary. All parts of this mushroom can be used. The cap is firm and can be fried like a steak. Another way is dice the whole mushroom up and fry the cubes in oil or butter to be used in a sauce.</p><h3>Hedgehog mushroom with spelt</h3><p>The original recipe for this dish is created by Mari Moilanen and can be found at <a href="https://www.jotainmaukasta.fi/tag/miten-vaaleaorakas-valmistetaan/">jotainmaukasta.fi</a>. Since the recipe is in Finnish, I’ve translated it here for you. I did add some butter when I was preparing this as butter is just that delicious together with mushrooms.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*49AusQl_e6tgp5JMP1Nnyg.jpeg" /><figcaption>Dinner ready to be served</figcaption></figure><p>Incredients needed:</p><ul><li>1 litre of hedgehog mushrooms</li><li>3 desilitres of spelt grain</li><li>½ litre of kale</li><li>1 tablespoon of honey</li><li>3 tablespoons of finely chopped parsley</li><li>1 glove of garlic</li><li>½ tablespoon of apple winegar</li><li>2 teaspoons of salt</li><li>black pepper</li><li>Olive oil</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*28LxLv-7U6mHT5pQcULszw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qQNYARTWtVX8GVBmN-PJnA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4pyvydQN0zbdLXIsItA4sg.jpeg" /><figcaption>1) Incredients 2) Initial volume of mushrooms on the pan 3) Final amount after water has evaporated</figcaption></figure><p>Instructions:</p><ol><li>Clean and dice up the mushrooms into cubes the size of a thumbnail.</li><li>Boil the spelt with 6 desilitres of water, some salt, and a dash of oil. Drain after boiled.</li><li>Chop up the kale and remove the midribs.</li><li>Fry the cubes of mushroom on a dry, pre-heated pan. Plenty of liquids and steam will be released. After the liquid is evaporated you can throw in some butter for additional flavor.</li><li>Once both the mushrooms and the spelt is ready, move the spelt on the same pan. Throw the kale in the mix. Fry till kale softens.</li><li>Add honey, apple winegar, fine garlic, salt, and pepper.</li><li>Parsley can be added as a finishing touch. Reserve some for garnish!</li></ol><p><em>This is a brand new publication for personal note keeping and to share my learnings from Finnish nature: hiking, foraging, hunting, survival skills etc. In addition to this blog I have an Instagram account dedicated to the same topics. You can find it from here: </em><a href="https://www.instagram.com/thefinnoutthere/"><em>https://www.instagram.com/thefinnoutthere/</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=97ddc0cca223" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-finn-out-there/hedgehog-mushrooms-recipe-97ddc0cca223">Hedgehog mushrooms + recipe</a> was originally published in <a href="https://medium.com/the-finn-out-there">The Finn Out There</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How We Built a Seamless User-Experience from Multiple Small Front-End Applications]]></title>
            <link>https://medium.com/smartly-io/how-we-built-a-seamless-user-experience-from-multiple-small-front-end-applications-84c568c78a05?source=rss-b0aafbffd9f8------2</link>
            <guid isPermaLink="false">https://medium.com/p/84c568c78a05</guid>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Tomi Hiltunen]]></dc:creator>
            <pubDate>Wed, 24 Apr 2019 08:52:20 GMT</pubDate>
            <atom:updated>2019-04-24T08:52:20.846Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A1JI4-GoYXL8OZZFX4KtFg.jpeg" /></figure><p>In the past five years, our front-end codebase had grown so much that it became unmanageable. Test runs got lengthy and builds took forever to complete. Optimisation to our Webpack setup, like <a href="https://github.com/asfktz/autodll-webpack-plugin">AutoDLL</a> and <a href="https://github.com/amireh/happypack">Happypack</a>, and test suites could only get us so far as more features were piling up and the codebase kept on expanding.</p><p>Running tests, type checks, linters and the like would take it’s sweet time no matter how well we optimised. On the backend side, we already manage the complexity by splitting parts of the application into microservices. As we got around planning a completely new piece of our front-end, Pinterest campaign creation, we decided it was finally time to start splitting our front-end into smaller chunks as well.</p><h3>The new front-end architecture</h3><p>Our baseline was a single, monolithic front-end application built with AngularJS and React over the last five years. We wanted to be able to develop pieces of our front-end application separately while keeping the end-user experience similar to using a single app. These separated packages should have their own development, testing and release setups, and they should not depend on the old front-end to be able to run locally.</p><h4>Monorepo</h4><p>We chose a <a href="https://en.wikipedia.org/wiki/Monorepo">monorepo</a> structure to separate the new Pinterest pieces from our old codebase. After <a href="http://rachaelmoore.name/posts/development/devops/comparison-of-monorepo-tools/">comparing some options</a>, we decided to set it up using <a href="https://github.com/lerna/lerna">Lerna</a>. We had good experiences using Lerna in a previous project, where we separated common reusable components from the old front-end into a dedicated design system. Monorepo structure and Lerna enabled us to work effortlessly on multiple packages that <em>depend on each other</em>. Lerna also parallelises builds and test runs for the packages.</p><p>Some of the advantages of the new setup:</p><ul><li>We can ignore a lot of the legacy we have in the old frontend.</li><li>We do not need to support AngularJS and related tooling.</li><li>We can go fully TypeScript and not support Flow typing.</li><li>We can keep our conventions better in check.</li><li>Test runs and type checks are insanely fast compared to the old monolithic front-end.</li><li>Making sense of the whole codebase is much much easier.</li></ul><h4>Local development</h4><p>While we do use <a href="https://storybook.js.org/">React Storybook</a> with our design system component library, we did not take it into use with our new Pinterest monorepo. Storybook is a quick way of testing individual components, which is why we like to use it most of the time. However, the Pinterest front-end parts are full, small applications with routing, Redux setup, they access APIs and the like, which makes them less suited for Storybook.</p><p>Instead, we set up a small testbench for running the application locally during development, built and served by the <a href="https://webpack.js.org/configuration/dev-server/">Webpack Dev Server</a>. The testbench application is simply a React application with a router with each route pointing to a separate package within the monorepo. Those packages are lazy-loaded into the testbench much like they would be, were they integrated into the old front-end.</p><h4>Routing</h4><p>When integrating sub-applications to our main app routing becomes an additional problem. Our goal is to let the child application to define its own routes, but at the same time, we want to allow the parent app to mount the child app into any path, as well as change that path at will. We also want all the links in our child app to be correctly prefixed with this mount path. This means that our child application routes (as well as links) need to be dynamic and agnostic to the parent application’s routing implementation.</p><p>In our case, we use React Router to build the child application routes. Meanwhile, our parent application is using a mix of Angular router and Redux-first Router. By default, React Router’s Router (or BrowserRouter) components do not allow defining a custom prefix to all of the child application routes. Using the ‘basename’ prop does not solve the problem since it prevents us from navigating outside the basename path.</p><p>Our solution to this issue is to store the <em>history</em> instance created by Redux First Router’s <em>connectRoutes</em> function in the parent app. In the sub-application, instead of using the BrowserRouter component from React Router package, we would use the plain Router that accepts an instance of history as a prop. The main frontend application’s history would be passed into the sub-application and used as the history for that router. To accommodate the router for the basename, under which the sub-application will be mounted, the history will be extended by the sub-application as you can see here:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6bf584f495a481bf89db5ea266266822/href">https://medium.com/media/6bf584f495a481bf89db5ea266266822/href</a></iframe><p>This allows the React Router’s Link and NavLink component to automatically build links using the provided dynamic prefix without having to define them in the child app statically. We also preserve the existing history stack for back navigation without having to use a blank history in the child app. Additionally, we now use the basename definition when creating the route map when the application is initialised:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/be215325d61e755bebe844ac44486cd0/href">https://medium.com/media/be215325d61e755bebe844ac44486cd0/href</a></iframe><p>Using the same instance of history in the child application solves the following problems:</p><ul><li>The browser’s back button now behaves in a consistent manner.</li><li>Prefixing routes in the child applications.</li><li>Prefixing links in React Router without needing to pass a string variable throughout the application.</li><li>The existing history from the parent application’s side remains and changes from the child application are reflected on the same history.</li></ul><h3>The workflow of releasing separated packages as one front-end application</h3><ol><li>The developer would work on the changes to the individual front-end package.</li><li>A PR is opened to the monorepo, which triggers automated test runs for the package.</li><li>When tests are passed, and the solution is peer-reviewed, the code is merged to monorepo master.</li><li>Merging to master triggers a release to our private NPM equivalent. Lerna handles building and releasing the various changed packages.</li><li>A PR for upgrading the package is opened to the main front-end repository.</li><li>Automated integration tests are run. It is a much lighter test setup than the full extent of the tests within the monorepo package.</li><li>Once everything is green, the PR can be merged which then triggers an automated release to production.</li><li>The release is built in a way that the child applications can be lazy-loaded when needed. Webpack can optimise chunks of dependencies.</li></ol><h3>Conclusion</h3><p>Progress on the front-end application has been swift. Without the weight of the old front-end, Pinterest tools build quickly and update automatically almost quicker than it takes to switch between the editor and the browser. However, the mocks can also cause issues when the GraphQL types in production front-end are ahead of those implemented in the backend side. This requires some coordination between the back-end and front-end development.</p><p><strong>See also:</strong></p><p>My colleague Mikko Kivelä gave a talk on this topic at the React Helsinki meetup yesterday. Find the talk embedded below and check out the example project he uses here: <a href="https://github.com/smartlyio/micro-frontend-starter">https://github.com/smartlyio/micro-frontend-starter</a>.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FRD8fnhkmulg%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DRD8fnhkmulg&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FRD8fnhkmulg%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/2b0bdcbc8de40bb17d54e9aca31de37e/href">https://medium.com/media/2b0bdcbc8de40bb17d54e9aca31de37e/href</a></iframe><p>Learn more about how developers work at Smartly.io: <a href="https://www.smartly.io/developer">www.smartly.io/developer</a>.</p><p><em>Originally published at </em><a href="https://www.smartly.io/blog/how-we-built-a-seamless-user-experience-from-multiple-small-front-end-applications"><em>https://www.smartly.io</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=84c568c78a05" width="1" height="1" alt=""><hr><p><a href="https://medium.com/smartly-io/how-we-built-a-seamless-user-experience-from-multiple-small-front-end-applications-84c568c78a05">How We Built a Seamless User-Experience from Multiple Small Front-End Applications</a> was originally published in <a href="https://medium.com/smartly-io">Smartly.io Tech Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Speeding up Product Development with Redux Modules]]></title>
            <link>https://medium.com/smartly-io/speeding-up-product-development-with-redux-modules-86f49b834ad4?source=rss-b0aafbffd9f8------2</link>
            <guid isPermaLink="false">https://medium.com/p/86f49b834ad4</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[redux]]></category>
            <dc:creator><![CDATA[Tomi Hiltunen]]></dc:creator>
            <pubDate>Tue, 07 Aug 2018 08:50:18 GMT</pubDate>
            <atom:updated>2018-08-07T10:47:09.871Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jeyglx8pq-AWdAyBGpWEjw.png" /></figure><p><a href="https://www.smartly.io/blog/how-to-migrate-from-angular-to-react-without-a-massive-rewrite">When we began phasing out Angular in favor of React, we took </a><a href="https://redux.js.org/">Redux</a> into use to manage the global application state. In this blog post, I’ll explain how we use Redux modules at Smartly.io to create a maintainable codebase.</p><p>As a <a href="https://facebook.github.io/flux/docs/overview.html">Flux</a>-like implementation, Redux follows a unidirectional data flow architecture, which, in Redux’s terms, means that whenever you need to make a change to an application’s state, you dispatch an action to the store. Reducers in the store then decide if they need to make any changes to their own state, depending on the action. Finally, the new state propagates to the view layer to all the components that are listening to the changes.</p><p>This pattern takes all the hassle away from debugging your application state, as only the reducers change your application state and they work exclusively based on the dispatched actions. However, there is more to be done for a clean Redux codebase and that’s where the modules come in!</p><h3>In and out</h3><p>When developing React components, it is a commonly encouraged pattern to split the logic and view. With our Redux setup, we aim to split the state logic and view layer completely. Providing clear APIs for interacting with the application state allows us to isolate the inner workings of our state machine from the view layer. In Redux, those APIs are actions for changing state and selectors for reading the state. Let’s talk more about actions and selectors later.</p><h3>Redux as modules</h3><p>The module structure for Redux is all about dividing code by domain areas and eliminating dependencies between the modules. When a developer needs to make changes to the massive code-base it is easier to find out which module is responsible for the area requiring the changes, how different actions affect the module state, and what you can actually pull out from the module. One example of a module could be named “Campaigns” with the responsibility of managing lists and details of user’s campaigns within the application state tree.</p><h3>What do the modules contain?</h3><p>The “Campaigns” module provides its own reducer, actions, selectors, and optionally some utils, constants etc. The utils in this case are any functional helpers that are related to the domain of the module.</p><p>Typical module structure is as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gwRXiga7tXGnNnkIsQC3Fw.png" /></figure><h4>1. Reducer</h4><p>The module reducer will manage a very specific subset of the whole application state. A “Campaigns” module reducer would only be managing state related to campaigns: list of campaigns, changes to campaign data, loading states for the module data etc. The whole application state is managed by a combined reducer built with all of our individual module reducers.</p><p>The application state with the different modules mounted on it might look something like this. The individual keys represent the modules and their own areas of responsibility.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/513a7828c187ad83989dab50b38b3043/href">https://medium.com/media/513a7828c187ad83989dab50b38b3043/href</a></iframe><h4>2. Action creators</h4><p>The module also contains action creators for creating actions that will be handled by its reducer. We decided to name our actions with the pattern &lt;project&gt;/&lt;module&gt;/&lt;ACTION_NAME&gt; so i.e. “smartly/campaigns/CREATE_CAMPAIGN”. The pattern is known from <strong>Erik Rasmussen</strong>’s proposal “<a href="https://github.com/erikras/ducks-modular-redux">Ducks: Redux Reducer Bundles</a>”. The pattern makes it easy to spot the right project, right module, and right action when looking through the list of actions in <a href="https://github.com/zalmoxisus/redux-devtools-extension">Redux DevTools</a>. This naming convention also helps avoid clashes in naming. Clashes can cause weird states as Redux doesn’t care where the action came from — it only cares about the “action.type” string when matched with reducer’s action handlers.</p><h4>3. Selectors</h4><p>Redux already takes good care of making sure all state changes are caused by dispatching actions to the store. However, when connecting your components to the store, the whole state is usually passed to the component. In some cases, it might be tempting to simply pick data like “state.myLittleModule.items”,ut then you’re actually making your data component aware of the shape of your whole state. What happens when “items” is no longer under “state.myLittleModule”?</p><p>The module specific selectors are used to pull data from the part of the application state that represents the module. Each module provides its own selectors for directly reading the module state. We typically use selectors in a <a href="https://reactjs.org/docs/higher-order-components.html">Higher-Order Component</a> that maps the selected values as props for our component. The selectors are called with the application state and, optionally, some additional arguments.</p><p>The additional arguments can be used ie. in a selector “getCampaignsByAccountId” to provide the selector with the account ID for filtering. Developers should make sure that the module selectors only read those parts of the data that are covered by the module itself. This is to avoid cross-dependencies between modules. To pull data handled by multiple modules, you can create a selector outside of the modules that will then use the selectors provided by the individual modules.</p><p>We’ve modeled our selectors by the state of the module itself. The selectors themselves have no idea where in the application state the module is mounted. On the initialization step we “globalise” all the selectors. This basically means that we wrap all the module’s selectors with an additional selector that picks the module’s part state from the whole application state and passes it to the “local” scope module selector. This allows us to build and test the selectors with only the shape of the module’s own state in mind. This separation between the module scope state and the store state makes it easier to test all the modules independently.</p><h3>Wrapping up</h3><p>This was a introduction to the ways we at Smartly.io look at Redux and Redux modules. Dive deeper into the topic with these goodreads:</p><p>Psst! We’re hiring for several roles in our Engineering team. Learn more at <a href="https://www.smartly.io/developer">smartly.io/developer</a>.</p><p><em>Originally published at </em><a href="https://www.smartly.io/blog/speeding-up-product-development-with-redux-modules"><em>www.smartly.io</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=86f49b834ad4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/smartly-io/speeding-up-product-development-with-redux-modules-86f49b834ad4">Speeding up Product Development with Redux Modules</a> was originally published in <a href="https://medium.com/smartly-io">Smartly.io Tech Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JavaScript Async/Await]]></title>
            <link>https://medium.com/@TomiHiltunen/javascript-async-await-e412472b915e?source=rss-b0aafbffd9f8------2</link>
            <guid isPermaLink="false">https://medium.com/p/e412472b915e</guid>
            <category><![CDATA[es6]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Tomi Hiltunen]]></dc:creator>
            <pubDate>Tue, 14 Feb 2017 12:21:39 GMT</pubDate>
            <atom:updated>2017-02-14T12:21:39.953Z</atom:updated>
            <content:encoded><![CDATA[<h3>Modern JavaScript Asynchronicity</h3><h3>Async / await</h3><p>ES7 features a native way of handling asynchronous functions in JavaScript. The best part about this feature is that you can write your code as if you were writing normal synchronous functions without callbacks or .then() chains for promises. The two keywords to know for this feature are <strong>1)</strong> asyncwhich denotes a function to be asynchronous and <strong>2)</strong> awaitthat lets you halt the execution of the function in a non-blocking way until the awaited promise is completed.</p><p>Async functions always return a promise. The returned promise is resolved with the return value of the async function or rejected when an unhandled error occurs.</p><p>When an awaited promise is resolved the resolve value is returned. However, if the promise is rejected an error will be thrown. That’s why it is important to wrap the code in a try/catch statement.</p><h3>Example #1 — sequential API calls</h3><p>In both examples below, API.get(...) returns a promise.</p><pre>// Using plain promises<br>function fetchCommunityWithPosts(id) {<br>    return API<br>        .get(`/community/${id}`)<br>        .then((community) =&gt; API<br>            .get(`/community/${id}/posts`)<br>            .then((posts) =&gt; {<br>                community.posts = posts;<br>                return community<br>            });<br>        );<br>}</pre><pre>// Using async/await<br>async function fetchCommunityWithPosts(id) {<br>    const community = await API.get(`/community/${id}`);<br>    const posts = await API.get(`/community/${id}/posts`);<br>    community.posts = posts;<br>    return community;<br>}</pre><h3>Example #2 — parallel API calls</h3><p>Execution continues when both have finished.</p><pre>// Using plain promises<br>function fetchCommunityWithPosts(id) {<br>    return Promise.all(<br>        API.get(`/community/${id}`),<br>        API.get(`/community/${id}/posts`)<br>    )<br>    .then(([community, posts]) =&gt; {<br>        community.posts = posts;<br>        return community;<br>    });<br>}</pre><pre>// Using async/await<br>async function fetchCommunityWithPosts(id) {<br>    const [community, posts] = await Promise.all(<br>        API.get(`/community/${id}`),<br>        API.get(`/community/${id}/posts`)<br>    );<br>    community.posts = posts;<br>    return community;<br>}</pre><h3>TL;DR:</h3><p>Async functions</p><ul><li>Use async in front of a function statement to denote an asynchronous function.</li><li>Async functions always return a promise.</li><li>Return values resolve the promise, thrown errors reject it.</li></ul><p>Awaiting for promise completion</p><ul><li>Use await in front of asynchronous function calls to halt execution and wait for the promise to resolve.</li><li>Waiting for an asynchronous action is non-blocking, other code outside the async function can continue execution.</li><li>After the promise is resolved you can immediately interact with the value as if it was returned from a synchronous function call.</li><li>If an awaited promise is rejected an error will be thrown (wrap in try/catch).</li></ul><h3>Caveats:</h3><ul><li>An asynchronous function call must be awaited or you will get a promise in return instead of the resolved value. Also execution of your code won’t be halted.</li><li>Awaiting has to be done inside a function denoted by async.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e412472b915e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Static HTML pages with Grunt]]></title>
            <link>https://medium.com/@TomiHiltunen/static-html-pages-with-grunt-aede44e4999?source=rss-b0aafbffd9f8------2</link>
            <guid isPermaLink="false">https://medium.com/p/aede44e4999</guid>
            <dc:creator><![CDATA[Tomi Hiltunen]]></dc:creator>
            <pubDate>Tue, 15 Jul 2014 18:04:05 GMT</pubDate>
            <atom:updated>2014-07-15T18:04:05.732Z</atom:updated>
            <content:encoded><![CDATA[<h4>From YAML to HTML using Grunt and Assemble</h4><p><em>psst… for this article you need to know basics of </em><a href="http://gruntjs.com/"><em>Grunt</em></a><em>.</em></p><p>Recently I embarked on creating the first completely static website in over a year. Before that most static websites done by me were simple landing pages for various web products. This project was to be done for a client that didn’t have and didn’t want to have a CMS; just a simple, static website.</p><p>The thing was, they have roughly thirty people working for them and all of the personnel were to have their own profile pages. <strong>It would be absolutely crazy to work those profile pages individually</strong>.</p><h3>Data for the static page generation</h3><p>The individual pages share a lot with each other which makes the HTML generation process well automatable. This, however, requires some data format to be fed into the templating engine. For legibility, I chose to go with <strong>YAML</strong>.</p><h4><strong>Data format</strong></h4><p>Here’s a simplified mock of the data as YAML:</p><pre>—-<br>  first_name: “John”<br>  last_name: “Doe”<br>  experience:<br>    -<br>      title: “Helsinki Uni”<br>      year: “1995&quot;<br>    -<br>      title: “Example Ltd”<br>      year: “1995 — 2008&quot;<br>—-</pre><p>The above is the content of a single YAML file. I had one for each profile in the personnel list with each of them named by the persons name as: <em>surname_firstname.yml</em>. All the profile data files were located neatly in the same directory.</p><h4>Template format</h4><p>Now that the data is set, I needed a HTML template. For each data file I want to have a HTML page. To avoid repeating manual work over all the profile pages on any minor or major change, I will simply edit the template and re-run the Grunt task to generate the static pages.</p><p>For that, I have a <a href="http://handlebarsjs.com/">Handlebars.js</a> template file, <em>personnel.hbs</em>:</p><pre>&lt;!doctype html&gt;<br>&lt;html lang=”en”&gt;<br>  &lt;head&gt;<br>    &lt;meta charset=”UTF-8&quot;&gt;<br>    &lt;title&gt;{{ last_name }}, {{ first_name }} | Example Ltd&lt;/title&gt;<br>  &lt;/head&gt;<br>  &lt;body&gt;</pre><pre>    &lt;h2&gt;{{ last_name }}, {{ first_name }}&lt;/h2&gt;</pre><pre>    &lt;ul&gt;<br>      {{#each experience}}<br>        &lt;li&gt;<br>          &lt;span&gt;{{ title }}&lt;/span&gt;<br>          &lt;span&gt;{{ year }}&lt;/span&gt;<br>        &lt;/li&gt;<br>      {{/each}}<br>    &lt;/ul&gt;<br>  <br>  &lt;/body&gt;<br>&lt;/html&gt;</pre><p>From the template above you can see that the properties in the YAML files can be directly accessed in the template file within the double braces. You can also use the builtin helpers, like <em>each</em>, which is used in the example template above.</p><h4>File structure</h4><p>My desired end result is easily presented as file structures before and after the Grunt task.</p><p><em>Before:</em></p><pre>src/<br>  personnel/<br>    personnel.hbs          &lt;-- template<br>    data/<br>      doe_jane.yml         &lt;-- profile data<br>      doe_john.yml         &lt;-- profile data<br>      poppins_mary.yml     &lt;-- profile data</pre><p><em>And after:</em></p><pre>dist/<br>  doe_jane.html            &lt;-- HTML page<br>  doe_john.html            &lt;-- HTML page<br>  poppins_mary.html        &lt;-- HTML page</pre><h3>Settings up Assemble</h3><p>To generate the static HTML pages I turned to <a href="http://assemble.io/">Assemble</a>. As it reads on their website:</p><blockquote>Assemble. The static site generator for Node.js, Grunt.js and Yeoman.</blockquote><p>Installation is straight forward with NPM:</p><pre>npm install assemble --save-dev</pre><p><strong>Configuring Assemble</strong></p><p>Below is an example of my Assemble configuration. Please note, that my configuration is in <strong>CoffeeScript</strong>!</p><pre>assemble:<br>  personnel:<br>    options:<br>      layout: [“src/personnel/personnel.hbs”]<br>    src: [“src/personnel/data/*.yml”]<br>    dest: “dist/”</pre><p>The above defines a task called <em>assemble:personnel</em>. In the options block I’m defining the template file to be used in the static HTML generation. You could also define path for finding partials in case your site consists of smaller pieces. The source files are all the YAML files (<em>*.yml</em>) and the destination is the root of my <em>dist</em> directory, where I want the finished HTML pages to appear.</p><blockquote>Now run the task and enjoy<br>while the work gets done for you!</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aede44e4999" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>