teleren/devto huggingface dataset:
Elixir pattern matching in a nutshell
Tags: elixir
Published: 2021-06-29 15:27:27

# Pattern matching in a nutshell



If you are new to Elixir, Pattern Matching may be something strange to you. When you get familiar with it, you will know how powerful it is. And I'm sure that you will definite love it.



Pattern matching is used everywhere in your elixlir code . And I would bring it to other language that I use ( if I can :D)



But it's not so hard. 



## What does Pattern Matching do?

Give you a variable/value, you might want

1. Check if data type is match your expected data type
2. Check if structure of data match your expected data structure
3. Assign matching part of data to a variable



And pattern matching do all these thing for you. Just look at some example. 

When you try these example, it will raise exception if data doesn't match against the pattern. In real Elixir app, you won't use it this way, check **Where it is used** at the end of this article



## Pattern matching with Map/Struct

**1. Check if this data is a map**

```elixir
%{} = params
```



**2. Check if data is a map and has key `email` and email value is `zoo@example.com`**

```elixir
%{"email" => "zoo@example.com"} = params
```





**3. Check if data is a map and has key `email`, if matchs pattern, assign value of key `email` to variable `my_email`**

```elixir
%{"email" => my_email} = params
```



**4. Check if data is a map and has key `email`, I don't want to extract value**

use `_` to ignore value

```elixir
%{"email" => _} = params
```



**5. Pattern matching nested map**

```elixir
%{"address" => %{"city" => city}} = params
```



**6. Check if data is type struct `User`**

```elixir
%User{} = params
```

> The rest is same with map. Struct is basically a map with atom key.



## Pattern matching with List

**1. Check if data is empty lis**

```elixir
[] = params
```



**2. Check if data is a list and not empty**

```elixir
[_|_] = params
```



**3. Check if data is exact list**

```elixir
[1, 2] = params
```



**4. Check if data is list and extract first element and remaining**

```elixir
[first_element | remaining] = params
```



## Pattern matching with Tuple

You don't have much pattern to match against tuple

**1. Check if data is tuple of 2 elements**

```elixir
{_, _} = params
```



**2. Check if data is tuple and has specific value**

```elixir
{:ok, data} = result
# you use this most of time
```



## Where to use pattern matching

**1. case clause**

```elixir
case user do
	%User{is_active: true} -> "Log you in"
	%User{is_active: false} -> "Check your email"
	_others -> "Not a user"
end
```



**2. with clause**

```elixir
with {:ok, user} <- create_user(params) do
	# your code
end
```



**3. function**

```elixir
def is_admin(%User{role: "admin"}), do: true
def is_admin(%User{role: _}), do: false
def is_admin(_), do: raise "Not a user"
```

## Conclusion

At first, it's a bit strange to grasp, but gradually you can live without it. It is one of Elixir's features that I love most. And I think you will. Using it more and its power is in your hand.
Clean Code Javascript
Tags: javascript
Published: 2021-06-29 15:25:58


![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k3k3lq8nbwulceh2i2t4.jpeg)
Software engineering principles, from Robert C. Martin's book Clean Code, adapted for JavaScript. This is not a style guide. It's a guide to producing readable, reusable, and refactorable software in JavaScript.

Not every principle herein has to be strictly followed, and even fewer will be universally agreed upon. These are guidelines and nothing more, but they are ones codified over many years of collective experience by the authors of Clean Code.

Our craft of software engineering is just a bit over 50 years old, and we are still learning a lot. When software architecture is as old as architecture itself, maybe then we will have harder rules to follow. For now, let these guidelines serve as a touchstone by which to assess the quality of the JavaScript code that you and your team produce.

One more thing: knowing these won't immediately make you a better software developer, and working with them for many years doesn't mean you won't make mistakes. Every piece of code starts as a first draft, like wet clay getting shaped into its final form. Finally, we chisel away the imperfections when we review it with our peers. Don't beat yourself up for first drafts that need improvement. Beat up the code instead!

