teleren/devto huggingface dataset:
Manage your code as a successful restaurant
Tags: improvement, cleancode, simplicity
Published: 2020-05-15 05:37:51

---
title: Manage your code as a successful restaurant
published: true
date: 2020-05-15 05:00:00 UTC
tags: improvement, cleancode, simplicity
canonical_url: https://gsferreira.com/archive/2020/05/manage-your-code-as-a-successful-restaurant/
---

Have you ever noticed that a successful restaurant has a shorter menu? Especially when compared to those who are struggling.

Why?! **Simplicity!**

When you keep things simple, you focus on fewer things. You give your best and you can focus your effort. You can try to improve and perfect all details.

But, when life doesn't work as we expect, we start throwing new dishes into the menu. Expecting to please everyone.

![Complex menu](https://gsferreira.com/images/manage-your-code-as-a-successful-restaurant-complex-menu.jpeg)

**_Spoiler alert: When you build something to everyone, you build it to nobody._**


This isn't just the restaurants' reality. We see that in software too. When trying to convince new customers, throwing features into a product is usually the way to go. And it's hard to find a Product Owner who doesn't fight to have the team focused on new features.

What we should all be doing is to **focus on what we have and what customers love.** Those features have a margin to improve. **Don't bring a new feature into the product just because a customer needs it. Bring it because is inevitable.** Because it's obvious that your software will be so much better. Because you believe that you are in an especial condition and nobody can do it better than you. And don't forget to throw away stuff that doesn't "spark joy". 


We can expand this concept to multiple software parts. High level, to a low level. Decompose the code in smaller objects or functions. Create focused "restaurants" specialized in one task. If you want Mexican food, you don't look for an Italian restaurant.

**Treat your code as a garden, which deserves care and dedication.** Don't write it and ignore it until a bug arises. 

A chef who creates new dishes every single night will create a few stunning dishes for sure. But also, a vast number of massive failures.

Having a continuous improvement mindset is what makes us better than the rest.
Free Company Profile Template
Tags: vue, quasarframework, javascript
Published: 2020-05-15 04:37:08

Hello all, I would like to share the free Company Profile Template which I have made using Quasar Framework & Vue.js.

https://github.com/mayank091193/vue-quasar-company-profile-website

Also, a live preview is available at the following link.

https://quasar-company-profile-template.netlify.app/

I would like to get any kind of feedback. Thank you.
Convert designs into working code, introducing Xd to Flutter plugin 
Tags: news, flutter, xd, discuss
Published: 2020-05-15 04:16:16

I love using Adobe Xd to create designs for websites, apps, voice interfaces, games, and more. The best part is that it allows creating prototypes that behave like working product.

Export your designs into the working code sound magical to me. I used to think of exporting the webpage designs into HTML CSS code.

Google and Adobe understood this and came up with Xd to Flutter plugin that generates code for creating apps with Flutter based on your designs in Adobe XD. An XD prototype can now become a working Flutter code within minutes.

How cool is that!

Adobe Xd team made the plugin open-source
{% github AdobeXD/xd-to-flutter-plugin no-readme %}

Check out this [tutorial](https://medium.com/flutter/announcing-adobe-xd-support-for-flutter-4b3dd55ff40e) to understand how to use the plugin.

Reference blog []()https://theblog.adobe.com/xd-flutter-plugin-generate-dart-code-design-elements/
Caching mind map, from my notes
Tags: caching, mindmap, memory
Published: 2020-05-15 04:16:04

Caching from my notes. Caching (pronounced “cashing”) is the process of storing data in a cache. 

Download and Zoom the specific area to read it properly.
 


![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/ghc9xiunuma4hl5iymq9.png)
Options for Minimal CSS
Tags: css, cssreset, cssnormalize
Published: 2020-05-15 04:09:42

In search of modern CSS libraries useful as a starting point. I'm less interested in an actual CSS framework, because in my experience years ago, the frameworks are generally bloated, difficult to troubleshoot, and sometimes tricky to override reliably without using !important.

Normaliz was always my normal go-to (after roaming through various css resets) when I want to start with "nothing". As far as I can see right now, nothing better has come along, and normalize.css is apparently still quite sufficient.
http://necolas.github.io/normalize.css/

PureCSS has a relatively small footprint, when compared with other CSS frameworks. Based on normalize.css. 3.7kb gzipped.
https://purecss.io/

Milligram. I can't quickly form a significant opinion on it, but it's worth looking at. Also based on normalize.css. 2kb gzipped.
https://milligram.io/
https://github.com/milligram/milligram

Mini.css is clearly interesting. Exciting actually. Build your flavor gives us the default values and opportunity to change them before downloading a custom "flavor".
https://minicss.org/
https://minicss.org/flavors

Skeleton CSS. Boilerplate, so it says in the tagline.
http://getskeleton.com/

Bulma definitely doesn't count as minimal, but I'm inclined to give it a closer look when I get a chance.
https://bulma.io/
Deno v1.0 ออกแล้ว! ตัวเลือกใหม่สำหรับ JavaScript Runtime แทน Node.js
Tags: deno, node, javascript, news
Published: 2020-05-15 04:03:44

Deno เป็นเอ็นจิน runtime ที่เอาไว้รันภาษา JavaScript (และ TypeScript) คล้ายๆ กับ V8-Engine ที่ใช้ใน Node.js 

สร้างโดย Ryan Dahl ที่เป็นผู้เริ่มโครงการ Node.js ตั้งแต่ปี 2009 
ตอนแรกพัฒนาด้วยภาษา Go แต่เปลี่ยนไปเขียนด้วยภาษา Rust แทนในภายหลัง (V8 ใช้ C++)


## ฟีเจอร์เด่นๆ ของ Deno
- Support TypeScript: นี่น่าจะเป็นข้อดีอันดับต้นๆ เลยล่ะ เพราะตามกฎการเขียน JavaScript ที่กล่าวไว้ว่า "คุณไม่ควรเขียน JavaScript!...ให้เขียน TypeScript แทน" (ฮา)
- Security by default: แอพพลิเคชันที่รัน จะไม่สามารถเข้าถึงระบบ File System, Network, หรือพวก Environment ได้เลยถ้ายังไม่มีการกำหนดสิทธิตอนรันให้ เช่นต้องใส่ flag `--allow-net` เพิ่ม
- มี build-in utilities ให้ใช้ เช่น dependency inspector, code formatter
- สำหรับ standard modules นั้นมีกลุ่ม reviewer คอยเช็กความถูกต้องและเทสเพื่อการันตีว่ามันทำงานได้เวิร์คจริงๆ นะ

## มี Node.js อยู่แล้ว จะสร้าง Deno มาทำไม?
Ryan Dahl ผู้สร้าง Deno บอกเอาไว้ว่า
JavaScript นั้นเปลี่ยนไปมากหลังจาก Node.js ถูกสร้างขึ้นตั้งแต่ปี 2009
อารมณ์ก็คล้ายๆ กับภาษา PHP ที่ไม่ได้ออกแบบโครงสร้างที่ดีมาตั้งแต่ต้น พอจะต่อเติมอะไรเข้าไปเพิ่มก็ทำได้ยาก 

เช่น Module System นั้นออกแบบมาไม่ดีตั้งแต่แรก, มี API เก่าที่ควรเลิกใช้ได้แล้วแต่ก็ยังต้องทำงานอยู่, ความปลอดภัย

Ryan Dahl บอกว่าถึงแม้ Deno มันจะหน้าตาดูคล้ายๆ Node.js แต่มันถือว่าเป็นคนละตัวกันเลยนะ ตอนนี้ Deno ยังใหม่มาก อาจจะยังไม่เหมาะกับการใช้งานในบางโปรเจค โดยเฉพาะโปรเจคที่ยังต้องพึ่ง library จาก `npm` อยู่

### installation
เข้าไปดูจาก https://deno.land/ ได้เลย

## Hello World
ตัวอย่างการสร้าง server แบบง่ายๆ จะเห็นว่ามันเป็น JavaScript นั่นแหละ แต่มันไม่ใช่ Node.js 
```js
import { serve } from "https://deno.land/std@0.50.0/http/server.ts";

const s = serve({ port: 8000 });
console.log("http://localhost:8000/");

for await (const req of s) {
  req.respond({ 
    body: "Hello World\n" 
  });
}
```

Deno เพิ่งออกเวอร์ชัน 1.0 ตอนนี้ก็ต้องรอดูกันต่อไป ว่าไดโนเสาร์ตัวนี้จะมาแทน Node.js ได้ในอนาคตหรือไม่?
Programmatically Opening Bootstrap Vue Dropdown
Tags: javascript, vue, beginners, webdev
Published: 2020-05-15 04:01:06

## The Skinny || TLDR;

- If you're using Bootstrap Vue's dropdown found [here](https://bootstrap-vue.org/docs/components/dropdown), and you want to programmatically open the dropdown, simply add `class="show"` when you want the dropdown to be open. The implementation can look something like:

```vue
<b-dropdown class="dropdown" :class="{ show: isOpen }"> // thanks psimyn
```

Sometimes I spend so much time trying to figure out such a what-I-thought to-be-simple problem when building a feature, I feel like its my duty to share it.

## Whats the issue?

Well this week I was working on building a feature that involves Bootstrap Vue's dropdown. I built the off click to close the dropdown, did the search thingy I needed to, debounced it, but I COULDN'T OPEN THE DROPDOWN PROGRAMMATICALLY! WHERE ARE THE ANSWERS!!!

## The Approach

I looked through the Bootstrap Vue docs and could not find out how to do this anywhere! Stackoverflow...nothing except some recommendations using Jquery, which I really didn't want to do. Long story..don't ask.

> AHA!

Let's go to bootstraps [docs](https://getbootstrap.com/docs/4.0/components/dropdowns/), cause Bootstrap Vue is built off of Bootstrap. Of course! This must be the way, or `la manera` in Spanish ;)

## The Solution

Conditionally add the class `show` to the dropdown.

Hope you enjoyed reading! Read more from me @ https://scottistern.com!

## Resources
- https://getbootstrap.com/docs/4.0/components/dropdowns/
- https://bootstrap-vue.org/docs/components/dropdown
- https://vuejs.org/v2/guide/class-and-style.html
Well and truly uninstantiable Java classes
Tags: java
Published: 2020-05-15 03:38:33

~~~
public class Privileged {
    public Privileged(){
        super();
        checkPermissions();
    }
}
~~~

Is insufficient due to tricks with race conditions.

~~~
public class Privileged {
    public Privileged(){
        this(checkPermission());
    }
    private Privileged(Void dummy) {}
}
~~~

Is the proper procedure
New MongoDB plug-in for VS Code 
Tags: mongodb, javascript, programming, beginners
Published: 2020-05-15 03:29:11

---
title: New MongoDB plug-in for VS Code 
published: true
description: MongoDB plugin for Visual Stdio Code
tags: mongodb, javascript, programming, beginners 
cover_image: https://images.unsplash.com/photo-1488590528505-98d2b5aba04b?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1950&q=80
---

For all developers that use MongoDB in the day of day and type command by example in the mongo shell or other better GUI, finally has been release a plugin for Visual Studio Code to connect with any instance of MongoDB.

Download it from the Visual Studio Code Marketplace.

![install mongoDB](https://i.ibb.co/k6JDC8w/Screen-Shot-2020-05-14-at-21-03-12.png)

The plugin will appear in the left side.

![mongoDB plugin](https://i.ibb.co/18F4WVL/Screen-Shot-2020-05-14-at-21-17-50.png)

Now add a new connection and populate the fields with the information about your MongoDB server.

![Add new instance of MongoDB](https://i.ibb.co/SKrZRvz/Screen-Shot-2020-05-14-at-21-21-04.png)

Visualize and navigate your data as directory tree.

![Visualized data](https://i.ibb.co/cyBRYXj/Screen-Shot-2020-05-14-at-21-29-12.png)

### Playing with Playgrounds.

The shell in MongoDB is an interpreter of JavaScript, so the plugin let you use the same commands. For start to use Playgrounds just click in the three point and will appear a menu then click in Create MongoDB Playground.

![MongoDB Playgrounds](https://i.ibb.co/Fb913Cn/Screen-Shot-2020-05-14-at-21-32-39.png)

Start to type command and the plugin will autocomplete the next options.

![Autocomplete MongoDB](https://i.ibb.co/5sqZfP1/Screen-Shot-2020-05-14-at-21-33-22.png)

When the Playground is execute all the commands will be executed and showed in the terminal. I hope this will be fixed in the future.

![Results MongoDB](https://i.ibb.co/wzrsdXt/Screen-Shot-2020-05-14-at-21-40-46.png)

## Conclusion

This new plugin is really awesome and it have a good and interesting features (most indispensable) and I'm sure this helps to many of us as developers to be more productive and happy using MongoDB.

Check for more information: [https://marketplace.visualstudio.com/items?itemName=mongodb.mongodb-vscode](https://marketplace.visualstudio.com/items?itemName=mongodb.mongodb-vscode)
Implement Trie (Prefix Tree) - LeetCode
Tags: design, trie
Published: 2020-05-15 02:49:35

---
title: Implement Trie (Prefix Tree) - LeetCode
published: true
description: LeetCode Medium Problem
tags: Design, Trie
---

# What is Trie?

Trie (or prefix tree) is a data structure, which is used for retrieval of a key in a dataset of a strings

Trie is used for AutoCompletion (google search), Spell Checker etc

Trie is a rooted structure, something like below which represents DEV

```js
root = {children: {
	d: {
		children: {
			e: {
				children: {
					v: {}
				}
			}
		}
	}
}}
```

Every character will hold children which can be extended

Let's create a Data Structure for trieNode

```js
var trieNode = function() {
	this.children = {}
	this.end = false
}
```

Now we have children, which can store letters as a tree and we need *end* to differentiate whether the word provided in search has ended or not

## For the case of insert

```js
Trie.prototype.insert = function(word) {
	let root = this.root
	for(letter of word) {
		if(root.children[letter]) {
			root = root.children[letter]
		} else {
			root.children[letter] = new trieNode()
			root = root.children[letter]
		}
	}
	root.end = true
};
```

We loop through each letter of the word and if it exists in trieNode, we update root to root.children[letter] else we create a new trieNode at root.children[letter] and then assign root to root.children[letter]

After the loop, set root.end to true to denote it's a word

## For the case of search

```js
Trie.prototype.search = function(word) {
	let root = this.root
	for(letter of word) {
		if(root.children[letter]) {
			root = root.children[letter]
		} else {
			return false
		}
	}
	return root.end
};
```

We implement same solution but to check whether the letter exists in the trieNode, if it doesn't return false. If it exists check whether that's the end of the node.

## For the case of startsWith

This is same as search but at the end of the loop you don't have to check whether end of trieNode is true or not

Here's the Code:

```js
var trieNode = function() {
	this.children = {}
	this.end = false
}

var Trie = function() {
	this.root = new trieNode()
};

Trie.prototype.insert = function(word) {
	let root = this.root
	for(letter of word) {
		if(root.children[letter]) {
			root = root.children[letter]
		} else {
			root.children[letter] = new trieNode()
			root = root.children[letter]
		}
	}
	root.end = true
};

Trie.prototype.search = function(word) {
	let root = this.root
	for(letter of word) {
		if(root.children[letter]) {
			root = root.children[letter]
		} else {
			return false
		}
	}
	return root.end
};

Trie.prototype.startsWith = function(prefix) {
	let root = this.root
	for(letter of prefix) {
		if(root.children[letter]) {
			root = root.children[letter]
		} else {
			return false
		}
	}
	return true
};
```
Simple service to get the public IP address - ipaddress.sh
Tags: ipaddress, sideprojects, beginners, linux
Published: 2020-05-15 01:45:17

Hope everyone is doing fine. This is my first devpost and wanted to share this side project I was working on. 

https://ipaddress.sh - It's a simple service to get the public IP address based on [IPIFY API](https://www.ipify.org/)

```bash
#Get Public IP address
$ curl ipaddress.sh
151.101.2.217

```

Even though lots of services like this exist already (My favorite - icanhazip), tinkering with the open source code is helping me learn Go and API development. 

This service is hosted on heroku and is not rate-limited. 

Hope it's useful and easy to remember. 

Thanks for reading!

More info: https://about.ipaddress.sh
Deno on Cloud Run
Tags: deno, javascript, docker, googlecloud
Published: 2020-05-15 01:40:08

Deno 1.0 launched just 24 hours ago! So we’re going to install Deno and set up a web server. Then we’ll containerize and deploy it to Google Cloud Run, Googles fully managed compute platform for deploying and scaling containerized apps quickly. Think Cloud Functions meets Docker.

[Try the code yourself](https://bit.ly/DenoCloudRun)

I upload videos like this one as well as live stream coding session on my [YouTube channel](https://www.youtube.com/channel/UCZxtkm5msn0r1etbzvGZx5A).

---

To keep up with everything I’m doing, follow me on [Twitter](https://twitter.com/MichaelSolati) and [dev.to](https://dev.to/michaelsolati). If you’re thinking, _“Show me the code!”_ you can find me on [GitHub](https://github.com/MichaelSolati).
📦 Interrogate is a pretty awesome, brand new, cli for Python packages
Tags: devops, opensource, python
Published: 2020-05-15 01:38:15

---
title: 📦 Interrogate is a pretty awesome, brand new, cli for Python packages
published: true
tags: devops, opensource, python
canonical_url: https://waylonwalker.com/blog/interrogate-is-a-pretty-awesome-brand-new-cli-for-python-packages/
cover_image: https://waylonwalker.com/static/bca727f95d30fda9d89d440f0148d872/a8734/interrogate-python.png
---

As usual while listening to [python bytes 181](https://pythonbytes.fm/episodes/show/181/it-s-time-to-interrogate-your-python-code) I heard of a tool that I had to try out right away!

This thing is 🔥 hot off the press folks, we're talking the first release only 3 weeks ago. Its something that the python community needed years ago, and it belongs in your CI **today**. I had tried several tools that tried to do docstring coverage in the past but they were a bit cumbersome and were quickly forgotten about. Not interrogate, its dead simple!

> Nothing I have tried has come close to being this good

# Interrogate

It runs documentation coverage for your python project. It allows you to set the minimum amount of docstring coverage for your project and has some great setup instructions right in the readme.

## Install it

Interrogate is on pypi so it is super simple to install with `pip`

```
pip install interrogate
```

## run it

This is the best part, its super easy to run right from the command line! Just call it, and give it a path to run.

```
interrogate -v <path>
```

## 😲 I have some work to do

One of my new open source packages [find-kedro](https://find-kedro.waylonwalker.com/) only hit 71%.

```
interrogate find-kedro -v
```

![verbose interrogate on find-kedro](https://waylonwalker.com/interrogate-python-v.png)

Personally I really like the **double verbose** output that gives you the names of everything missing a docstring and the line they occur on.

```
interrogate find-kedro -vv
```

![double verbose interrogate on find-kedro](https://waylonwalker.com/interrogate-python-vv.png)

## Give it a ⭐
Every project this amazing deserves a big ol ⭐ on GitHub! Go over to [econchick/interrogate](https://github.com/econchick/interrogate) and give it a one... it deserves it! While you are there check out the **wicked** good readme. It has great examples of how to run it from your command line, as a pre-commit hook, in your ci, with your code, or pyproject.toml.

> While you are there check out the **wicked** good readme!

## What do you think? 👇

Leave it in the comments on what you think the minimum docstring coverage for a project should be.
Comparing variables in Javascript
Tags: javascript, todayilearned, webdev
Published: 2020-05-14 21:52:04

As I go through the job search process, I like to keep track of questions that I've been asked that I don't exactly know the answer to but feel like I should. To alleviate these feelings, I'm making an effort to keep track of these questions and then write short posts on them to hopefully:

1. Solidify these concepts for myself, so I'll be more prepared in the next interview

2. Help another developer understand these concepts so they may be more prepared if they are asked these questions in the future

###Question###

*What is the difference between '==' and '==='?*

###Answer###

These are known as comparison operators and Javascript has both  **type-converting** and **strict** comparisons. 


**Type-converting** comparisons (e.g. ==) will first convert the elements to the same type (if they aren't already) and then make the comparison.

```javascript
1 == 1 // true
'1' == 1 // true
1 == '1' // true
0 == false // true
0 == null // false
0 == undefined // false

var object1 = {'key' : 'value'}, object2 = {'key': 'value'}
object1 === object2 // false

null == undefined // true 
```

**Strict** comparisons (e.g. ===) will only return true if the elements on both sides are of the same type.

```javascript
3 === 3 // true
3 === '3' // false

var object1 = {'key' : 'value'}, object2 = {'key': 'value'}
object1 == object2 // false

null === undefined // false 
```

###Follow-up Question###

*What would be the output of "null == undefined" and "null === undefined" in Javascript and why?*

###Answer###

As you can see from the code above, based on the comparison operator, one of these is true, whereas the other one is false. 

```javascript
console.log(typeof null) // object
console.log(typeof undefined) // undefined
```

Null == Undefined, with a type-converting equality operator, returns true because Null and Undefined are two different data types in Javascript. Null is considered an object, and Undefined is considered a type of undefined. Since these are two separate data types, the '==' converts null and undefined to the same type and then compares them and since they both represent an empty value, they are considered equal in the abstract sense. 

As for Null === Undefined, this is a false statement, because they are inherently not the the same data type (object vs. undefined) and thus, this is strictly false. 

Happy coding! :)

More resources:

https://developer.mozilla.org/en/US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators

https://levelup.gitconnected.com/javascript-null-vs-undefined-2acda986f79f
Algorithms in LaTex
Tags: latex
Published: 2023-01-06 01:23:05

---
title: Algorithms in LaTex
published: true
date: 2020-05-15 01:31:28 UTC
tags: LaTex
canonical_url: https://brandonrozek.com/blog/algorithmiclatex/
---

There’s a great package in LaTex called [`algorithm`](https://ctan.org/pkg/algorithms?lang=en) to help format psuedo-code algorithms for scientific papers. Here’s a simple example of its usage:

```
\usepackage{algorithm}
\usepackage[noend]{algpseudocode}
\begin{algorithm}
\caption{Even Numbers}
\begin{algorithmic}[1]
\State Set variable $evens$ to an empty list.
\For {every integer $i$}
  \If {$i$ is divisible by $2$}
    \State Add $i$ to $events$ list.
  \EndIf
\EndFor
\end{algorithmic}
\end{algorithm}

```

![image-20200514225618784](https://brandonrozek.com/files/images/blog/20200514225618784.png)