teleren/devto huggingface dataset:
Piping in Python
Published: 2020-07-28 13:18:30

---
title: Piping in Python
published: true
description: 
tags: 
//cover_image: https://direct_url_to_image.jpg
---

Piping of shell likes `cat foo | sort | uniq | wc -l` is very simple, clear and fun.
Python gives us the way to implement this piping idiom by overriding special method.

All you needs are only the special method `__ror__` like below.
 
```python
class Pipable:
    def __init__(self, cmd):
        if callable(cmd):
            self.cmd = cmd
        else:
            raise ValueError

    def __ror__(self, other):
        return self.cmd(other)

    def __call__(self, *args):
        return self.cmd(*args)
```


OK, use it.

```python
import os


def read_file(f):
    with open(f) as fd:
        return fd.read()

p1 = Pipable(read_file)
p2 = Pipable(lambda x: x.upper())
p3 = Pipable(lambda x: '-'.join(x))

f = 'foo.txt'
with open(f, 'w') as fd:
    fd.write('meow')
assert p1(f) == 'meow'
assert p1(f) | p2 == 'MEOW'
assert p1(f) | p2 | p3 == 'M-E-O-W'
os.remove(f)
```

Now you have the simple magic of function composition in Python!

You can override other operation symbols via corresponded special methods, so let's explore there.
Getting started in Open source
Tags: opensource
Published: 2020-07-28 13:36:56

Open source is the new future where most if not all software is open to the public. This is not only safer but also grows faster (if you an ecosystem), but getting into open source can be hard and it might as well push you away. Here is how you can get into open source. 

##Find it 
I am pretty sure every programmer has a programming language that they are good at (Some people have many good languages in had). Identify those languages and find small but still big project. I am good at python and JavaScript, so at I will find anything related to python or/and JavaScript.

##Make changes 
Now that you have got the project make small changes. It does not have to be a huge big UI update for something. Make changes like remove bugs or remove unnecessary lines of code. The more you do this the more you are familiarised with working on an open source system. And the better you will know they file structure of the project that you are working on. 

##Get in 
Get into the community, for example if you'r working on Linux  talk to other Linux kernel developers take advise write articles about your experience. 

Now it's up to you what to do next. You are familiarised with they way open source works. You know programming and you are in the community good start.
Daily Challenge #274 - Aerial Firefighting
Tags: challenge
Published: 2020-07-28 13:27:01

