teleren/devto huggingface dataset:
🇫🇷 Introduction à TDD en Swift (Partie 1) - 7 étapes essentielles
Tags: swift, ios, tdd
Published: 2019-12-11 13:20:01

---
title: 🇫🇷 Introduction à TDD en Swift (Partie 1) - 7 étapes essentielles
cover_image: https://academie.ryfacto.fr/images/2019/12/intro-tdd.jpg
published: true
date: 2019-12-11 00:00:00 UTC
tags: swift, ios, tdd
canonical_url: https://academie.ryfacto.fr/advanced-ios-craft/intro-tdd-swift-1-7-etapes.html
---

Cet article fait partie de la série _"Introduction à TDD en Swift"_

- **Introduction à TDD en Swift (Partie 1) - 7 étapes essentielles**
- [Introduction à TDD en Swift (Partie 2) - Vive le typage et la généralisation](https://academie.ryfacto.fr/advanced-ios-craft/intro-tdd-swift-2-typage-et-generalisation.html)
- [Introduction à TDD en Swift (Partie 3) - Une bonne documentation](https://academie.ryfacto.fr/advanced-ios-craft/intro-tdd-swift-3-une-bonne-documentation)

Dans [l’article précédent](construire-une-architecture-emergente), je te parlais de l’importance des tests pour faire émerger l’architecture.

J’évoquais aussi le fait que [TDD permet d’être plus productif](construire-une-architecture-emergente#automatiser-les-tests) en combattant l’idée reçue “Écrire des tests revient à écrire plus de code, donc c’est plus lent”.

> Tu m’as convaincu que TDD était LA pratique à apprendre. Mais comment je fais concrètement ?

Je vais te le montrer à travers ce tutoriel justement !

Nous allons entrer dans le vif du sujet avec une approche par l’exemple comme l’a fait Kent Beck (le papa de TDD) le 8 novembre 2002 (17 ans déjà !) lorsqu’il a publié son livre [“Test-Driven Development by Example”](https://amzn.to/2l8qHa3).

[Lire la suite...](https://academie.ryfacto.fr/advanced-ios-craft/intro-tdd-swift-1-7-etapes.html "Introduction à TDD en Swift (Partie 1) - 7 étapes essentielles")
Chaining SSH tunnels
Tags: linux, ssh
Published: 2019-12-10 22:56:49

---
title: Chaining SSH tunnels
published: true
description: How to create a chain of SSH tunnels into hidden servers.
tags: linux, ssh
---

So here's my scenario:

- Machine A has SSH exposed to the internet
- Machine B is on the same LAN as Machine A, but is not exposed to the internet
- Machine A has SSH access to Machine B via the LAN

Now let's say I'm outside the network and I want to have direct access to a port on Machine B (maybe I need to `rsync` something using the SSH port, or maybe I want to forward a database port).  For this example, we'll assume we want to forward SSH port 22.


## Port forward Machine B to Machine A

First, let's make Machine B's SSH port available from Machine A

```bash
ssh machine_a # to open a shell on Machine A
ssh -L 2222:localhost:22 machine_b # to open a tunnel from Machine B to Machine A
```

(Leave this shell open and start a new one for the next step)


## Port forward Machine A to my computer

Next, let's forward the port we opened to our local machine

```bash
ssh -L 2222:localhost:2222 machine_a
```

## Use the port

Now you can use the SSH port to directly access Machine B:

```bash
ssh -p2222 localhost # to open a shell on Machine B
```

or SCP

```bash
scp -P2222 /path/to/item localhost:/remote/path
```

or `rsync`

```bash
rsync -e 'ssh -p2222' /path/to/item localhost:/remote/path
```

Hope this helps!

---

If you found this helpful, follow me here on dev.to or on [Twitter @connorbode](https://twitter.com/connorbode) for more on Linux, coding, etc.
Top 5 DEV Comments from the Past Week
Tags: bestofdev
Published: 2019-12-10 22:43:26

---
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.

@xbluelight offered a thorough list in response to **[Which movies or series about programming would you recommend?](https://dev.to/devmount/which-movies-or-series-about-programming-would-you-recommend-439a)**:
{% devcomment igin %}

Replying to **[What conventional wisdom in software is wrong?](https://dev.to/ben/what-conventional-wisdom-in-software-is-wrong-3c7f)**, @katafrakt points out one principle that can oftentimes be ignored:
{% devcomment igla %}

@cristinaruth shares their perspective into **[What helps build developer confidence?](https://dev.to/ben/what-helps-build-developer-confidence-k3h)**:
{% devcomment ifla %}

@nitya offers some awesome guidance on how to set your team up for effective distributed and asynchronous work in the **[How does your company deal with massive time zone differences between teammates?](https://dev.to/jess/how-does-your-company-deal-with-massive-time-zone-differences-between-teammates-216c)** thread:
{% devcomment ifp8 %}

@evanplaice shares a helpful reply to **[What is the difference between a Library vs A Framework?](https://dev.to/nshattuck/what-is-the-difference-between-a-library-vs-a-framework-16ik)**:
{% devcomment ii07 %}

See you next week for more great comments ✌
VAULT AT THE CENTER - using a python cert manager.
Tags: hashicorp, vault, venafi, pki
Published: 2019-12-10 21:12:51



Certificate Management needs. 

- Create and build vault backed by consul with TLS. 
- Enable Vault PKI Secrets Engine. 
- Use vault for client TLS auth methods. 




1. Creating Vault and Consul using TLS - we used Venafi to create the ca-bundle, key and server cert , wrapped in python so we could install with pip and pull certs as needed. 

2. We used a CA and private key obtained from CyberArc(storage) using the python certificate manager to enable the PKI secrets engine in Vault.

3. Once VAULT's PKI secrets engine was enabled, it could now be used to fetch certificates for application authentication. 


![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/o8ye71opg8sdv158qo5e.png)

This is for an on prem solution(not cloud) so we used ansible to provision consul and vault and pushing the certificate for TLS to the servers and configuring consul.conf and vault.conf.

From there we used cert manager to pull CA and private key from CyberArc and configure vault pki secrets engine(using Terraform vault provider). 

For applications it was easy to request a cert from vault with the cert manger and we choose python because it could easy be turned into a pip install from git and all OS can run it successfully and allowing all applications to get the authentication they need.
Entrepreneurs meet Advisors: A Proposal
Tags: startup, mentoring, equity
Published: 2019-12-10 21:05:17

Entrepreneurs with underrepresented identities are much less likely to have access to the capital, resources and, network to grow their businesses. On the other side are seasoned professionals who know how to grow businesses. Sometimes these two find each other through a mentorship program or a networking event, but it’s rare. 

Every day I talk to engineers, data scientists and product managers that have never heard of advisory stock or realize how much priceless knowledge they have. I would like to fix that. I would like to create mutually beneficial partnerships where both the advisor and the entrepreneur are invested in the business. It is up to them how much time/stock they want to trade. 

This is an alternative to an advisor creating free content or mentoring, or an entrepreneur needing the funding to pay for skills upfront. Advisors can also use this as a way to build their skills and resume for senior advancement into the C suite and boards. 

If you are interested in either role, I am starting with a simple form to gauge interest. If I see a match, I’ll send an email to both parties and you’ll take it from there.


[I want to be an advisor!](https://michelle004935.typeform.com/to/TsLEcg
)


[I want advice!](https://michelle004935.typeform.com/to/uWqivC
)
Laptops... How much computing power does a dev *really* need?
Tags: productivity, discuss, recommendation
Published: 2019-12-10 20:13:45

Yesterday, I sought the community's recommendation for a Wunderlist replacement. {% post /vgrovestine/to-do-list-app-recommendations-2ac6 %}

Today, there's another dilemma on my mind: How much "oomph" (computing power) does a developer honestly need?

My own laptop--a Thinkpad T520--is getting a bit long in the tooth. Sure, it still works for daily tasks thanks to SSD and RAM upgrades; however, I'd like to have something that's a bit more portable, with a FHD screen, and a battery that I can squeeze more than 4 hours out of, etc.

So, it's laptop shopping time!

I'm conflicted, however. The Thinkpad T-series is my gold standard, but do I really *need* that much machine? For example, my wife picked up an Acer Spin 1 not long ago--a spiffy little aluminium rig with ~6 hr battery, 11" FHD touch screen, 64 Gig eMMC storage (but open M2 slot), and expandable RAM, but only a Pentium Silver N4200 processor. Honestly, it's a rather nice ultra-portable that cost less than $400 CAD.

BUT... My instinct says "Pentium processor. Yuck! Too slow." 

Am I being fair?

Obviously, anyone working with graphics or video, virtualization, or crunching data will want at least a modern, mid-range processor. Yet what about those of us who spend most of our time in VS Code with a few browser windows open?

What do *you* feel is the baseline for dev laptop specs these days?
Learn to code and get hired for free in <6 months
Tags: beginners, webdev, career, tutorial
Published: 2019-12-10 20:12:03

If you've ever considered learning to code but didn't know where to start, were overwhelmed by the plethora of resources and tutorials out there, or felt like you couldn't afford it... well good news, this post changes all of that.

{% twitter 1204385908675530752 %}

Andrei has created a comprehensive step by step guide that you could use (and hundreds, if not thousands now have) to __learn to code and get hired using 100% free resources in under 6 months.__

Make 2020 the year you finally learn to code 😃🚀!

[Learn to code in 2020, get hired, and have fun along the way](https://zerotomastery.io/blog/learn-to-code-in-2020-get-hired-and-have-fun-along-the-way/?utm_source=dev.to&utm_medium=ztmpost)

__Warning:__ when I say comprehensive, I mean it. This post is about a 30 minute read and has literally every link, resource, tip you could need, broken down from Month 1 to Month 6 so you'll likely want to bookmark it!

![Learn to Code 2020](https://images.ctfassets.net/aq13lwl6616q/19l6672xu1hDiXnEy1CCfu/ee9e5ac102550b09e69c6d43a7d9733a/Complete_Web_Developer_Zero_to_Mastery.png?w=780&h=439&q=50&fm=webp)
My first few months coding in Washington
Tags: beginners
Published: 2019-12-10 20:06:00

I am relatively new to programing and the Greater Seattle Area. It has been an interesting experience to learn programing and a local culture simultaneously. While this area is drastically different than New York City, where I was raised, I do adore the animals, green, mountains, and water.

With respect to programming, I only have positive things to say. The feeling of constantly learning has never been more apparent than since I learned to code; I enjoy the challenge. More than learning itself, programing has increased my ability to learn.

When I argue a topic, go for a hike, or nearly anything else, I see how skills further developed by programming  play a role: logic, clarity, simplicity in expression.
These skills have helped me become a better thinker by seeing the flawed logic in others and in myself.
The longest time you have spent with active coding
Tags: discuss
Published: 2019-12-10 20:03:39

##What was the longest period of time you have spent with **active** coding so far?

For me, it was around 13 hours. It wasn't because of job, or deadline or anything, I just simply spent pretty much the whole day with coding. One day I woke up around 6 am, started coding at 7 am, and I didn't stop until 8 pm. I just felt like doing it, I had so many ideas I wanted to accomplish, and I had nothing else to do the whole day, so I had no reason to stop. Of course I took a few breaks, for example to eat, but they weren't longer than 15 minutes. I have done this a few times actually.

And actually I didn't feel bored or tired of it at all, I enjoyed doing it.

How about you?
AppSeed App Generator - Listed on Product Hunt 
Tags: appseed, opensource
Published: 2019-12-10 19:45:59

---
title: AppSeed App Generator - Listed on Product Hunt 
published: true
description: 20+ open-source admin panels built with automation tools are listed on PH
tags: appseed, opensource 
cover_image: https://raw.githubusercontent.com/app-generator/static/master/products/flask-dashboard-material-dark-intro.gif
---

Hello Coders, 

**AppSeed**, the platform built by two developers (one is me) somewhere in Romania, and launched in january 2019 is now [listed on ProductHunt](https://www.producthunt.com/posts/appseed-web-app-generator). 2019 was a great year for us, and I will list a few numbers here: 

- 1100+ registered developers
- 3400+ full-stack generated web apps
- 150 open-source generated in different patterns and programming languages published on Github. For more information please access this popular article published here on **Dev**: [How I’ve built 100+ open-source apps with automation tools](https://dev.to/sm0ke/100-open-source-apps-built-with-automation-tools-3jmj)


We are celebrating this moment with a bundle with 20+ free admin dashboards coded on top of some beautiful UI kits. 

> Links

- [AppSeed on ProductHunt](https://www.producthunt.com/posts/appseed-web-app-generator)
- [The Open-Source Admin Dashboards Bundle](https://appseed.us/admin-dashboards/open-source) - index published on AppSeed platform
- [Open-Source Admin Dashboards Bundle](https://github.com/app-generator/admin-dashboards) - index published on Github 


> Thank you!
Having Problems CORS with the Dev.to API
Tags: help, restful, api, cors
Published: 2019-12-10 19:29:04

---
title: Having Problems CORS with the Dev.to API
published: true
tags: help, RESTful, API, CORS
---

I'm trying to use the DEV.to API via a request from my personal webpage using JavaScript, and the browser is constantly blocking the request. I believe the problem is that with the CORS security that the certificate is not considered valid by the browser. This is specifically because the certificate is not issued to "dev.to" but to the actual server under the "fastly.net" domain. Will this continue, or will there be an eventual valid certificate for the "dev.to" domain to allow use without CORS violations in a browser?
Developer's Blog
Tags: webdev, node, 100daysofcode, javascript
Published: 2019-12-10 19:26:51

#100DaysOfCode D1-4 

Spent time building up a blog for Developer's called Dev's Blog, built in semantic-ui to enhance UI and UX capability. It has CRUD functionalities. 

Check-out  folks: https://github.com/abhisheknaiidu/Dev-s-Blog

#Nodejs  #learntocode  #javascript #web #webdev #code #301DaysOfCode #semantic #ui #ux
A Steady revenue stream from open source projects?
Tags: opensource, monetization
Published: 2019-12-10 19:17:57

We all know that open-source developers put there blood sweat and tears into their projects, most of the time with no compensation at all.
Those who try to use donations as a way to get compensated usually find out that it's not really working.
Companies and organizations use those projects for commercial use and make a profit while the owner gets nothing, except demands to keep maintaining his code and fix bugs and so on... 
 
A new startup called xs:code (disclaimer - I work there) is trying to solve this problem by giving developers the tools to start monetizing their code while keeping it open source.
The platform is launched today for beta and I'm inviting you guys to take a look and share with me your thoughts and feedback.

you can check out our platform here:
https://xscode.com/

Thanks,
Elad
Using a Switch Component in React Router
Tags: react
Published: 2019-12-10 19:15:34

Routing in React can be a little difficult for those who are new to React. It is pretty different from the routing system used in Ruby on Rails because it is now done completely on the client. The client is responsible for all routing in React. 

When working with routing in React, I came upon the `<Switch />` component and noticed how people were using that in place of `<Router /> `. This made me delve a little further into the differences between the two and why using `<Switch />` can be very helpful and the preferred component between the two. 

`<Router />` can include many nested routes that render inclusively. And what does "render inclusively" mean? It just means that whenever a route's path matches the url path, the router will render the route's component. Let's take a look at the below example.

```react 
   ReactDOM.render((
       <Router>
         <Route path="/" component={Home} />
         <Route path="/login" component={Login} />
         <Route path="/explore" component={Explore} />
       </Router>),
       document.getElementById('root')
   );

```

In this example, when a user goes the url path `/`, the `Home`,`Login`, and `Explore` components will all render. This is because all three routes include `/` in their paths. The `<Route />` component is handy in this way in that it can render certain components all the time, such as the header, nav bar, and other components that should appear on every page of a website. 

One way to ensure that routes don't render inclusively is by adding "exact paths" to routes. 

```react 
   ReactDOM.render((
       <Router>
         <Route path="/" component={Home} />
         <Route exact path="/login" component={Login} />
         <Route path="/explore" component={Explore} />
       </Router>),
       document.getElementById('root')
   );

```

Above, I added an exact path to the `login` route. So when we visit `/login`, only the `Login` component will now render on the page.

So what exactly is the advantage of using `<Switch />`? The `<Switch />` component will only render the first route that matches/includes the path. Once it finds the first route that matches the path, it will not look for any other matches. Not only that, it allows for nested routes to work properly, which is something that `<Router />` will not be able to handle.

```react 
   ReactDOM.render((
       <Switch>
         <Route exact path="/" component={Home} />
         <Route path="/login" component={Login} />
         <Route path="/explore" component={Explore} />
       </Switch>),
       document.getElementById('root')
   );

```
In the example above, when the user goes to `/login`, only the `Login` component will now be rendered. It is also important to note that an exact path can and should still be utilized for routes that are inside a `<Switch />`. An exact path for a route that is inside a `<Switch />` makes sure that the route matches exactly the path that is specified. For example, without the exact path for `/` above, a user who goes to `/login` would find the `Home` component rendered on the web page.
CSS Box-Model
Tags: css, layout, frontend, design
Published: 2019-12-10 18:58:36

"Everything in CSS is a Box" 
Any element in a webpage is a box. Go ahead and inspect any html element from a webpage, go to developer tools, and you will find a graphical represantion of selected box.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/6p4pnnovil8cm02g72r4.png) 
When I say box it means that it has content, padding, border and margin.

A box is made up of 4 properties.
1. Content
2. Padding
3. Border
4. Margin.

Content can be a text or other element(nested box).
Padding is the region between content and box border.
Border is element outline.
Margin is region outside of element border. Technically margins are not part of element becuase they are out of elements border.

If all the things are box then how do  have so many different elements in a webpage, The reason is each box has diffent properties for content, padding, border and margin. So html elements like paragraphs, Heading1, Buttons etc. are nothing but box elements with some default box properties.

A heading element is a simple box element with high font-size property and some margins. Look at below h1 properties.

h1 {
    display: block;
    font-size: 2em;
    margin-block-start: 0.67em;
    margin-block-end: 0.67em;
    margin-inline-start: 0px;
    margin-inline-end: 0px;
    font-weight: bold;
}


You can check below pen to see how to create a custom html's default button element
https://codepen.io/iamharish/pen/vYEGyNv.



Please watch below video for better understading.
https://www.youtube.com/watch?v=rIO5326FgPE
What dated/non-mainstream tools you think deserve more attention?
Tags: discuss, webdev
Published: 2019-12-10 18:45:03

In this modern world of a new IDE, framework, programming language every year — what tools you think were neglected and are worth wider adoption?

My personal favorites:

- **console-based apps: [vim](https://www.vim.org/), [tmux](https://github.com/tmux/tmux/wiki), [midnight commander](https://midnight-commander.org/)**
_iOS Finder sucks so much that you can't even remove it from the dock panel._
A [screenshot of all 3](https://thepracticaldev.s3.amazonaws.com/i/08342b1qa2qrqjrmxqzx.png" style="height:300px) together — all supported 🙌, <abbr title="which means you have to spend a lot of time to setup">not mainstream</abbr>

- **drag-and-drop programming user interfaces**
_[remember Delphi days?](https://1.bp.blogspot.com/-ByAHjz6v318/WE6S-c_AsmI/AAAAAAAACDg/np9bQldBxc81ZW7Zo1SOiuIk4lPcqrQmwCLcB/s1600/borland%2Bdelphi.PNG)_
With all these cool front-end frameworks we forgot how to drag-n-drop a button 😕

- **tile window managers**
_[i3](https://i3wm.org/) screenshot [example](https://i3wm.org/screenshots/#/screenshots/i3-1.png)_
Again, iOS window manager — 🤕, envy Linux users 🙂

Share yours in the comments!
THE "SOCK LAUNDRY" SOLUTION
Tags: javascript, node
Published: 2019-12-10 18:44:12





As simple as it may sound ,sock laundry can be a pain in the ass.
knowing what to do first ,when to do it ,and when next to make a move.
This laundry takes a lot of thinking or maybe not so much,take a deep breath ,relax you are about to do this .
In this sock Laundry Solution,a function is required to take three arguments 
 1. An array of Cleans socks
 2. An array of Dirty socks
 3. The maximum number of washes 

Pretty clear right ?
let's start with a case where number of washes is equal to zero ,this means that the dirty socks will not be washed.In this case we return only the possible number of pairs in the clean socks array.
 
##A CASE WHERE NUMBER OF WASHES IS EQUAL TO 0

The first step is to check for the possible number of washes 
if the number of washes is less than 1,pair the array of clean socks and return count,which is equal is number of pairs .

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/vbu7uypmnkxxcxblwj7v.png)
 
##A CASE WHERE NUMBER OF WASHES IS GREATER THAN DIRTYSOCKS.length
if the number of washes is greater than 0.check if the number of washes is greater than the length of the **DIRTYSOCKS** array.
In this case where number of washes is greater than the length of the dirty sock array,we pair the clean and dirty socks array and return the combined pair .


![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/pucnmytnszbqd7zn3pwn.png)

##GET PAIRS FROM THE ARRAYS
Create a function to get the number of paired and unpaired socks.
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/yt1na7y8t2a99iy51537.png)

##CREATE FUNCTION TO WASH DIRTY SOCKS
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/rwxdk9m5voeaaq29giuj.png)

##CHECK FOR UMATCHED CLEAN SOCKS AGAINST THE DIRTY SOCKS
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/rxnakg9lwco58aehacyq.png)

***The Sock Laundry Solution requires two functions*** 
>One that returns the number of pairs in a given array
>and another that takes two arrays and checks for matching pairs while it increments the number of washes.

*Easy right ?*
##Now let's do some laundry !