teleren/devto huggingface dataset:
[Video] Why I Chose to Modularize the Ducks in My React App
Tags: cascadiajs2018, videos, javascript
Published: 2019-06-11 18:16:37

---
title: [Video] Why I Chose to Modularize the Ducks in My React App
published: true
description: React and Redux are awesome but the state management can be overwhelming for beginners. This talk is all about how to keep your code DRY, scalable, and maintainable- the dream trifecta!- regardless of its size and scope. Creating “ducks”, or modularized components, allows you to keep all of your state in one place and avoid creating a new file for every single action and reducer. This talk will cover how to create those ducks!
tags: cascadiajs2018, videos, javascript
cover_image: https://pbs.twimg.com/media/DtM87aIU0AMyD94.jpg:large
---
*As we lead up to [CascadiaJS 2019](https://2019.cascadiajs.com), I'm going to share the 24 amazing talks from 2018 here on dev.to. Sit back and enjoy the show!*

![Lauren Lee](https://2018.cascadiajs.com/speakers/laurenlee.jpg)

React and Redux are awesome but the state management can be overwhelming for beginners. This talk is all about how to keep your code DRY, scalable, and maintainable- the dream trifecta!- regardless of its size and scope. Creating “ducks”, or modularized components, allows you to keep all of your state in one place and avoid creating a new file for every single action and reducer. This talk will cover how to create those ducks!

https://www.youtube.com/watch?v=jr7D4VAzNig
Career changes are hard
Tags: productivity, career, beginners
Published: 2019-06-11 18:11:52

###Changing careers is hard, 
especially when working full-time in an unrelated field.

I thought completing my coursework was a challenge in time-management. I was wrong. Job searching for that first job is the *real* challenge in time-management.

Not only do I need to keep my coding skills up by working on personal projects and doing code problems, I also have to filter through the egregious amount of job postings, write cover letters, and network.

To add to this I have decided to learn Java. My classes were in Ruby and Javascript so learning a strongly-typed language and having built in classes for Trees and whatnot would be nice. More importantly many roles require either an iteration of C, Java, or Python so a basis in one (however small) would be great.


####__Here is the list__
1. job search

2. network

3. practice code challenges
  * on the computer
  * on the whiteboard (aka the sliding glass door in my house)

4. continue working on personal projects

5. learn Java


I need to dedicate aliquots of time so many days a week to make sure that when I am productive that I am focused on what I need to focus on instead of trying to figure out what I should do each day.

####Here is the plan:

When it is slow at work - work on blog posts on coding problems and CS topics

2 days a week (Probably Tuesday/Friday) - Job stuff
2 days a week - do a coding challenges in each language
1 day a week - practice whiteboarding
1 day a week - do nothing/sleep/excessive netflix  *yeay*

Wen I need a break, I do what I really want to do, learn Java and work on my personal projects.


Lets see how this goes.
To cross-post or not to cross-post
Tags: discuss
Published: 2019-06-11 18:07:59

As I will be moving away from Medium for blogging (not that much posts yet, but I'm going to hopefully write more this year) I have to decide where to move to.

I really like dev.to so far, but I'm not sure yet if I should run my own blog (with Gatsby.js) and cross-post to dev.to (and others) or if I should use dev.to as my main blog (and cross-post from there).

What do you think, what is your blogging strategy?
Radix DLT - live scalability test
Tags: blockchain, dlt, node, test
Published: 2019-06-11 18:01:14

---
title: Radix DLT - live scalability test
published: true
description: 
tags: #blockchain #dlt #node #test
---
![](https://thepracticaldev.s3.amazonaws.com/i/1he53ttiox7ni1sqorr8.jpg)

# Hi everyone! 

In case you didn’t know, we are running a scalability test tomorrow, 14:30 #London time, replaying BTC history! Subscribe here to get notified tomorrow  - https://radixdlt.typeform.com/to/x3yotG
Writing a plugin for the Faqtor task runner
Tags: typescript, javascript, node, npm
Published: 2019-06-11 17:50:12

---
title: Writing a plugin for the Faqtor task runner
published: true
description: 
tags: typescript, javascript, nodejs, npm
---

Writing a plugin for Faqtor is a simple and straightforward process. Schematically, it looks like this (TypeScript code):

```typescript
import * as faqtor from “faqtor”; 

export const createFactor = (....arguments): faqtor.IFactor => {

    const run = async (): Promise<Error> => {
        ....do some work here
    }

    return factor.func(run);
}
```

Let us examine this with the example of the faqtor-of-rollup plugin, intended, as the name implies, to use Rollup bundler in our projects. [Continue reading](https://medium.com/@bineev/writing-a-plugin-for-the-faqtor-task-runner-4c8e967546b9)
How to make your bundle size smaller if you're using Lodash with Angular
Tags: typescript, angular
Published: 2019-06-11 17:45:04

If you're using Lodash in your Angular project, you may be importing everything Lodash ships with. If you're only using a few methods from Lodash, then you're shipping to your users unused code. 

```ts
import { keyBy, uniqueId } from 'lodash';
```

By using named imports, you would think that you're only importing the code for `keyBy` and `uniqueId`. Lodash as of this writing, isn't written using ES Modules so your bundler can't tree shake for you.

## Expected Gains

![Chart](https://i.imgur.com/UaW5shD.png)

In our case, we reduced Lodash's footprint by 112.6%. This data was generated from generating a production build and looking at the Gzipped size.

Your reduction will be different. It will depend on how many Lodash methods you are using in your application.

## The Baseline

Let's check our bundle size before making optimizations using `webpack-bundle-analyzer`.

```sh
ng build --stats-json
npx webpack-bundle-analyzer dist/stats.json
```

The last command will start a webserver listening at `http://127.0.0.1:8888/`. There you can view stats for your bundles.

## The Optimization

Install `lodash-es` that exports Lodash functions as ES Modules.

```
npm i lodash-es
npm i -D @types/lodash-es
```

We need to change our named imports to default imports.

```diff
- import { keyBy, uniqueId } from 'lodash';
+ import keyBy from 'lodash/keyBy';
+ import uniqueId from 'lodash/uniqueId';
```

Making these changes will cause Typescript to yell at you because it can't find the typings and modules. To fix that, we can add the following options to out `tsconfig.json`.

```json
{
  "allowSyntheticDefaultImports": true,
  "baseUrl": "./",
  "typeRoots": [
    "node_modules/@types",
    "manual_typings"
  ],
  "paths": {
    "lodash/*": [
      "node_modules/@types/lodash-es/*"
    ],
  },

}
```

Now you should run your tests to make sure nothing is broken. 

---

That's it! One extra step you can take to prevent you or anyone else from importing all of Lodash is by adding a TSLint rule that disallows named imports from Lodash.

```json
"import-blacklist": [true, "lodash"]
```
Livestreaming now - rebuilding thegymnasium.com with gatsby!
Tags: dev, react, showdev, tutorial
Published: 2019-06-11 17:31:27

---
title: Livestreaming now - rebuilding thegymnasium.com with gatsby!
published: true
description: Unscripted livecoding, every week at 1:30pm
tags: dev, react, showdev, tutorial
cover_image: https://thepracticaldev.s3.amazonaws.com/i/yd2v1r3glcc9v6cghxbd.png
---

Hey y'all! I'm about to start my weekly livestream, where I work on features, issues, and updates for [thegymnasium.com](thegymnasium.com).  You can catch me right on our homepage, or if you're a twitch user, hop on over to [@irreverentmike on twitch](https://twitch.tv/irreverentmike).

Looking forward to having you there!

# Update: All done - thanks for tuning in!
Working with your UIViewController and SwiftUI
Tags: swift, swiftui, uikit
Published: 2019-06-11 16:21:24

---
title: Working with your UIViewController and SwiftUI
published: true
description: Quick intro on SwiftUI interoperability with UIKit
tags: #Swift #SwiftUI #UIKit
---

So you started playing with SwiftUI, and you enjoyed it ? Well, me too! The second it came out, I started to imagine all the use cases I'll enjoy implementing my views with this framework.

If like, me you wonder how to use your fresh made SwiftUI views along with your good old UIViewController, this is for you!

To work with you ViewControllers Apple added this magic protocol : `UIViewControllerRepresentable`.
How it works ?
Well, you have two options (at the moment) :

### **Make your UIViewController Representable.**

Just conform to `UIViewControllerRepresentable`. Doing so, you'll have to make you UIViewController `final`, preventing your class from being inherited or being overridden.
This is what it would look like :

```
extension ViewController: UIViewControllerRepresentable {
    public typealias UIViewControllerType = ViewController
    
    public func makeUIViewController(context: UIViewControllerRepresentableContext<ViewController>) -> ViewController {
        return ViewController()
    }
    
    public func updateUIViewController(_ uiViewController: ViewController, context: UIViewControllerRepresentableContext<ViewController>) {
        //
    }
}

```

### **Using a wrapper.**
The other option is to make a sort of ViewControllerWrapper. This is the one I chose to adopt as it does not require the class being `final`.
Just create a Struct that conforms to `UIViewControllerRepresentable`, and return an initialized ViewController in the `makeUIViewController` method :
```
struct ViewControllerWrapper: UIViewControllerRepresentable {
    
    typealias UIViewControllerType = ViewController
    
    
    func makeUIViewController(context: UIViewControllerRepresentableContext<ViewControllerWrapper>) -> ViewControllerWrapper.UIViewControllerType {
        return ViewController()
    }
    
    func updateUIViewController(_ uiViewController: ViewControllerWrapper.UIViewControllerType, context: UIViewControllerRepresentableContext<ViewControllerWrapper>) {
        //
    }
}
```

And simply call it in your SwiftUI views like so :
```
struct MyView : View {
    var body: some View {
        ViewControllerWrapper()
    }
}
```
Using a "wrapper" solution would allow to easily add any parameter to initialize your ViewController.

There you are.
Hope this will help!

Happy coding :)
What is record/replay for?  How is it different than deterministic execution?
Tags: recordreplay, determinism
Published: 2019-06-11 16:03:14

These two things are often confused, even by experts.  [This article](https://www.cloudseal.io/blog/2019-05-06-deterministic-execution-vs-record-and-replay) explains the differences in usage and the benefits offered by these two different but related beasts.
Flaky test root causes + introducing Reproducible Containers
Tags: flakytests, heisenbugs, containers, docker
Published: 2019-06-11 16:01:05

[This blog post](https://www.cloudseal.io/blog/2018-04-06-intro-to-fixing-flaky-tests) is a small manifesto on what causes flaky tests and what we can do about it.
Introduction to Reproducible Builds
Tags: linux, security, builds, compilers
Published: 2019-06-11 15:58:23

[This blog post](https://www.cloudseal.io/blog/2019-05-15-introduction-to-reproducible-builds) explains why it's important for software build systems and compilers to produce the same binary files when given the same source code.  It further goes into a technique for automating reproducible builds, arguing that reproducibility doesn't have to be whack-a-mole, and doesn't need to require patching tool chains.

The [reproducible builds website](http://reproducible-builds.org) is another great resource to learn more about reproducible builds.
Analytics in Ionic 3: Easily Track Page Views with a Custom Decorator
Tags: ionic, cordova, angular
Published: 2019-06-11 15:33:59

*This post was originally posted on [Medium](https://medium.com/prototype-berlin/analytics-in-ionic-3-easily-track-page-views-with-a-custom-decorator-33aa96e5a499).*

If you develop a production Ionic app chances are you also want to integrate some kind of analytics to analyse how your app is being used. There are a lot of different options available like Google Analytics, Firebase or Flurry Analytics, but all they have in common: you have to implement to implement the tracking of your individual views.

I am usually using [@ionic-native/google-analytics](https://ionicframework.com/docs/native/google-analytics) in my apps and since I did not really want to add this.googleAnalytics.trackView(‘SomePage’) manually to every page I tried different approaches to implement automatic view tracking. What I ended up using is a custom decorator I just need to add to any page I want to track.

## How does this decorator look like?

Glad you asked. Like this:

{% gist https://gist.github.com/mahnuh/c82cd1995cff69f53fd3a406a0d3a75c %}

To use it you have to modify your core module as well. If you don’t have a core module you can just do the same in your app.module.ts. (Don’t forget to change line 3 in page-track.decorator.ts in that case!)

Core module example:

{% gist https://gist.github.com/mahnuh/c011f7019346232bdb400a0a38875ec1 %}

And now you just have to import and add the PageTrack() decorator to your page component:

{% gist https://gist.github.com/mahnuh/9a27f469e8ad1f848ee5e852925b8077 %}

That’s it!

## So how does this work?

What the page track decorator basically does is publish a ‘view:enter’ event every time a view is being entered which also passes the page name (the name of the page component to be exact).
I am using the ionViewDidEnter life cycle event of Ionic to achieve that, but you could also use other events depending on when you want the event to be published.

So all I have to do is listen to the ‘view:enter’ event in an analytics service for example and do the actual view tracking there:

{% gist https://gist.github.com/mahnuh/35b55da17a9226d4beb82d74317a1b12 %}

I think this is a pretty neat way to add page tracking to an Ionic app. What do you think?
Webassembly is good but doesn't the thought scare you that sites will now be able to run full binary programs on your devices?
Tags: security, productivity, discuss, javascript
Published: 2019-06-11 15:20:03

Until now, they were able to run interpreted JavaScript. However obfuscated it may be, you can always read it or at least scan its source to ensure its not doing anything wrong.

But webassemblies are just binary blobs or black boxes, so to speak. That code is able to do literally anything to your devices. Aren't you concerned by this fact?
How many of you use the KDE Desktop Environment on Linux? Is it bearable these days?
Tags: linux, discuss, productivity
Published: 2019-06-11 15:06:25

KDE is a highly configurable desktop but always had problems of performance and/or over-engineering or complex design. Are those issues resolved now?

I'd like to hear from those who regularly use a KDE distro like Kubuntu or openSUSE, are you happy with performance, user-friendliness, stability, etc.?
How would you setup a model in Rails to reference the same model type?
Tags: help, rails
Published: 2019-06-11 14:28:56

Let's say I have a model for a thing called "Chapter". I want to be able to reference the next chapter and the previous chapter for each chapter. How would you go about setting this up?

So what I'm looking for is something like this:

```
c = Chapter.first
c.next_chapter
```

`c.next_chapter` should return a chapter object that is the next chapter.
Brewlette - Discover homebrew packages
Tags: script, homebrew
Published: 2019-06-11 14:26:00

---
title: Brewlette - Discover homebrew packages
published: true
description: A simple shell script to discover a random homebrew package
tags: script, homebrew
---

I'm kind of OCD about keeping packges updated, maybe to a fault. One result of this obsession is that I run brew update every morning on my Mac. This command updates the list of packages, even ones you don't use, so after running it you're presented with a list of all sorts of packages. If I'm not in a hurry, I'll usually spot 1 or 2 packages that sound interesting, and might end up installing them. After doing this for a while, I decided that it would be cool if I could just issue a command and get a random package at will. Turns out this is actually easy to do.

Without further ado, I present: brewlette!

```shell
$ brewlette

Try out a random homebrew package!

flvmeta: stable 1.2.1 (bottled), HEAD
Manipulate Adobe flash video files (FLV)
https://www.flvmeta.com/
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/flvmeta.rb
==> Dependencies
Build: cmake ✔
==> Options
--HEAD
	Install HEAD version

Command "brew install flvmeta" copied to clipboard
```

Really, it's just a simple shell script that I put in /usr/local/bin (where brew usually installs packages). It works by picking a random package from the list of formulas that brew caches. One little nifty addition I made is that it copies the brew commmand to install the package to your clipboard. Just ⌘+v and enjoy the new package. For now the script is on a [Github gist](https://gist.github.com/garettmd/7731cfd71cbee6e7c891fc94072d05ab). Feel free to comment/fork if you want to make a contribution. Here's the script:

```bash
#!/usr/bin/env bash
# Utility to suggest a new package to try from Homebrew
# Simply run and it will give you a new package to try out

files=(/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/*)
total=${#files[@]}
rando=$((RANDOM % total))
package=$(basename "${files[rando]}" .rb)
printf "\\nTry out a random homebrew package!\\n\\n"
brew info "${package}"

if [[ $(command -v pbcopy) ]]
then
    echo "brew install ${package}" | pbcopy
    printf "\\nCommand \"brew install %s\" copied to clipboard\\n" "$package"
else
    printf "\\nUse \"brew install %s\" to try it out\\n" "$package"
fi
```
Does this sort of consulting service exist? Does it have a name?
Tags: discuss
Published: 2019-06-11 14:24:38

---
title: Does this sort of consulting service exist? Does it have a name?
published: true
description: Discussing whether a certain high-level consulting service exists — it seems like it should.
tags: discuss
---

A friend of mine is leading the "search" process for a major technology overhaul at his company.  Basically, they are a large enterprise and are going out to seek bids as they look to modernize their website, CMS, mobile apps, etc.

My understanding is that they are going to a number of specialized and more general tech consultancies and dev shops, and are gathering bids through a "scoping process" with each firm.

While I would love to help act as a more informed advocate that could guide them through the process, I have neither the time nor the deep experience required to offer the best possible advice.

Is there a service out there where a client can hire an **independent consultant** to serve as their liaison and advocate through the search process?  This person would not be tasked to perform the project; rather, they would help the client ask the right questions, advise them through major decisions, help de-construct proposals, etc.

If so, does this sort of service have a name?
Top 5 DEV Comments from the Past Week
Tags: bestofdev
Published: 2019-06-11 14:13:35

---
title: Top 5 DEV Comments from the Past Week
published: true
description: Highlighting some of the best DEV comments from the past week.
tags: bestofdev
cover_image: https://res.cloudinary.com/practicaldev/image/fetch/s--7VrAA2ln--/c_imagga_scale,f_auto,fl_progressive,h_420,q_auto,w_1000/https://thepracticaldev.s3.amazonaws.com/i/qmb5wkoeywj06pd7p8ku.png
---

This is a weekly roundup of awesome DEV comments that you may have missed.  You are welcome and encouraged to boost posts and comments yourself using the **[#bestofdev](/t/bestofdev)** tag.

Replying to **[What's the best career advice you can give in ten words or less? ](https://dev.to/ben/what-s-the-best-career-advice-you-can-give-in-ten-words-or-less-53op)** @damcosset hit on something you should keep squarely in mind as you begin your career:
{% devcomment bjf1 %}

In **[What habit do many senior engineers have that juniors should try to avoid adopting?](https://dev.to/ben/what-habit-do-many-senior-engineers-have-that-juniors-should-try-to-avoid-adopting-2dd9)**, @sunnysingh remarks on the temptations of being clever:
{% devcomment bikc %}

Before working on DEV, I never had an appreciation for the importance of naming things.  Working alongside @ben has been very instructive in this regard.  I enjoyed reading @gypsydave5's reply to **[Do you have a process for naming things?](https://dev.to/ben/do-you-have-a-process-for-naming-things-4i49)**:
{% devcomment bgnj %}

**[What is that one tool/stack/framework that you have no interest with despite the popularity?](https://dev.to/briwa/what-is-that-one-tool-stack-framework-that-you-have-no-interest-with-despite-the-popularity-3j3e)**  @cjbrooks12 talks about their lack of interest in one of the most popular frameworks out there:
{% devcomment bigk %}

Finally, @rixcy provides a great list of resources in response to **[Web Developers and Designers, where do you get your raw materials from?](https://dev.to/prahladyeri/web-developers-and-designers-where-do-you-get-your-raw-materials-from-14pk)**:
{% devcomment bg7h %}

See you next week for more great comments ✌
What's a lesson that you can only learn through experience?
Tags: discuss, advice
Published: 2019-06-11 14:12:46

---
title: What's a lesson that you can only learn through experience?
published: true
description: 
tags: discuss, advice
---

Maybe this is just a way I rationalize all the mistakes I've made, but I truly think there are certain lessons in life that you can't really learn from others, you just have to experience a hurdle yourself to understand how to avoid it in the future.

What are some lessons like this in programming/tech?
CSS only: 3D Animated Home Icon Concept
Tags: codepen, css, html, showdev
Published: 2019-06-11 14:02:47

<p>Lately, I've been interested in making a webside having an overkill icons and animations. Maybe, because I read an article about designing with brutalism.</p>

<p>Maybe, if I got a chance to make a design of website, I would like to try the concept of brutalism. Although I want to minimise it a little. Also, an overkill animation, that will actually make the website pleasant, and not annoying.</p>

<p>I haven't used any Javascript codes to make the animation, though, there is a certain library that I want to learn.</p>

<p>This is just a simple concept of 'Home Icon' (It will animate when hovered), for a 3D-based user interface, and then, there will be a left or right icon that will go to other navigation, like 'About', 'Contact Me', etc. So maybe, it's good for menu item.</p>

{% codepen https://codepen.io/takaneichinose/pen/ZdzLZG %}