teleren/devto huggingface dataset:
Flutter for Web
Tags: featured
Published: 2020-08-10 08:34:13

---
title: Flutter for Web
published: true
date: 2020-07-20 00:30:00 UTC
tags: featured
canonical_url: 
---

## What is Flutter Web?

A connected `P`rogressive `W`eb `A`pplication built with Flutter

`Web` support for `Flutter` enables existing mobile-based applications to be packaged as a `PWA` for reach to a broader variety of devices, or to provide a companion `web` experience to an existing app.

In addition to mobile apps, Flutter supports the generation of web content rendered using standards-based web technologies: HTML, CSS and JavaScript. With web support, you can compile existing Flutter code written in Dart into a client experience that can be embedded in the browser and deployed to any web server. You can use all the features of Flutter, and you don’t need a browser plug-in.

**Flutter Solves The Backend & Frontend Problem**

Flutter’s `reactive` framework brushes aside the need to get references to the widgets. On the other hand, it facilitates a single language to structure backend. That’s why Flutter is the `best` app development `framework` in the `21st century` to be used by `Android developers`.

## How to activate Flutter Web ?

`if you want to install flutter check this` [article](https://naveenjujaray.js.org/flutterinstall).

Run the following commands to use the latest version of the Flutter SDK from the beta channel and enable web support:

```
 $ flutter channel beta
 $ flutter upgrade
 $ flutter config --enable-web
```

Once web is enabled, the `flutter devices` command outputs a `Chrome` device that opens the Chrome browser with your app running, and a Web Server that provides the URL serving the app.

```
 flutter devices
2 connected device:

Web Server • web-server • web-javascript • Flutter Tools
Chrome • chrome • web-javascript • Google Chrome 81.0.4044.129
```

## Create and run

To create a new app that includes web support (in addition to mobile support), run the following commands, substituting `myapp` with the name of your project:

```
 $ flutter create myapp
 $ cd myapp
```

To serve your app from `localhost` in Chrome, enter the following from the top of the package:

```
$ flutter run -d chrome
```

A release build uses `dart2js` (instead of the `development compiler`) to produce a single JavaScript file `main.dart.js`. You can create a release build using release mode (`flutter run --release`) or by using `flutter build web`. This populates a `build/web` directory with built files, including an assets directory, which need to be served together.

## Add web support to an existing app

To add web support to an existing project, run the following command in a terminal from the root project directory:

```
$ flutter create .
```

## Hosting

Check out this [page](https://dev.to/naveenjujaray/free-hosting-sites-with-instructions-29e9-temp-slug-6554260) to know more about hosting Flutter Web.
Calculate the number of days between 2 dates in JavaScript
Tags: javascript
Published: 2020-07-20 00:00:00

---
  title: Calculate the number of days between 2 dates in JavaScript
  published: true
  tags: JavaScript
  date: Mon Jul 20 2020 05:30:00 GMT+0530 (India Standard Time)
  canonical_url: https://melvingeorge.me/blog/number-of-days-between-2-dates
  cover_image: https://melvingeorge.me/_next/static/images/main-a5dff94e98cae113d1c13120dd5d43f5.jpg
  ---
  [Originally posted here!](https://melvingeorge.me/blog/number-of-days-between-2-dates)
  
## Calculate the number of days between 2 dates

Consider this 2 dates,

```javascript
// 2 dates
const date1 = new Date("September 03, 1998");
const date2 = new Date(); // will return current date
```

You can also provide the date in `MM/DD/YYYY` format also into the `Date()` constructor function.

To find the number of the days between any 2 dates, we need to rely on some calculations as javascript itself doesn't provide any methods to do that.

First, we need to get the milliseconds between these 2 dates.

```javascript
// 2 dates
const date1 = new Date("September 03, 1998");
const date2 = new Date(); // will return current date

// get milliseconds
const millisecondsBetween2Dates = Math.abs(date2 - date1);
```

We are using the `Math.abs()` to get the absolute value so that it deals with negative values also.

Secondly, we need to get the number of days using these milliseconds.

```javascript
// 2 dates
const date1 = new Date("September 03, 1998");
const date2 = new Date(); // will return current date

// get milliseconds
const millisecondsBetween2Dates = Math.abs(date2 - date1);

// get number of days
const numberOfDays = Math.ceil(
  millisecondsBetween2Dates / (1000 * 60 * 60 * 24)
);

console.log(numberOfDays);
```

We are using the `Math.ceil()` to round to the next largest integer.

To convert it into the days we are dividing it with `1000 (milliseconds)* 60 (seconds) * 60 (minutes) * 24 (hours)`.

### NOTE: `1 second is 1000 milliseconds.`

We are dividing the total milliseconds with 1000

### Feel free to share if you found this useful 😃.

---
TIL How to use git branch aliases with Mozilla Central
Published: 2020-07-20 20:10:37

---
title: TIL How to use git branch aliases with Mozilla Central
published: true
date: 2020-07-20 00:00:00 UTC
tags: 
canonical_url: https://tigeroakes.com/posts/til-mozilla-central-main-alias/
---

I just set up [Mozilla Central with a git wrapper](https://github.com/glandium/git-cinnabar/wiki/Mozilla:-A-git-workflow-for-Gecko-development) so I can contribute to the main Gecko codebase using Git. It works great, but the default branch has an unusual name compared to what I’m used to.

```
> git branch
branches/default/tip
bug1602126
```

You can create symbolic references in Git, so that the default branch has a name you’re used to.

```
> git symbolic-ref refs/heads/main refs/heads/branches/default/tip

> git branch
branches/default/tip
bug1602126
main -> branches/default/tip

> git checkout main
Switched to branch 'main'

> git status
On branch branches/default/tip
```
Benefits and usages of Hosts File
Tags: computertricks, networking, hostsfile
Published: 2020-09-07 12:13:58

---
title: Benefits and usages of Hosts File
published: true
date: 2020-07-20 00:00:00 UTC
tags: Computertricks,Networking,HostsFile
canonical_url: https://www.loginradius.com/engineering/blog/hosts-file/
---

Hosts file maps hostnames to IP addresses, sometimes required to be edited either to block some sites or to test some custom domain.This blog explains how can we edit the hosts in different operating systems.

   
[Read On](https://www.loginradius.com/engineering/blog/hosts-file/)
meu primeiro post
Tags: bot
Published: 2020-07-19 23:54:23

este é minha primeira postagem aqui, sem muito o que dizer, me afastei de todas e qualquer rede social, passei o tempo estudando como as coisas funcionam, programando inúmeros projetos, ajudando todos que posso ... e com isso, vem um amigo, me apresenta o dev.to, é legal e estranho eu estar retornando para algo que eu repudio muito ( mídias sociais ), porém neste aqui eu nunca usei, não sei quanto a segurança e privacidade, e estudando um pouco com dados, gerei este mapa com uma extensão de navegador, e já que estamos em uma rede social de DEVs, por que não escrever meu primeiro post com um bot no terminal a partir de clonagem de coockies de autenticação, e acabar descobrindo que esta rede realiza requests para os servidores a cada botão que eu passo meu mouse, lamentável vigilância dos meus dados.
Setting up a React project with the “Create React App” package
Tags: react
Published: 2020-07-19 23:50:38

Create React App allows you too quickly set up a React app with a single terminal command.

It’s great for when you want to jump in and start coding without having to mess around with configuration.

The only prerequisite is to have a recent version (8.10+) of [Node.js](https://nodejs.org/en/) installed.

To get started open terminal and run the `create-react-app` command:

```
npx create-react-app hello-world
```

Replace `hello-world` with your project name.

Once the installation is complete switch to the newly created directory and start the project:

```
cd hello-world && npm start
```

This will open the below page in a browser on a live development server at localhost:3000.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/87ol7twtrf2jr4wj31h3.png)At this point you can make code edits and the project will automatically recompile and reload the browser.

If for some reason the live reloading isn’t working for you try running the following command:

```
npm cache clean --force
```

That concludes the setup, when your app is ready for deployment run the following command:

```
npm run build
```

This will create a new “build” folder in the project with optimised code and assets to deploy.
Ruby 101 part:1
Tags: ruby, 100daysofcode, womenintech, rails
Published: 2020-07-19 23:38:12

Hello, Rubians! This blog post is for newbies who want to learn the basics of Ruby or just here to refresh their memory! 

**What is Ruby?** 

Ruby is an object-oriented language. It simply means everything in ruby is an object, including the data types.

**Four Basic Data Types:**
1. Numbers (Integer & Floats) 
2. Strings
3. Symbols 
4. Boolean (True, False, Nil)

Today I going cover **Numbers** only. 

```
#Addition
2 + 2   #=> 4

#Subtraction
 3 - 1   #=> 2

#Multiplication
 3 * 3  #=> 9

#Division
20 / 5  #=> 4

#Exponent
 2 ** 2  #=> 4
 4 ** 3  #=> 64

# Modulus (find the remainder of division)
print(4 % 2 )  #=> 0  (4 / 2 = 4; no remainder)
print(15 % 4)  #=> 2  (10 / 4 = 3 with a remainder of 3)
```
**Difference between Integers and Floats**

***Integers*** are whole numbers, such as 16 and ***floats*** are decimal numbers such as  16.0, 0.25, or 4.3. 

**Ruby Things!**

In Ruby, when you want to do some arithmetic with two integers the answer will always be a whole number: 

```
5/2 #=> 2
```
It is weird, right? In order to get the correct answer, we have to use float. 
```
5/2.0 #=> 2.5
```
**Convert Integers to floats or vice versa**

```
Integer to a float:
2.to_f #=> 2.0 
18.to_f #=> 18.0 

Float to an integer
3.0.to_i #=> 3
1.8.to_i #=> 1
```
**Number methods in Ruby:**
Well, there are many numbers in Ruby, I am going to share two over here, rest you can check [here](https://www.freecodecamp.org/news/ruby-number-methods-integer-and-float-methods-with-examples/).

**.even?**
```
13.even? #=> false
12.even? #=> true
```
**.odd?**
```
14.odd? #=> false
15.odd? #=> true
```
Keep an eye out for my part:2! 
Keep coding! 😁
Redundancy  in Ruby
Tags: healthydebate
Published: 2020-07-19 23:15:46

When I began coding, Python was the language I started with. After learning some Python, I switched to Ruby and JavaScript because that’s what my school taught. I was soon asking the question, “Why are there multiple ways of doing the exact same thing in Ruby?”. 

Yukihiro Matsumoto, the creator of ruby, wanted his language to be expressive. I understand where he was coming from, but I find it redundant to have two words represent the exact same function. I would feel the exact same if tooth brushes were also called dental polishers. You may be thinking, “what about the words ecstatic vs excited?” I would argue that those words represent feelings, and definitions for feelings can vary from person to person. I find those words to have different but similar meanings. As an example when it comes to coding, I have no problem with JavaScript having multiple ways to iterate through an array. For loops and forEach loops accomplish the same task, but have minute differences. A for loop is easy to break out of, but forEach loops are easy to read. On the other hand, Ruby’s map and collect methods are the exact same. If you look at the Ruby documentation, they are both implemented as the C rb_ary_collect method.

Now although it may seem like I hate Ruby, I don’t. Many other languages have redundancies as well. Using Ruby on Rails gets the job done, and I enjoy writing in the language (for the most part). Although, once I become equally skilled in Python, I’ll probably use Ruby less. This is partially due to the same reasons I’ve been ranting about, but also because Python is faster than ruby. I’ve heard many great points about why people enjoy Ruby’s expressiveness.

I’d love to hear other peoples opinions on this topic.
Install a progressive web app on Android [bubblewrap]
Tags: android
Published: 2020-07-19 22:37:50

---
title: Install a progressive web app on Android [bubblewrap]
published: true
description: We use Bubblewrap to install a progressive web app on android. Bubblewrap will create a signed Android APK from the progressive web app manifest and install it on your phone or upload it to Google play store.
tags: android
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/trjq8mm88l0b4s2pynsd.jpg
---

{% youtube AF9wjWW6iBY %}

We use Bubblewrap to install a progressive web app on android. Bubblewrap will create a signed Android APK from the progressive web app manifest and install it on your phone or upload it to Google play store.
Mindfulness in the Face of Rage Coding
Tags: motivation
Published: 2020-07-19 20:43:37

You are sitting at your computer, your fingers resting on the keyboard but they aren't typing. Your heart begins beating faster. The red error message from your rails console is telling you that you are wrong for the eighth time in as many attempts. Every angle you have tried to solve the error has failed, you see no other path forward. But time is ticking. You can feel the negative space between you and your deadline sucking you in like a blackhole; your skin becoming stretched, disconnected, your soul being pulled from your ribcage like a magnet unable to yield to its nature.

This is rage coding and it happens to all of us. Well, like 80% of that happens but the rest is a metaphor to communicate the ever-present feeling of #error in the world of my new occupational world: Coding Bootcamp boy. It is a world of trial and error, and if there were no errors, there would be no jobs. We are here for the errors, but boy oh boy, are the errors here for us.

These errors, like little malevolent demons with sharp claws and very well researched personal attacks, provide a crucial opportunity to identify and revise one's ability to cope with problems that are not immediately visible or whose scope is not explicit. 

Our teacher, Brian Rice, has given us some valuable insight on this subject and his experience with it as an employee and as a teacher. Being able to feel delighted, or even assisted by error messages is a skill that takes deliberate practice and mental acuity. 

Below will serve as an ongoing list of resources in the ongoing fight to not let the blackhole win. I wish you deep breaths and cool hands, please leave your ideas in the comments below (and I'll concatenate 'em :)

1. Waking Up App - Sam Harris. 
Key Takeaways: This app changed my whole life. 10 minutes a day, 20 minutes if you are having a bad day. Mindfulness helps you put down your concepts and frustrations and allows you to sink into your body in the present moment. It can seriously help in untangling the knot. (And comes with a free 30 day trial!)

2. How To Deal With Anger as a Programmer by Antonio Cucciniello (https://simpleprogrammer.com/anger-management-programmer) / Key Takeaways: Stress is bad for your health! The sooner you can deal with this, the longer you will live, no bap.
3. WHY WON’T THIS WORK?! Coding Angry for Fun and Profit by Reto Meier (https://medium.com/google-developers/why-won-t-this-work-coding-angry-for-fun-and-profit-1ef38a2b7196) 
4. etc. ! Be well and take care of yourself :)
Linked Lists 
Tags: algorithms
Published: 2020-07-19 19:16:04

Linked lists are array-like lists that solve the issue of insertion and deletion of elements in an array. When you want to remove or add an element to an array you must move the rest of the elements in memory. This is costly to execution time which can easily be solved with linked lists. 

**Intro**

In a linked list each entry is represented as a node that contains its own data and a pointer to the next item in the list. This allows nodes to be anywhere in memory and makes it easier to remove and insert new nodes into the list. 

Since each node can be anywhere in memory when removing or adding an element the memory addresses of the existing elements do not need to change. The next sections cover the procedure of removing a node from a linked list and inserting a new node.

**Removal**

When removing nodes from a linked list you have to do three things. First, find the node that points to the node you want to remove. Then change the pointer in this node to point to the address that your removed node points to. Then delete the node you want gone, or if you are using a language with garbage collection allow it to be deleted by it having no reference to it in the program. And there you go you have deleted a node.

**Insertion**

When inserting a new node the process is similar to removal. First, decide where in the list you want the node to be. Then take the previous node and set its pointer to the address of your new node. The address that was in the previous node before must then be the address your new node points to. This part is important because without it the next node can be lost in memory or deleted. 


Linked lists are similar to arrays. They allow for faster removal and insertion of data than an array. For a simple application, I would not recommend using a linked list. 
####Linked lists are useful when:
 * you need time constant insertions and deletions
 * you do not know the number of items that will be in a list
 * there is no need for random access memory to the list 
  elements
 * you want to easily insert data into the middle of a list

####Conversely, there are many cases where an array is preferable such as:
 * when you need to randomly access list elements 
 * when the number of elements is known beforehand 
 * you need faster iteration through list elements
 * when memory is constricted, due to the fact that arrays take up less memory than linked lists.

Linked lists are a good tool to have under your belt as a developer. They are a good substitution to an array in certain cases. So with that said, enjoy implementing this in your next project. . .
Cleaner setTimeout Callbacks
Tags: javascript
Published: 2020-07-19 20:01:54


<p>Sometimes I'll write some code that needs to be wrapped in a setTimeout:</p>

```js
  setTimeout(myFunc, 1000);
```

<p>If my function took any arguments, it would bum me out by having to add additional lines to call it inside an separate callback:</p>

```js
  setTimeout(() => {
	myFunc(arg1, arg2);
  }, 1000);
```

<p>To keep things on one line, sometimes I'd bind the arguments to the function this way:</p>

```js
  setTimeout(myFunc.bind(null, arg1, arg2), 1000);
```

<p>But here's the money: <code>setTimeout</code> takes additional arguments that get passed to the supplied callback:</p>

```js
  setTimeout(myFunc, 1000, '🐄', '🍞'); // Logs "🐄 + 🍞 = 🍔"

  function myFunc(protein, carb) {
	console.log(`${protein} + ${carb} = 🍔`);
  }
```

<p>So now you can keep your fancy one-liners without binding! 📞</p>


<h3>Links</h3><a href="https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout" target="_blank">MDN Article on setTimeout</a>

----------
Check out more #JSBits at my blog, [jsbits-yo.com](http://jsbits-yo.com/). Or follow me on [Twitter](https://twitter.com/JS_Bits_Bill)!
Feedback - RestAPI.store
Tags: vue, restapi, startup
Published: 2020-07-19 19:55:58

Hello All,
I would love to introduce my hobby project - http://restapi.store

It's in progress project, Idea is to build API's for next project, 

I was struggling with validation of Email if this really exist or not in my current company project, as we were struggling with SPAM delivery of email and it hits reputation of IP Address.

That gives me the opportunity to start with Email Validation API which will in any project, to pre validate email id instead hit the reputation of email to avoid spam delivery. 

Apart from that you guys can give me suggestion, for more api's I will be implementing basic Authentication API using JWT token, 
email, image / file upload, image transformation as my upcoming plans. 

As these are the basic set's of API which is mostly needed in every project to start with, and maintain the USER data. 

Please suggest me and area of improvement so i can make it better product for betterment of next generation Project. 

Thank you for reading my article.
Putting dev.to on your LinkedIn?
Tags: discuss, career, beginners
Published: 2020-07-19 19:21:38

I recently saw [this](https://dev.to/isaacdlyman/put-devto-on-your-resume-48h9) post about putting dev.to on your resume, and I thought it was very helpful! I had put dev on my resume for some positions that were more specific to writing, but now I think I will keep it on there for all jobs. Having top posts on here is definitely one of my greatest/most measurable achievements as a very junior dev. 

Before this, I "had dev.to on my LinkedIn" but only as part of my "featured articles," the publications section, and a link to my profile.

So after seeing the resume post, I thought I could go another step in adding to my `Experience` section. I have the following currently:

![linkedin screenshot](https://dev-to-uploads.s3.amazonaws.com/i/zojoetrq7hxz7ggj5j52.png)

But imposter syndrome always has me worried that this is somehow... dishonest. I've always thought the `Experience` section on LinkedIn was solely for employment where you were paid. But... maybe that's too strict. So I wanted to post this and get general thoughts on it.