[🛁 Clean Code concepts adapted for JavaScript](https://github.com/ryanmcdermott/clean-code-javascript)
Laragon - The Dev Environment for Web Artisans
Published: 2021-06-29 15:10:36

## What is Laragon?
![Laragon](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lft61rnh9qd3p2gczl84.png)
Laragon is a portable, isolated, fast & powerful universal development environment for PHP, Node.js, Python, Java, Go, Ruby. It is fast, lightweight, easy-to-use and easy-to-extend.

Laragon is great for building and managing modern web applications. It is focused on performance - designed around stability, simplicity, flexibility and freedom.

Laragon is very lightweight and will stay as lean as possible. The core binary itself is less than 2MB and uses less than 4MB RAM when running.

Laragon doesn't use Windows services. It has its own service orchestration which manages services asynchronously and non-blocking so you'll find things run fast & smoothly with Laragon.

## Features
Pretty URLs Use app.test instead of localhost/app.

Portable You can move Laragon folder around (to another disks, to another laptops, sync to Cloud,...) without any worries.
Isolated Laragon has an isolated environment with your OS - it will keep your system clean.

Easy Operation Unlike others which pre-config for you, Laragon auto-configs all the complicated things. That why you can add another versions of PHP, Python, Ruby, Java, Go, Apache, Nginx, MySQL, PostgreSQL, MongoDB,... effortlessly.

Modern & Powerful Laragon comes with modern architect which is suitable to build modern web apps. You can work with both Apache & Nginx as they are fully-managed. Also, Laragon makes things a lot easier:
* Wanna have a Wordpress CMS? Just 1 click.
* Wanna show your local project to customers? Just 1 click.
* Wanna enable/disable a PHP extension? Just 1 click.

_Laragon is trully isolated & portable. However, you may need to use the installer as it will detect and install missing run-time components that are required to run C++ applications built using Visual Studio such as PHP, Apache for you._

Supported Platforms: Windows.

[Laragon](https://github.com/leokhoa/laragon)
Try js-smart-table!!
Tags: javascript, frontend, vanillajs
Published: 2021-06-29 15:05:18

![cover](https://res.cloudinary.com/dmtvwe2ur/image/upload/v1624817824/js-smart-table/JS-Smart-table_m0lb4u.jpg)

Hi everyone, today i present you the first library i've created for javascript (front-end/client-side).

Ill give you **[this link](https://youthful-hopper-033b16.netlify.app/)** in order to try the demo by yourself.

Basically, tabulates date from an API using javascript and prints it on the browser. Something like this.
![example_library](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/31brdwigocdbk1pd7jnq.png)

What's the interesting of this? 
* Allows you click on the column and sort the data (sorted by the sql motor that use the API)
* Gives you a pagination of the data
* Allows you click on the rows and "save on memory" the information (an object with the information of that row). This allows you make another operations (callback) using as reference the data clicked. For instance. You clicked a row and you want to fill a form with that? You can do it! Request to another API? Yeah too. Actually you can do anything.
* Vanilla JS. You can use it anywhere (i'm using it right now on React and Vanilla projects) or any library/framework of JS.

I hope this can help you when trying to implement this kind of features on your projects. All it's documented,video and with example codes in order to make it understandable for the community.

Cheers.

**[NPM LIBRARY HERE](https://www.npmjs.com/package/js-smart-table)**
Easy AdminLTE integration with Laravel
Tags: laravel
Published: 2021-06-29 15:01:40

This package provides an easy way to quickly set up **AdminLTE v3** with Laravel (6 or higher). It has no requirements and dependencies besides Laravel, so you can start building your admin panel immediately. The package provides a blade template that you can extend and advanced menu configuration possibilities. 

Also, and optionally, the package includes a set of AdminLTE styled authentication views that you can use in replacement of the ones that are provided by the laravel/ui authentication scaffolding.

If you want to use an older Laravel or AdminLTE version, review the following package releases:

**Releases 1.x:** These releases supports Laravel 5 and include AdminLTE v2
**Releases 2.x:** These releases supports Laravel 6 or higher and include AdminLTE v2

## Requirements
The current package requirements are:

Laravel >= 6.x
PHP >= 7.2

[Laravel-AdminLTE](https://github.com/jeroennoten/Laravel-AdminLTE)
Venha ser uma pessoa Software Engineer na SumUp!
Tags: engineering, fintech, development
Published: 2021-06-29 14:57:50

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

• VAGA DESTAQUE DO DIA •

Estamos buscando uma pessoa Software Engineer para a SumUp 🕵️‍♀️

O que a gente procura:
➡ Sólida experiência com desenvolvimento Backend;
➡ Tenha tido contato e/ou tenha interesse em trabalhar com linguagens funcionais;
➡ Consiga se comunicar muito bem em inglês.

Você é essa pessoa ou conhece alguém com esse perfil? 
Inscreva-se neste link https://bit.ly/3zNw9B1 ou marca ela aqui nos comentários. 😄
How to build a Ruby on Rails app on AWS for beginners - Part 1.
Tags: aws, rails
Published: 2021-06-29 14:28:28

This is part one of a series of posts, this post covers the initial provisioning of a Ruby on Rails app on AWS using LightSail which is the simplest way of getting started with compute and databases on AWS. 

Let's get started by creating an AWS account and building a Linux host to run our Ruby on Rails app with AWS LightSail. 

## Provisioning a Linux instance to run a Ruby on Rails app on AWS LightSail.

[This post](https://www.theelastic.guru/lee/the-easiest-way-to-get-started-with-aws-regardless-of-your-background-1hhf) will guide you through getting started with your first AWS LightSail compute instance. **Before** you follow the article though, you need to remember to choose Ubuntu as the OS as per below:

![aws Ruby on Rails host](https://www.theelastic.guru/remoteimages/uploads/articles/brtuup7673r0ztjr2r9r.png)

Then select your plan (I chose the $10 for now)

![aws Ruby on Rails host ec2 or lightsail](https://www.theelastic.guru/remoteimages/uploads/articles/7v88tobibx6vyfaj2z1h.png)

Okay, once that's done, click on the little command line icon next to you instance and you should get a new console tab, all logged in and ready to go.

![Screenshot 2021-02-17 at 12.33.07](https://www.theelastic.guru/remoteimages/uploads/articles/xtm9tdrkcnxp1tq1mrxp.png)

## Installing Node and Yarn to support Webpacker in Ruby on Rails.

```
sudo apt install curl
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
```
```
sudo apt-get update
sudo apt-get install git-core zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common libffi-dev nodejs yarn
```

## Installing rbenv and then Ruby

Great, let's install a Ruby. We are going to install it using rbenv which allows you to run multiple versions of Ruby side by side if needed.

```
cd
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL

git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
exec $SHELL

rbenv install 3.0.0
rbenv global 3.0.0
ruby -v
```

Now all we need to do is install bundler 

```
gem install bundler

```

Next up, installing Rails

```
gem install rails -v 6.1.3.2
```

To make the Rails executable available:

```
rbenv rehash
```

Check you have everything installed (this should return the installed version):

```
rails -v
```


Job done next up this series is installing PostgreSQL for the DB.
nvm alias default 'lts/*'
Published: 2021-06-29 14:04:09

---
title: nvm alias default 'lts/*' 
published: true
description: NVM: set latest lts as the default node version in your shell
tags: 
//cover_image: https://direct_url_to_image.jpg
---
If not already familiar, nvm is a version manager for node.js, designed to be installed per-user, and invoked per-shell. nvm works on any POSIX-compliant shell (sh, dash, ksh, zsh, bash), in particular on these platforms: unix, macOS, and windows WSL. Read more here http://nvm.sh

I wanted to set node LTS as default version and found the documentation was lacking. So here you go, mostly note to self:

Set *latest* `lts` as the default node version in your shell
`nvm alias default 'lts/*'`

Verify that the change persists by closing the shell window, opening a new one, then:
`node --version` or `nvm version`
Setup Laravel in Local Host
Tags: php, laravel
Published: 2021-06-29 13:59:46

This guide assume you are installing on a Mac OS.
Install `composer` which is a package manager for Laravel.
```bash
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
sudo mv composer.phar /usr/local/bin/composer
```
Install `laravel` installer.
```bash
composer global require "laravel/installer"
export PATH=~/.composer/vendor/bin:$PATH
```
Now you can create a new Laravel project on the working directory.
```bash
laravel new {project}
cd {project}
```
Run the new project with `sail` tool.
```bash
composer require laravel/sail --dev
php artisan sail:install
```
After that `docer-compser.yml` and `Dockerfile` are created. For now `mysql 8.0.25` and `php8.0` were installed. It builds docker images and prints container logs like `tail -f`. You could use `sail up -d` to run containers in background.
Save the current code on github for backup.
```bash
git init
git add .
git commit -m "first commit"
git branch -M main
git remote add origin git@github.com:{username}/laravel-example.git
git push -u origin main
```
Let's see what containers are running. `sail` command is similar to `docker-compose` command.
```bash
# list containers
sail ps
# list databases
sail exec mysql mysql -usail -ppassword -e"show databases"
```
Open a browser and go to `http://localhost` to see Laravel.

To stop containers, open a new terminal and go to {project} directory and run down command.
```bash
sail down
```
Lastly install a debugger for php.
```bash
# on MacOS
pecl install xdebug
# on Ubuntu
sudo apt install php-xdebug
```
Web Scraping the New York Times with Python and Beautiful Soup
Published: 2021-06-29 13:53:36

The aim of this article is to get you started on real-world problem solving while keeping it super simple so you get familiar and get practical results as fast as possible.

So the first thing we need is to make sure we have Python 3 installed. If not, you can just get Python 3 and get it installed before you proceed.

https://youtu.be/oKelfbozr3U
How To Do Web Scraping Amazon Using Python And Beautiful Soup
Published: 2021-06-29 13:50:37

The aim of this article is to get you started on real-world problem solving while keeping it super simple so you get familiar and get practical results as fast as possible.

So the first thing we need is to make sure we have Python 3 installed. If not, you can just get Python 3 and get it installed before you proceed.

https://youtu.be/CrPSw8bo0TA
What is Web Scraping

Published: 2021-06-29 13:49:53

Web scraping refers to the process of crawling or spidering a website or multiple websites systematically and then extracting relevant data usually not intended for consumption by software programs. The difficulty comes in the fact that the web is haphazard, designed originally for humans, varied in implementation, and then the relevant data is not defined semantically

https://youtu.be/TILFHgKvsUU
Top Web Crawling Blog At Full Speed Using Python
Published: 2021-06-29 13:49:22

Knowledge of web crawling frameworks like Scrapy, Puppeteer, or Goutte Coding from scratch on your own can only take you so far. You will find that the frameworks can abstract out the complexities of building a spider, making concurrent connections, using selectors for scraping, working with files, infinite pages, etc. quite easily.

https://youtu.be/ljNIrsQM4PU
8 Key Challenges Fintech Industry Faces and their Solutions
Tags: webdev, fintech, startup, business
Published: 2021-06-29 13:35:25

---
title: 8 Key Challenges Fintech Industry Faces and their Solutions
published: true
description: New technology adoption, security, etc are challenges for the fintech industry. Here are 8 of those challenges the fintech industry faces and their solutions.
tags: webdev, fintech, Startup, business
cover_image: https://www.techtic.com/wp-content/uploads/2021/06/Fintech-industry-challenges.jpg
---

Digital innovations and trends in financial technology or the Fintech industry are revolutionizing how people, financial organizations, and banks manage their money. In the last five years, modern advances have drastically changed how people engage with their finances.

Fintech companies are on a path of enhancing their growth and building a reputation in the industry. Financial technology is improving and automating the process and services within organizations. However, these challenges push our imagination in new ways and encourage unparalleled growth, but there’s room for improvement.

<h2>Challenges that Fintech Industry Faces</h2>

Many prominent Fintech companies face various issues like long-fund raising cycles, missed out targets, and increasing losses. Well, these are very common issues as well. And these take place due to mismanagement of the leading lifecycle.

However, there are many other key challenges that the fintech industry faces every day. Let’s discuss this now.

<ul>
 	<li>1. Data Security</li>
 	<li>2. Compliance with Government Regulations</li>
 	<li>3. Lack of Mobile and Tech Expertise</li>
 	<li>4. Big Data and AI Integration</li>
 	<li>5. Blockchain Integration</li>
 	<li>6. User Retention and User Experience</li>
 	<li>7. Effective Marketing Tactics to Acquire Customers</li>
 	<li>8. Personalized Services</li>
</ul>

Want to know more about all fintech industry challenges and solutions then visit <a href="https://www.techtic.com/blog/fintech-industry-challenges/">https://www.techtic.com/blog/fintech-industry-challenges/</a>
20 Best Battery Saver Apps for Android Device in 2021
Published: 2021-06-29 12:32:52

We are nothing without our smartphones in today’s world. Battery drain is the main pushback of modern mobile devices. That is why more and more people look for phones with maximum mAH. So their phone can offer maximum battery life. But still, the apps running in the background and sucking the battery life, malware, advertisements, continuously running, improper apps optimization leads to battery drain and low performance of the phone.

Battery savers apps have become an essential app for any smartphone user. These applications are specially designed to control many power consumption functions on the android device, which saves the battery especially when your phone is inactive. We all can’t just put our smartphones down just yet, you can extend the daily lifespan of your phone’s battery and enhance its day-to-day performance with the listed recommended battery saver apps for android.

If you are also a culprit of high battery drain and lower performance then we have listed some of the best battery saver apps for android which can improve the speed of your mobile device as well as extend the battery life.

Top Battery Saver Apps for Android

**1. McAfee Security Innovations**

We all know that McAfee is a very reputed name in the market when it comes to keeping the security of your phone and the computer. It helps in keeping antivirus away with tight security. Even in android, it’s no exception it amazingly works as a trustworthy and reliable security option for android phones. McAfee offers security protection, system utilities, notification blockers, secure QR code readers, and much more. McAfee Security Protections is considered one of the best battery savers apps for android in the market.

Download the best battery saver apps for android – McAfee Security Innovations

We’re VerveLogic - [best Mobile App Development Company In Los Angeles](https://www.vervelogic.com/mobile-app-development-company-in-los-angeles.html) and we’ve been serving our clients with our IT, designing, and Marketing services since 2012. Every day, our team of dedicated professionals works to make this world a little better through our premier solutions. Our exclusive services include Mobile App Development, Web Application Development, UX/UX Designing and Digital Marketing Services to businesses from all around the globe irrespective of your business domain.

Read full post- [20 Best Battery Saver Apps for Android Device in 2021](https://www.vervelogic.com/blog/best-battery-saver-apps-for-android/)
8 Ultimate ressources for learning Web Dev in 2021 #2
Tags: javascript, webdev, css, html
Published: 2021-06-29 12:59:15

Hey friends ! I'm sharing with you a lot of ressources about web developper that will help you to improve your skills and save your time ! (for the second time !)

## Javascript 🖥️

#### Operator

A nice recap about all Javascript operator (will you learn new one truly !)

https://www.joshwcomeau.com/operator-lookup/

#### Graph Markdown

You want to create a nice graph for your documentation in markdown ? Documentation is very very important in any project !

https://mermaid-js.github.io/mermaid/

## CSS 🎨

#### Pattern

A lot of CSS pattern that is very usefull ! 

https://csslayout.io/patterns/

#### All CSS Reference

Website that gather all css properties ! very usefull if you need to check a property fastly !

https://cssreference.io/

#### Flexbox

You want to learn flexbox ? Go to this !

https://www.samanthaming.com/flexbox30/

## HTML 🔍

#### DOM Event

You have trouble or you want to re-learn dom event ? this ressource is very usefull, it's an interactive dom event simulator online !

https://domevents.dev/

## Others 📌

#### Semantic version

For all developers, semantic versionning is very important when you are creating and maintaining a project !

 https://zellwk.com/blog/semantic-versioning/

#### Simple Icon

Developer are not designer ! when we need some graphical resource, we lost our time ! This resource share a lot of icon that you can use !

https://simpleicons.org/

---

I hope you like this reading!

🎁 You can get my new book `Underrated skills in javascript, make the difference` for FREE if you follow me on [Twitter](https://twitter.com/code__oz) and MP me 😁

Or get it [HERE](https://codeoz.gumroad.com/l/RXLYp)

🎁 [MY NEWSLETTER](https://www.getrevue.co/profile/code__oz)

☕️ You can [SUPPORT MY WORKS](https://www.buymeacoffee.com/CodeoZ) 🙏

🏃‍♂️ You can follow me on 👇

🕊 Twitter : [https://twitter.com/code__oz](https://twitter.com/code__oz)

👨‍💻 Github: https://github.com/Code-Oz

And you can mark 🔖 this article!