teleren/devto huggingface dataset:
javascript variable declaration: var vs let vs const 
Tags: javascript, beginners, interview
Published: 2019-10-18 11:07:49

We have 3 different ways to declare variables in java script
<ol>
<li><b>var</b> - Variables declared with var keyword are <strong>function scoped</strong>. What do I mean by that ? let's take an example -
<div class="highlight">
<pre class="highlight plaintext">
<code>
function sayHello(){
  for(var i=0;i<4;i++){
    console.log(i);
  }
  // As var is function scoped, i is available outside for loop.
  console.log(i); // This prints 4.
}
sayHello();
</code>
</pre>
</div>

Here, i is declared with var keyword in a for loop ( block ) and it is incremented util i < 4. When i becomes 4, the for loop ends and the last console.log(i) is executed.
<strong>Output</strong>
<div class="highlight">
<pre class="highlight plaintext">
<code>
0
1
2
3
4
</code>
</pre>
</div>

Because of the var keyword, i is function scoped hence i is available outside the for loop as well and last console.log() prints 4.
</li>

<li><b>let</b> -  This is part of ES6 and addresses the problem related to var keyword. Variables declared with <b>let</b> keyword are <strong>block scoped</strong>. 
Let's consider the previous code with let 
<div class="highlight">
<pre class="highlight plaintext">
<code>
function sayHello(){
  for(let i=0;i<4;i++){
    console.log(i);
  }
  // let is block scoped hence i is only visible inside for block.
  console.log(i); // This line will throw an error.
}
sayHello();
</code>
</pre>
</div>

Because i is declared with let, i is visible inside the for loop only and the last console.log() will throw an error <b>ReferenceError: i is not defined</b>
<br>
<b>Output</b>
<div class="highlight">
<pre class="highlight plaintext">
<code>
0
1
2
3
Uncaught ReferenceError: i is not defined
    at sayHello (<anonymous>:6:15)
    at <anonymous>:8:1
</code>
</pre>
</div>

</li>

<li><b>const</b> - const keyword is used to define constants in java scripts and are block scoped. e.g.
<div class="highlight">
<pre class="highlight plaintext">
<code>
function sayHello(){
	const i = 1;
	console.log(i);// This prints 1
	i = 2;  // i is declared as constant hence this line will throw an error.
}
sayHello();
</code>
</pre>
</div>
if we try to reassign i with a different value within the same block then java script engine will throw an error <b>TypeError: Assignment to constant variable</b>
<br>
<b>Output</b>
<div class="highlight">
<pre class="highlight plaintext">
<code>
1
Uncaught TypeError: Assignment to constant variable.
    at sayHello (<anonymous>:4:4)
    at <anonymous>:6:1
</code>
</pre>
</div>

</li>
</ol>

<b>Conclusion:</b> With var keyword we may get unexpected output, so if the value of a variable is not expected to change then <b>const</b> keyword should be preferred else use <b>let</b> keyword to define variables. 

Cheers!
About Dr. Mark Fleckner
Published: 2019-10-18 16:25:24

Dr. Mark Fleckner is a board-certified, fellowship-trained ophthalmologist who specializes in treating diseases affecting the retina, such as diabetic retinopathy and macular degeneration. Dr. Mark Fleckner’s practice strives to ensure that patients are comfortable and well informed about their treatment. 

Dr. Mark Fleckner completed his surgical vitreoretinal fellowship at Massachusetts Eye and Ear, a teaching hospital affiliated with Harvard Medical School. Prior to becoming a physician, Mark R Fleckner MD received a Bachelor of Arts degree in Economics from Duke University in 1989. Mark Fleckner went on to attend medical school at Tufts University School of Medicine, where he received his M.D. degree in 1993. Mark R Fleckner MD completed a residency in ophthalmology at the University of Medicine and Dentistry of New Jersey in 1997. 

In 2016 and 2017, Dr. Mark Fleckner was recognized as a “Top Doctor” by Castle Connolly Medical Ltd., a healthcare research and information company that seeks to help guide consumers to the nation’s best physicians. Mark R Fleckner MD is also named on Newsday’s list of “Top Doctors on Long Island.” In addition to this recognition, Dr. Mark Fleckner was recently named to ""New York Super Doctors,"" a directory of outstanding physicians in various medical specialties published by MSP Communications. 

Dr. Mark Fleckner has also been recognized as a ""Patients' Choice"" physician and a “Compassionate Doctor"" based on online patient reviews. Only physicians with excellent overall and bedside manner scores, as voted by their patients, are selected for these honors, according to the publisher. 