---
title: Daily Challenge #274 - Aerial Firefighting
published: true
series: Daily Challenge
description: You are an aerial firefighter. Drop waterbombs on the fire to put it out.
tags: challenge
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/2cge1gmb7iso2hxye30x.png
---
You are an aerial firefighter (someone who drops water on fires from above in order to extinguish them) and your goal is to work out the minimum amount of bombs you need to drop in order to fully extinguish the fire (the fire department has budgeting concerns and you can't just be dropping tons of bombs, they need that money for the annual Christmas party).

The given string is a 2D plane of random length consisting of two characters:
`x representing fire`
`Y representing buildings`

Water that you drop cannot go through buildings and therefore individual sections of fire must be addressed separately. Your water bombs can only extinguish contiguous sections of fire up to a width (parameter w). You must return the minimum number of waterbombs it would take to extinguish the fire in the string.

Note: all inputs will be valid.

**Examples**
"xxYxx" and w = 3      -->  2 waterbombs needed
"xxYxx" and w = 1      -->  4
"xxxxYxYx" and w = 5   -->  3
"xxxxxYxYx" and w = 2  -->  5

**Tests**
`waterbombs("xxxxYxYx", 4)`
`waterbombs("xxYxx", 3)`

Good luck!

***
_This [challenge](https://www.codewars.com/kata/5d10d53a4b67bb00211ca8af) comes from coderors on CodeWars. Thank you to [CodeWars](<https://codewars.com/>), who has licensed redistribution of this challenge under the [2-Clause BSD License](<https://opensource.org/licenses/BSD-2-Clause>)!_

_Want to propose a challenge idea for a future post?  Email **yo+challenge@dev.to** with your suggestions!_
What technologies does the Amazon's Android Shopping App use?
Tags: discuss, android, webdev, reactnative
Published: 2020-07-28 13:23:23

I know that Amazon's Android App is a hybrid app but I wanted to know what exact technology it is built using. Just outta curiosity 🕵️, I tried running a web search but most of the posts on the web are about Amazon's Fire OS. Does anyone know what the Amazon shopping app is built on?
Difference between the RxJs operators: zip, forkedJoin, combineLatest, and withLatestFrom
Tags: javascript, reactive, rxjs
Published: 2020-07-28 13:12:40

## sometimes, the usage of these four RxJs operators is a bit tricky, as they work almost the same way by merging different `Observables` inputs into only one output, to understand easily the difference between 'em all I've prepared some examples that show the difference of the outputs.*If you have questions, suggestions or something not clear, feel free to comment with your question and I'll be glad to answer it.*  

* ZIP
* forkedJoin
* combineLatest
* withLatestFrom
```typescript
type Shape = '♠️' | '❤';
type Card = '👑' | '1️⃣';
const shapes$ = new Subject<Shape>();
const cards$ = new Subject<Card>();
```
1. `ZIP` Each time the zipped observables (or subjects) emit all of their values, the ZIP operator emits one time an array of all observables values.
```typescript
// zip the 2 observables:
zip(shapes$, cards$).subscribe(console.log);
// then next data as:
shapes$.next('♠️');
cards$.next('👑');
shapes$.next('❤');
cards$.next('1️⃣');
shapes$.next('♠️');
cards$.next('👑');
shapes$.next('❤');
cards$.next('1️⃣');
// no need to complete the observables, it will output:
["♠️", "👑"]
["❤", "1️⃣"]
["♠️", "👑"]
["❤", "1️⃣"]
```

2. `forkedJoin` emits an array of the last values emitted by the observables (or the subjects) being forkJoined only after completing the stream of the observables (or the subjects).
```typescript
// forkJoin the 2 observables:
forkJoin(shapes$, cards$).subscribe(console.log);
// then next data as:
shapes$.next('♠️');
cards$.next('👑');
shapes$.next('❤');
cards$.next('1️⃣');
shapes$.next('♠️');
cards$.next('👑');
shapes$.next('❤');
cards$.next('1️⃣');
// emits only when observable completed:
shapes$.complete();
cards$.complete();
// outputs:
["❤", "1️⃣"]
```

3. `combineLatest` each time an observable (or a subject) emits a new value the combineLatest operator emits a new array of values (from all the observables passed to the combineLatest operator) containing the new value.
```typescript
// combineLatest the 2 observables:
combineLatest(shapes$, cards$).subscribe(console.log);
// then next data as:
shapes$.next('♠️');
cards$.next('👑');
shapes$.next('❤');
cards$.next('1️⃣');
shapes$.next('♠️');
cards$.next('👑');
shapes$.next('❤');
cards$.next('1️⃣');
// no need to complete the observables, it will output:
["♠️", "👑"]
["❤", "👑"]
["❤", "1️⃣"]
["♠️", "1️⃣"]
["♠️", "👑"]
["❤", "👑"]
["❤", "1️⃣"]
```

4. `withLatestFrom` emits an array of both values, the main observable value, and the other observable last value being withLatestFromed.
```typescript
// withLatestFrom the 2 observables:
shapes$.pipe(withLatestFrom(cards$)).subscribe(console.log);
// then next data as:
shapes$.next('♠️');
cards$.next('👑');
shapes$.next('❤');
cards$.next('1️⃣');
shapes$.next('♠️');
cards$.next('👑');
shapes$.next('❤');
cards$.next('1️⃣');
// no need to complete the observables, it will output:
["❤", "👑"]
["♠️", "1️⃣"]
["❤", "👑"]
```
#### In case you want to play with these operators [stackblitz here](https://stackblitz.com/edit/rxjs-zip-combinelatest-forkjoin-withlatestfrom).
Top SaaS Products for Small Businesses in 2020
Tags: showdev, webdev, saas, productivity
Published: 2020-07-28 13:04:33

There are SaaS tools for fundamental business functions of accounting, content curation, customer relationship management, document collaboration, email marketing, knowledge management, productivity, etc.

We have listed the [top SaaS products](https://blog.bit.ai/saas-products/) we have found to be useful for small and medium businesses to enable smooth functioning:

##Bit.ai – Document Collaboration Tool
it is a new-age cloud-based workspace and document collaboration SaaS platform. It helps teams work together while they simultaneously share information across applications, like a virtual office!

Bit lets you create workspaces for any group, project, team, or anything else. Workspaces can be used to create, collaborate, and organize all of your business’s work in one place.

Within a workspace, you can create interactive live documents, dynamic notes, documents, company wikis, knowledge bases, instruction manuals, one-pager, client deliverables, training manuals, process documentation, while integrating across multiple apps.

##Elink – Content Curation Tool
elink.io is an amazing all-in-one content curation & content marketing SaaS tool that helps marketers and content creators publish email newsletters, web pages, and embed web content by just adding web links! Turn a collection of web links (articles, videos, etc.) into visual content in seconds.

You can easily convert weblink collections to email newsletters and export to MailChimp, Gmail & all third-party email providers that allow HTML code (including Campaign Monitor, MadMimi, Active Campaign, etc.)

You can track content your performance and engagement levels on the content created and shared.

##Slack – Communication SaaS Tool
Slack is the most popular communication SaaS tool for remote teams and brings all your communication needs in one place. Users create message groups called ‘channels’.

Channels can be created for a team, project, location, client, or anything else! In these channels, the entire team can have conversations, collaborate, and share files. File sharing is super easy with Slack, as it integrates with over 2000+ apps. No wonder it’s considered as a savior from those long email chains!

##Buffer – Social Media Management SaaS Software
If you have multiple social media channels to manage, working on them separately can be tiring. A well-known social media management SaaS tool, Buffer allows you to post to multiple social media accounts from a single Buffer account.

You can schedule posts, track content performance, and manage all your profiles in one place. Buffer has smart analytics that can determine which content is performing well and would recommend appropriate strategies to improve your content performance.
Add Custom Fonts in React Native 0.63 for iOS and android
Tags: reactnative, tutorial, beginners, javascript
Published: 2020-07-28 13:02:05

Adding Custom Fonts to React Native App is quite easy and only needs a few steps. I am writing down the steps I did to add custom fonts to my app.

###Download Google Font
First, you need to download your desired fonts from [google fonts](https://fonts.google.com/).

###Add fonts to app folder
Create a `fonts` folder in your src/assets folder on root directory level and paste downloaded fonts files in it.

![fonts folder](https://dev-to-uploads.s3.amazonaws.com/i/7ndqamyoeke4ewmkw9mo.png)

###Export fonts
Now create a file named `react-native.config.js` at the root of your app and add the path of fonts folder like this 
```javascript
module.exports = {
   assets: ['./src/assets/fonts'],
};
```

###Link assets to project
After adding this, run link command in your project folder.
```
npx react-native link
```
Link command will add font files into assets folder in the android folder of your app and to info.plist file in the iOS folder.

###Add resources to target
Now at this point, your custom fonts will start working for the android app but you need to do one last step to make it work for iOS.

Go to the desired target of your app in Xcode, select the `Build Phases` tab, and add font files in the "Copy Bundle Resources" tab as shown below.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/wlh623s8bmo5wwa6dbdz.png)

And you are done!  :tada: :confetti_ball:  
You are welcome to share your thoughts in comments
GraphAV - A graph algorithms visualizer built using React and Typescript
Tags: react, typescript, webdev, opensource
Published: 2020-07-28 12:51:46

#Aim of the project
![GraphAV Logo](https://raw.githubusercontent.com/KarimElghamry/GraphAV/master/screenshots/GraphAV.png)

GraphAV is an **open source** graph algorithms visualizer built 💯 **from scratch** using React and Typescript. It strives to facilitate the learning process of anyone who's struggling to grasp the concept of a certain graph algorithm. It can also be used as a tool by teachers to easily introduce a new algorithm to their students 👨‍🎓👩‍🎓.

###links
website: https://karimelghamry.github.io/GraphAV/
Github repo: https://github.com/KarimElghamry/GraphAV

GraphAV does not include any UI dependencies in its code other than styled-components. 🎉🎉
 
**NOTE: touch screen support is yet to be implemented. Use a PC/Laptop for a better experience.**

Show some ❤️ and ⭐ the repo to support the project 😁
#Features
**✔️** Light/Dark themes

**✔️** Add, move and delete nodes

**✔️** Directed/Undirected edges

**✔️** Unweighted edges

**✔️** Control visualization speed

**✔️** Control canvas zoom percentage

**✔️** Shortest paths and predecessor node information

**✔️** Visited nodes/edges animations

**🚧** Weighted edges (to be implemented)

**🚧** Touch screen support (to be implemented)

**🚧** Save/share graphs (to be implemented)

#Available Algorithms

**✔️** DFS - Depth First Search

**✔️** DLS - Depth Limited Search

**✔️** IDDFS - Iterative Deepening Depth First Search

**✔️** BFS - Breadth First Search (with shortest paths calculations)

**✔️** Dijkstra (with shortest paths calculations)

**🚧** Bellman-Ford (to be implemented)

**🚧** Floyd-Warshall (to be implemented)

**🚧** A\* (to be implemented)

**🚧** Kosaraju (to be implemented)

**🚧** Tarjan's Strongly Connected Components\* (to be implemented)

#Demo

{% youtube 3hMRy2jO9Cw %}
Build More Reliable Distributed Systems By Breaking Them With Jepsen - Episode 143
Published: 2020-07-28 12:49:04

<p>A majority of the scalable data processing platforms that we rely on are built as distributed systems. This brings with it a vast number of subtle ways that errors can creep in. Kyle Kingsbury created the Jepsen framework for testing the guarantees of distributed data processing systems and identifying when and why they break. In this episode he shares his approach to testing complex systems, the common challenges that are faced by engineers who build them, and why it is important to understand their limitations. This was a great look at some of the underlying principles that power your mission critical workloads.</p><p><a href='https://www.dataengineeringpodcast.com/jepsen-distributed-systems-testing-episode-143/'>Listen Now!</a></p>
Identify Rabbit Holes Early
Published: 2020-07-28 12:45:11

**Rabbit Holes**

Rabbit holes, also known as Coding Safaris, have these attributes:

- They started out with a good design
- They ran into some issues
- Those solutions caused more issues
- They have a lot of indirect code to get to the solution.
- It feels like a mess, it is a mess, and it gets uglier by the day.
- We are inventing ways to get things done.
- The Scrum master asks us every day at the stand up "What's the status" or "Do you need any help?" and we reply "No issues, we're getting there".
- Weeks pass instead of days

The truth is that there's almost no problem we can't solve. It's just a matter of time. 

The questions however, should always be:

**Spotless Code**

- Is the code "spotlessly" clean
- No more than one layer of indirection, e.g. GetData calls.
- The data easily binds to our templates and has hooks to determine events to easily access records.
- Is the code bullet proof. 
- Is the code easily readable for future programmers?

As cute as the Schnauzer is; escaping from the Rabbit hole (after 4 days), the owners weren't too happy about it all. 


JWP 2020
Learning To Program By Building Tiny Python Projects
Published: 2020-07-28 12:36:42

<p>One of the best methods for learning programming is to just build a project and see how things work first-hand. With that in mind, Ken Youens-Clark wrote a whole book of Tiny Python Projects that you can use to get started on your journey. In this episode he shares his inspiration for the book, his thoughts on the benefits of teaching testing principles and the use of linting and formatting tools, as well as the benefits of trying variations on a working program to see how it behaves. This was a great conversation about useful strategies for supporting new programmers in their efforts to learn a valuable skill.</p><p><a href='https://www.pythonpodcast.com/tiny-python-projects-book-episode-273/'>Listen Now!</a></p>
Create your repository
Tags: git, webdev, gitlab
Published: 2020-07-28 12:35:21

> Photo by [Daniel McCullough](https://unsplash.com/@d_mccullough) on [Unsplash](https://unsplash.com/)

# Introduction
This post takes place in a series aiming to show how to build an angular application from scratch.
We will see how to scaffold an enterprise-scale angular application with all the assets needed to easily develop and maintain it.

> This post doesn't dive deep into how git nor gitlab works. For more informations about them, refer to their documentations.

This post will show you how to setup a gitlab repository and push your application [created before](https://dev.to/fairen/create-an-angular-application-4opl).

# Create your project on Gitlab
<img src="https://dev-to-uploads.s3.amazonaws.com/i/x21k2lgakrz15jk58aer.png" width="125px"> 

Create a new [project](https://gitlab.com/projects/new) : 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/tm9d9ad02rtdmm5r5uq3.png)

Setup the project configuration :
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/a1ugul41gnrugomi83zz.png)

# Upload your first commit
<img src="https://dev-to-uploads.s3.amazonaws.com/i/zay232wfs4ayyf57gy9h.png" width="125px"> 

To upload your existing files generated by `angular cli` use the instructions bellow.

### Git global setup
```bash
git config --global user.name "<your_gitlab_username>" 
git config --global user.email "<your_gitlab_email>" 
```

### Push an existing folder
```bash
cd ng-shadow
git remote add origin https://gitlab.com/<your_gitlab_username>/ng-shadow.git
git push -u origin master
```
A month-long celebration to open source projects: coming soon!
Tags: cloudsmith, hacktoberfest, opensource
Published: 2020-07-28 12:34:12

---
title: A month-long celebration to open source projects: coming soon!
published: true
description: 
tags: cloudsmith, hacktoberfest, opensource
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/53b2eicpz0uvy9dr970d.jpg
---

Yes, you guessed it! [Hacktoberfest 2020](https://hacktoberfest.digitalocean.com/) preparations are already underway globally. If you're not familiar with the event, it's a month-long celebration of open source during October by Digital Ocean. Hacktoberfest promotes contributions to a diverse range of open source projects on Github and welcomes for first-time contributors to get involved with the community.

It's easy and the perfect time to get involved or even to rejoin the open source community. If contributing to your favorite open source project sounds appealing, wait, because it gets even better! Hacktoberfest is open to everyone across the world. Contributors can sign up anytime between October 1st and October 31st to become eligible for fantastic swag in the form of t-shirts and stickers from Digital Ocean. Submitting four quality pull requests to a public Github repository qualifies each contributor to swag, and what fantastic swag it is! Check out last year's fantastic t-shirt!

![HacktoberFest Tee](https://dev-to-uploads.s3.amazonaws.com/i/42t4qi5jj0wyt3ossm0c.jpg)

At Cloudsmith, we use open source tools and dependencies in all of the software we build and use daily. We love giving back to the community and frequently contributing enhancements and bug fixes to libraries and package management tools to help our customers and our own internal needs.

Helping to support the open source community is important to us. That's why we provide [free, open-source repositories](https://help.cloudsmith.io/docs/create-a-repository#open-source-repositories) for all our package formats and provide open source tools to help users get the most out of Cloudsmith as their universal package repository.

This year, like many previous years, will see members of the team contributing to a range of open source projects for fun and to scratch our own itch by making something we love even better. Still, we're all about giving back and want to help empower developers to contribute to tools they enjoy using. That's why we will be creating a range of issues suitable for first-time contributors and experienced developers to make code and documentation improvements across some of our open source projects:

* [Cloudsmith CLI](https://github.com/cloudsmith-io/cloudsmith-cli)
* [Cloudsmith Github Actions](https://github.com/cloudsmith-io/action)
* [Cloudsmith Terraform Provider](https://github.com/cloudsmith-io/terraform-provider-cloudsmith)

As a team, we are looking forward to engaging with the community we love, and creating new awesome software together!
YouTube Video | CSS Grid Course for Beginners - 1
Tags: html, css, youtube, webdev
Published: 2020-07-28 12:32:52

In this series we will learn CSS Grid . With the creation of CSS Grid, we can create a modern day website with ease and ditching CSS frameworks like bootstrap.

This is the first part of the series.

{% youtube ZVtcekUMELY %}

Please do like it and [Subscribe](https://www.youtube.com/channel/UCRf7mazcufqZxd2pR3oQJuQ?sub_confirmation=1) to my channel for more videos.
Principles for Making Digital Healthcare More Human-Centric
Published: 2020-07-28 12:13:33

In the last decade, technology has leapfrogged its way to the center-stage towards medical diagnosis and preemptive care. The online healthcare industry is focussing on leveraging technology to solve an impressive number of medical problems for all human beings. We can book appointments with doctors at the click of a button and check their availability without talking to an assistant.
Soon diagnoses became digital; the treatments matured to be more efficient. But is it humane enough? As the queues outside dispensaries shrink and delivery of medicines becomes more seamless online, the healthcare industry is losing touch with a much-needed strain of human emotion in the process – empathy!

Despite the advancements, the human touch was missing in design-driven digital healthcare. To address this, half of the healthcare industry started working on making solutions more accessible, while the other half was working harder on strengthening human relationships by bringing about trust and reliability on the platform. After all, nothing is more personal than our bodies. Throughout this journey, we found out six significant principles that are a must in making Digital Healthcare more Human-Centered.

1 Provide Democratic Access
Patients are patients, no matter where they live, so if you make an app make it for all. Patients come from different backgrounds and lifestyles, so it is vital for the app UI to be easy to understand, for all cognitive abilities and...

Read more: https://www.terralogic.com/principles-for-making-digital-healthcare-more-human-centric/