Mark R Fleckner MD has shared his expertise with other doctors, lecturing to medical groups on diabetic eye disease and other topics. Mark Fleckner is a diplomate of the American Board of Ophthalmology and the National Board of Medical Examiners, and a Fellow of the American Academy of Ophthalmology and the American Medical Association.
5K followers?! What the heck peeps?!
Tags: discuss
Published: 2019-10-18 18:30:58

---
title: 5K followers?! What the heck peeps?!
published: true
description: 
tags: #discuss
---

I just wanted to thank everyone who hit the "follow" button, I can't believe 5.000 of you did that! I'm not sure exactly what drove you into doing that, but I'll try to provide as much quality content as I can!

If there is anything specifically that made you follow me and you want more of it, leave a comment down below, you'd be helping me a lot!

BTW, I'm on [Twitter](http://twitter.com/deleteman123) as well, feel free to connect here too!
Hellow Lit-Element and React
Tags: litelement, react, webcomponents, pwastarterkit
Published: 2019-10-18 19:55:55

Hi everyBody ;u

I'm studing how web frameworks interop

Last sunday I tried to figure how to use [React-Datasheet](https://stackoverflow.com/questions/58110516/recomendation-eficient-spreadsheet-like-library-for-object-manipulation-in-java "Spreadsheet for Javascript") (link to spreadsheets like in javascript) with lit-element from [pwa-starter-kit](https://github.com/Polymer/pwa-starter-kit)

Well, React Dom works fine inside a ShadyDom, but I got [issues](https://github.com/nadbm/react-datasheet/issues/172) with how react library has been implemented. The component world helped me with already done work but that just as I needed React encapsulation.

To implement React Components inside Lit-Element(lit-html,customElement+shadyDom) is posible?

There is a considerations that I figure out reactComponents need to have

- dependencies: global objects

How to tell the webcomponent that document object is now the shadowRoot ;c
Creating my side-project in 2 weeks - day 1
Tags: laravel, vue, design
Published: 2019-10-22 20:27:23

**Intro:**
Hello guys, this is currently my first post on DEV. So let’s start!

📌 **Warning:** i’m not a professionnal developer and designer. I’m just a 17 years old boy who’s enchanted by dev technologies and wants to share my work. If you find issues and improvements, feel free to tell me!

PS: i’m french so maybe my english will be terrible sometimes - apologise for this.

# **Creating my side-project in 2 weeks**
## **First day: the basics**
**What’s my project idea?**

Let’s begin with the basics. I got the idea one day to have a web application that can be like a draft board, where you can add post-it and arrows etc. It’s already exist but not exatly like in my awesome brain. 

So with this idea, i started thinking about the name of the application, and found **Shineboard** - shine because it’s pretty cool and board cause it’s will be like a board. Convinced by this name, i bought the domain name [shineboard.io] (https://shineboard.io) at [OVH] (https://ovh.com), created the [Twitter] (https://twitter.com/Shineboardapp) account and ordered a VPS at [DigitalOcean] (https://digitalocean.com) to host the app.

**What is the goal of this post?**
I don't want to make a step-by-step tutorial on how i'm going to create this app, simply showing you the advancement every days.

I'm not going to create a full application - basically because it's impossible in 2 weeks, "simply" the [MVP] (https://en.wikipedia.org/wiki/Minimum_viable_product)

**Which framework/technologies?**
 I choose to use **Laravel** for the backend cause it’s in PHP - ❤️ - and it’s just so well documented and builded (also i have already experiences with it). And for the frontend ? I wanted to make the application a **SPA** so i started looking around for a framework that can handle this, and found that **VueJS** also can be a SPA with the help of VueRouter and Vuex - and that’s good because i also have experiences with it.

**Preparing the terrain**
I created the gitlab repository, which only contains a fresh Laravel application with basic login, using VueRouter for the SPA.

I started creating a basic ui library for buttons, inputs etc. And because i enjoyed building theses components, i created the starting of a landing page. Here is the result on mobile, i’m pretty happy with the design (of course it’s not the final design, there will be a lots of improvements). 

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

**Next day**
Next day i’m going to create a first card design, and search to create a draggable effect for theses.
[Go] Speed up your refactoring with GoLand
Tags: go, goland, refactoring
Published: 2019-10-19 15:34:32


{% youtube oCgoxqDS2tM %}

This is a video demo, how to use different refactoring feature in GoLand to speed up you productivity when doing refactor.

Original example is from "extract variable"  section of refactoring 2/e.
Rewriting it with golang.

# Code smells:
1. magic number
2. comments don't match code behavior

# Refactoring features:
1. extract variable(ctrl+alt+v)/ extract const(ctrl+alt+c)
2. extract method(ctrl+alt+m)
3. inline variable(ctrl+alt+n)
4. move method to struct(manual)
5. move struct and receiver functions(F6)


more useful features in GoLand: [top 25 editing features of goland](https://blog.jetbrains.com/go/2019/10/04/top-25-editing-features-of-goland-ide-part-1/?fbclid=IwAR125gX08h1OjIrr2bD55JyT4ptmBYs5yIMT3YZc_mlu6zdi7Jfbi5PEoFc)
Easy Model Validator csharp
Tags: webdev, csharp, beginners, productivity
Published: 2019-10-20 14:27:13

---
title: Easy Model Validator csharp 
published: true
description: An easy method of validating any object by using validation attributes outside of the MVC context  
tags: webdev, csharp , beginners , productivity
cover_image: https://thepracticaldev.s3.amazonaws.com/i/t7sfacwbua66lgv67nqc.jpg
---
This article will explain a cool way of validating a model or any object by using the Validation attributes To validate a Model in MVC you make use of [Model Validation Attributes](https://docs.microsoft.com/en-us/aspnet/core/mvc/models/validation?view=aspnetcore-3.0) like this

```c#
class ContactModel
{
[Required, RegularExpression(@"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}" +
    @"\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\" +
    @".)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$",
ErrorMessage = "Email Format Error")]

public string Email { get; set; }

[Required] public string Name { get; set; }

}

```

and then you will validate it like this

```c#
public class ContactController : Controller
    {
        [HttpPost]
        public async IActionResult AddContact(ConatctModel model)
        {
            if (!ModelState.IsValid){
               // throw new Exception("Model Failed") 
            }

            //The model is valid 
            //do your logic here
        }
    }
```

but what if you want to use the ContactModel class in your own logic and not in the MVC Controller but still you may need to validate the model before usage or maybe you have a normal POCO class and you want to validate that in clean way in a scenario like this 


```c#
public class ContactHelper
    {
        public void ContactHandler(ContactModel model)
        {
            if (!model.IsValid){
               // throw new Exception("Model Failed") 
            }

            //The model is valid 
            //do your logic here
        }
    }
```

this was the motivation to create the EasyModelValidatorExtension which can help you validate any object by simply adding the validation attributes in that object

```c#
 public static class EasyModelValidatorExtension
     {
        public static bool IsValid<T>(this T model)
        {
            try
            {
                var vc = new ValidationContext(model, null, null);
                var result = Validator.TryValidateObject(model, vc, null, true);
                return result;
            }
            catch (Exception e)
            {
                throw new ModelValidationException("Model Validation has Failed", e);
        }
     }
}
```

you can add this extension in your project or simply use [EasyModelValidator](https://www.nuget.org/packages/EasyModelValidator/) Nuget 

```
dotnet add package EasyModelValidator
OR 
Install-Package EasyModelValidator

```

you can find the Source code [here](https://github.com/alicommit-malp/com.appelinda.nuget.easyModelValidation)

Happy coding :)
Change Navigation Based On View With Vue JS
Tags: vue, tutorial, javascript
Published: 2019-10-21 07:43:32

#My thoughts

Imagine, you have a website with a navigation, which is not responsive, and the goal is to build a mobile variation. How can you do this without CSS media queries? And what kind of benefits do you have with Vue JS?

Should be the mobile version utterly different from the desktop variation, starting from the HTML structure, over the functionality and until to the CSS styling, then, of course, the implementation can be quite difficult.
And if you wanna implement this with CSS media queries and many javascript conditions, for example, that can be a bit annoying and confusing.

So, in my opinion, it's a better solution to create a different Component for the mobile navigation and use the reactivity from Vue JS to switch between these components, based on the current viewport.

#Handle the current view

The core idea is to check out the current innerWidth with your specific breakpoint and hold the status (true or false) in a local data attribute. In the App.vue Component or in the Component you want to handle the navigation.

```javascript
methods: {
    handleView() {
        this.mobileView = window.innerWidth <= 990;
    }
}
```

#Use your method

Next, you can use the created lifecycle hook and fire your method if the Component is created. Further, you have the opportunity to bind the method with an eventListener to the browser resize event. 

This will allow you to run the method again if the user changes the browser size.

```javascript
created() {
    this.handleView();
    window.addEventListener('resize', this.handleView);
}
```

#And Now?

Now it's pretty easy to show either the mobile version or the normal navigation in your template depending on your mobileView status. 

```html
    <NavigationMobile v-if="mobileView" />
    <Navigation v-else />
```

#My YouTube Tutorial about this topic

In this tutorial, I show you step by step, how you can implement this in a Vue JS project. 

{% youtube lga-ceawtmw %}

#Conclusion

With this solution, you have both cleanly separated and can also use and adapt independently. 

What are your thoughts?

Would you rather use CSS Media queries?

Thanks for reading and watching.
VSCode debugger config with Mocha and Babel 7
Tags: tutorials
Published: 2019-10-30 10:11:23

---
title: VSCode debugger config with Mocha and Babel 7
published: true
date: 2019-10-15 16:05:06 UTC
tags: Tutorials
canonical_url: https://boobo94.xyz/tutorials/vscode-debugger-config-with-mocha-and-babel-7/?utm_source=rss&utm_medium=rss&utm_campaign=vscode-debugger-config-with-mocha-and-babel-7
---

_The post [VSCode debugger config with Mocha and Babel 7](https://boobo94.xyz/tutorials/vscode-debugger-config-with-mocha-and-babel-7/) appeared first on [boobo94](https://boobo94.xyz). So if you want to read more articles like this please [subscribe to my newsletter](https://boobo94.xyz/#colophon) or follow me here_

VSCode debugger is a very nice tool that you can use in every project. I personally prefer VSCode for most programming languages that I write code. The minimalism and extendability make it very powerful.

If you wanna know more about my VSCode configurations and extensions that I use check [VSCode setup for web development: settings and extensions](/tips/vscode-setup-for-web-development-settings-and-extensions/).

These days I tried to configure the VSCode debugger for a Node.js project that I’m working on in testing mode. I use [Babel 7](https://babeljs.io/docs/en/) and [Mocha](https://mochajs.org/) framework for tests. Apparently everything looks very simple and intuitive because the VSCode offers support to create a new config for different tasks, so I choose the default one for Mocha.

I encountered a few issues trying to run the VSCode debugger with Mocha and Babel 7, but the configuration is not very hard and can be shown below:

```json
{
      "type": "node",
      "request": "launch",
      "name": "Mocha Tests",
      "program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
      "runtimeArgs": [],
      "args": [
        "${workspaceFolder}/test/**/*.js",
        "--require",
        "@babel/register",
        "-u",
        "bdd",
        "--timeout",
        "999999",
        "--colors"
      ],
      "env": {
        "NODE_ENV": "test",
      },
      "internalConsoleOptions": "openOnSessionStart"
    }
```

Firstly I had to change the type from **tdd** to **bdd** , because Mocha runs as bdd. Secondly is very important to pass the needed plugins in order for Node to interpret the code correctly. Please observe **–require @babel/core**.

If you like the article and consider it helpful please take the tiger out of the cage and inform others about it. Please share it with your people and [subscribe](/#email-subscribers-form-5) to my newsletter. Don’t forget to leave me a comment about your opinion related to this article and ask me some questions.

_The post [VSCode debugger config with Mocha and Babel 7](https://boobo94.xyz/tutorials/vscode-debugger-config-with-mocha-and-babel-7/) appeared first on [boobo94](https://boobo94.xyz). So if you want to read more articles like this please [subscribe to my newsletter](https://boobo94.xyz/#colophon) or follow me here_
What do you do while you code?
Tags: discuss, coding
Published: 2019-10-21 19:28:22

‪I constantly find myself needing to watch #political debates or #documentaries while coding. Maybe not to watch it constantly but to have the background noise as well.‬

‪            ☝🏾☝🏾☝🏾☝🏾☝🏾☝🏾☝🏾‬
‪Am I the only one that does this???‬

If so what do you do while working?
Flip clock in SwiftUI
Tags: ios, swift, swiftui, combine
Published: 2019-10-22 12:17:58

SwiftUI is a new framework designed and released by Apple in 2019. It completely changes the approach to building UI on Apple devices. Compared to predecessors (UIKit, WatchKit, AppKit), you can write code only once and use it on every Apple platform. It saves much time while building multiplatform apps. Another big difference is the programming paradigm change from imperative to declarative one. The focus shifts from writing step by step how to create something, to declaring the result we want to achieve. I’m 100% sure that these changes have a lot of advantages, and shortly many applications will be created using SwiftUI. Now it’s a perfect time to get familiar with it and learn how to use it. Below you can see the result of my adventure with SwiftUI.

### [Implemetation](https://github.com/elpassion/FlipClock-SwiftUI)

|Light|Dark|
|:-:|:-:|
|![Light_preview](https://raw.githubusercontent.com/elpassion/Showcase/master/content/FlipClock-SwiftUI/flip_clock_light.gif)|![Dark_preview](https://raw.githubusercontent.com/elpassion/Showcase/master/content/FlipClock-SwiftUI/flip_clock_dark.gif)|

## License

Copyright © 2019 [EL Passion](https://www.elpassion.com)
Make Your Websites 10x faster with Modern Technologies - SSGs and Many More
Tags: javascript, serverless, showdev, beginners
Published: 2019-10-22 15:27:08

Static site are  much cheaper and faster option than any other dynamically available websites or wordpress. What is static site? Static site means making website with static site generator. This are many static site generator to this work. 1000s of static site generator are available but not every static site generator is perfect.
___
I got an order one project with any to make a blog but it needs to be static. I  chooses Hugo for making this project. I was learning Hugo. After learning I started working an a project. I was not understanding _index.md file logic. I cannot learn gatsby or gridsome because I don't know any JS framework yet. I tried more
___
I was confused and there docs were crap.
There are some of the SSGs I tried:
-Jekyll (Github)-
-Nikola (python)-
-Jigsaw (Php)-

Then I get used to 11ty it is such as beautifull static site generator and I am much comfortable with JS. So I deliver to my customer a static site running 11ty on it.
Learn React.js - Full Course for Beginners
Tags: react, javascript, webdev, tutorial
Published: 2019-10-23 03:05:59

Learn the complete React-Redux front end system: React.js, Redux, React Router, React Hooks and Auth0

Other courses have made partial updates to older techniques and code, but this course is built from the ground up to include the most latest code and techniques from 2019+. You are getting the complete integrated modern techniques and code for React and Redux that are used in development today.

**What you'll learn:**
* The Most Modern Version of React and Redux
* Modern Authentication and Routing Patterns
* The Knowledge and Skills to Apply to Front End Jobs
* How React Works Under the Hood
* The Knowledge to know how different Front End Technologies work together (enough knowledge to impress other engineers)
* Modern ES5, ES6, ES7 Javascript Syntax.

{% youtube QFJDYwu15jE %}
About polaris ussd
Tags: ussd, transfer, code
Published: 2023-02-15 16:36:23

[https://www.bankfanz.com/how-to-check-polaris-bank-account-balance/](https://www.bankfanz.com/how-to-check-polaris-bank-account-balance/#utm_source=backlinks&utm_medium=search&utm_campaign=darry+ring+us&utm_content=Michelle)

https://plaza.rakuten.co.jp/polarisbank18/diary/202302150000/
https://www.divephotoguide.com/user/polarisbankcode25
https://www.producthunt.com/@polaris_code25
https://www.provenexpert.com/polarisbankcode25/
https://vocal.media/authors/polaris-bank-code-25
https://wakelet.com/@polarisbankcode2596
https://www.lifeofpix.com/photographers/polaris_bank_code25/
https://rosalind.info/users/polaris-bank-code25/
http://phillipsservices.net/UserProfile/tabid/43/userId/200160/Default.aspx
https://camp-fire.jp/profile/polaris_bank_code25
https://app.roll20.net/users/11632110/polaris-bank-code-25-c
https://seedandspark.com/user/polaris-bank-code-25
https://plazapublica.cdmx.gob.mx/profiles/polaris_bank_code25/activity
https://www.metal-archives.com/users/polaris_bank_code25
https://trabajo.merca20.com/author/polaris_bank_code25/
https://www.intensedebate.com/people/Polaris_25
https://www.mifare.net/support/forum/users/polaris_bank_code25
https://pinshape.com/users/2575276-polaris-bank-code25#designs-tab-open
https://www.kiva.org/lender/polarisbankcode254002
https://www.credly.com/users/polaris-bank-code-25/badges
https://www.myminifactory.com/users/polarisbankcode25
https://www.sqlservercentral.com/forums/user/polaris_bank_code25
https://guides.co/a/polaris-bank-9984
http://foxsheets.com/UserProfile/tabid/57/userId/121106/Default.aspx
https://storium.com/user/polaris_bank_code25
https://speakerdeck.com/polaris_bank_code25
https://www.kompasiana.com/polarisbankcode25
https://www.longisland.com/profile/polaris_bank_code25
https://myanimelist.net/profile/Polaris_code25
https://leanin.org/circles/polaris-bank-code-25
https://social.msdn.microsoft.com/Profile/polaris_bank_code25
https://www.iheart.com/podcast/269-toneman-108983102/episode/polaris-bank-code-25-108983103/