teleren/devto huggingface dataset:
Importance of Code Review
Tags: codereview, practices, productivity, codequality
Published: 2020-07-15 01:35:47

In my current work, some of the practices their implementation is new for me. I don't know but my past work environment didn't implement these practices or maybe they are way behind with the new techniques in software development. So as a new developer in the hood, I need to cope up and understand the newness to provide a good quality of code. 

##So what is that? 

![So what is that? ](https://media.giphy.com/media/y3QOvy7xxMwKI/giphy.gif)

_______________________________________________________________


##`Code Review`

According to Aleks Pedchenko of Dzone, Code Review is a systematic examination of software source code, intended to find bugs and to estimate the code quality.

As the definition above, code review is an examination of the software source code. The source code which the developer created or modified. As I've learned the definition of it, my heart beats fast. Why?  Because someone will read and criticize my code. 

Somehow, after a deep breath and mind setting(you can do it!!! Because you don't a choice 🤭😂😅)


After my first code review, there are three things that I've realized. 

1. `Self-improvement`. Knowing new tacts in solving the problem is always a win. Even if you're a senior developer, it is really good to have a fresh approach or new logical technique in your codebase. These will boost your knowledge and experience.

2. `Error detection`. It is very important to detect bug or logical errors during this period. This is a way to minimize your mistake. It also helps you to avoid debugging your code in the future that will consume your time and your team.

3. `Same implementation and design `. This is the most important lesson that I've learned. Everybody should be on the same page. Coding is not just writing a piece of code that if it's running you can use it. There's always a pattern or design to follow. Consistent design and implementation will help the developer to maintain the software. 

_______________________________________________________________


##Let's wrap up things


Code review is not a scary thing. Feedback offers you to be a better developer. Accept all criticism and used it for your advance. Sharing your knowledge creates a happy workplace.


Happy Coding! 

_______________________________________________________________

Reference: 
##### Photo by Christina Morillo from Pexels
Mithril & 'm' the magical function
Published: 2020-07-14 20:35:29

Imagine a 'magical' function, let us name it 'm'.
This function would allow to create DOM Nodes, no big surprise
there are plenty ways to create DOM Nodes

In fact 'm' would create 'Virtual Nodes' or 'Vnodes'.

The nice tricks with 'm' is that it  would allow to write vnodes like this:

```js
let myelt = m("div.one.two", {onclick: () => alert("I am alive")}, "Elt 1")
```

Or, if you prefer

```js
let myelt2 = m("div", 
    {
     class: "one two",
     onclick: () => alert("I am alive")
    }, "Elt 2")
```
You will agree with me that there is no fancy tricks here.
'm' is just a function taking as parameters :

   - a tag name
   - an optional object containing properties
   - a text (or a list of vnodes) 

Imagine now, that we create a new method on 'm' in order to attach our vnodes to the 'real' DOM, let us call it 'mount'.

So we have now two functions at our disposal :

   - m
   - m.mount

m.mount would take two argument :

   - a target to append our vnode
   - an object containing a method called 'view' which would   return a vnode

I know the second argument is a little tricky. But stay with me, you will discover its power later :-)

So know we can write

```js
const MyVnode  = m("div.one.two", {onclick: () => alert("I am alive")}, "My first  vnode")

m.mount(document.body, {
  view: () =>  MyVnode
})
```
It is time know to say that this magical function exists, and it is provided by the great library Mithril.

In an other post, we will create the famous 'Todo List'.
An we will only use the two functions presented above.

For now you can test what we have acomplished so far  :

[MyFirstVnode](https://flems.io/#0=N4IgZglgNgpgziAXAbVAOwIYFsZJAOgAsAXLKEAGhAGMB7NYmBvEAXwvW10QICsEqdBk2J4hcYgAIAsgE8AamloATGJMkBeSVgAUAHRDKIAN3z0Y+YgHdaBipOD1qUCNQDWiSToCUmgHySGLAATsT6IACSgViBLsYwBt7skgZykpDBEurGSqqJemgFWPhYtACuDDrKtNRlOAz4AEYqsvbABdkQMFaePv7qcooqCWis3pQgcDCw1MQQ9Ag8ACyIAExsHCCYOHj41HACNPSMzDxsALpULmhui6hbXHhYEMSEwdATZcHkPCTEAA5wRAAemBFX+bgA5ntaFhgc9Xu8oAABVb4AAM+CW8Jeb2gJQgaHw-AmxFk-24k2o73+olY51YQA)
Dics Python
Tags: python, beginners, todayilearned
Published: 2020-07-15 01:29:15

Today I'll talking about **dictionaries** ,
nicknamed affectionately dics!
with keys and values...
``` python
user={
        "name":"Natália",
        "age":27,
        "city":"fortaleza"
}
GetAge=user.get("age")
print(user)
user.pop("age")
print(user)
user["age"]=28
print(user)
```
Our keys:"name","age" and "city"
with values:"Natália",27 and "fortaleza"
with .get() method we get the key of our dic that take us for get the especific value,and .pop() where we put a new "key":"value" on our code.
``` python
GetAge=user.get("age")
user.pop("age")
```
and with a new value we can make something like:
``` python
user["age"]=28
```
Thanks for reading!
Using angular/react in WordPress?
Tags: angular, react, wordpress
Published: 2020-07-15 01:24:17

Hey Guys, is there a way to use the output raw js from angular or react in wordpress, through code embedding plugins?
I recently took up a freelance job where the site is a WordPress site and the site owner wants to have web app features like search tables etc. I am halfway through the job using code embed plugins, but boy was that painful! To manually write js functions for every small thing like pagination etc. Made me realize again how easy the js frameworks have made it for us.
Also, are there any CDN's for js? Like for CSS, there are Bootstrap js libraries available through CDN's, but not sure what functions I can make use of.
Day 44 : #100DaysofCode - Code or Youtube?
Published: 2020-07-15 01:21:48

<h2>Today I watched Youtube videos on Rails associations and forms to help me with my personal project. Unfortunately, most of the videos that I watched are from my bootcamp and unlisted. However, I found some youtube videos that may be useful to review when you are stuck on Rails associations.</h2>

<h4> Rails associations </h4>

{% youtube 5mhuNSkV_vQ %}

<h4> Nested forms </h4>

{% youtube niLRlaL-ss0 %}

{% youtube PYYwjTlcoa4 %}

Let me know if you know of any other videos or resources that may be useful for creating nested forms using Ruby on Rails.

P.S. Thank GOODNESS FOR YOUTUBE!
I created a beautiful visualisation package for Python, Rust, and JavaScript
Tags: rust, python, javascript, datascience
Published: 2020-07-15 00:31:19

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

Alongside our open-source project, we (Stami Labs) have also been working on [Chord PRO](https://store.shahinrostami.com/product/chord-pro/) with many additional features! These include:

- Divisions, so you can have two sides to your diagram!
- Rich hover box, so you can show names and images.
- Custom hover box, so you inject your own HTML.
- Custom nouns, e.g. "occur together in 9 villagers".
- Finer customisations, such as details separators, divide size, image size/margin, hover box width, font sizes, and much more.
and more to come!

It's been an interesting journey - you can [check it out here](https://m8.fyi/chord)

There's also a brief video on it below:

{% youtube AJ2RnU-0KwQ %}
{hexmake} is one of the 5 Grand Prizes of the 2020 Shiny Contest
Tags: rstats, shiny
Published: 2020-08-02 16:57:33

---
title: {hexmake} is one of the 5 Grand Prizes of the 2020 Shiny Contest
published: true
date: 2020-07-15 00:00:00 UTC
tags: rstats, shiny
canonical_url: https://colinfay.me/hexmake-shiny-contest/
---

Hey y’all!

I’m very happy to announce that my `{hexmake}` application has won one of the 5 Grand Prizes of the 2020 shiny contest, organized by RStudio!

`{hexmake}` is a pretty simple application when it comes to its idea: building hex stickers. But I wanted this simple idea to become a playground for showcasing more advanced `{shiny}` features: namely manipulating images with a live display, importing and exporting data with a specific file format (here `.hex`), and importing and exporting to an external database (here a MongoDB).

You can give `{hexmake}` a try at[connect.thinkr.fr/hexmake](https://connect.thinkr.fr/hexmake/), and read more about the Shiny Contest results on the [RStudioblog](https://blog.rstudio.com/2020/07/13/winners-of-the-2nd-shiny-contest/). The source code of the application is at [github.com/ColinFay/hexmake](https://github.com/ColinFay/hexmake).

You can also play with `{hexmake}` on your machine by installing it with:

```r
# Install
remotes::install_github("ColinFay/hexmake")
# Run
hexmake::run_app(with_mongo = FALSE)
```

If you want to use a mongodb as a back-end, you can launch one using docker with:

```bash
docker run \
  -v /mongo/data/db:/data/db \
  -v /mongo/data/dump:/dump \
  -p 12334:27017 \
  -d --name mongohexmake \
  -e MONGO_INITDB_ROOT_USERNAME=myuser \
  -e MONGO_INITDB_ROOT_PASSWORD=mypassword \
  mongo:3.4 
```

Then launch the app using:

```r
# Change these env variables to suite your mongo configuration
Sys.setenv("MONGOPORT" = 12334)
Sys.setenv("MONGOURL" = "127.0.0.1")
Sys.setenv("MONGODB" = "hex")
Sys.setenv("MONGOCOLLECTION" = "make")
Sys.setenv("MONGOUSER" = "myuser")
Sys.setenv("MONGOPASS" = "mypassword")
hexmake::run_app(with_mongo = TRUE)
```
How do you upload a PDF received from an API to AWS S3?
Tags: devops, aws, s3, snippet
Published: 2020-07-15 04:57:24

---
title: How do you upload a PDF received from an API to AWS S3?
published: true
date: 2020-07-15 00:00:00 UTC
tags: devops, aws, s3, snippet
canonical_url: https://www.ankursheel.com/blog/upload-pdf-received-api-aws-s3
description: A code snippet to encrypt and upload a PDF file to an AWS S3 bucket received as a Stream from an external API
---

## Problem

How do you upload a PDF file that was generated by a 3rd party API to an AWS S3 bucket and protect it using server-side encryption?

## Solution

Let’s assume that we have got the pdf as a stream from calling our API endpoint.

```csharp
Stream pdfStream = api.GetPdfAsStream();
```

### Snippet

Let’s see the code before talking about what is happening.

```csharp
var s3Client = new AmazonS3Client(RegionEndpoint.USEast1);
var s3Request = new PutObjectRequest
{
    BucketName = "Bucket Name",
    Key = Guid.NewGuid().ToString(),
    InputStream = pdfStream,
    ServerSideEncryptionMethod = ServerSideEncryptionMethod.AWSKMS,
    ContentType = "application/pdf",
    Headers = { ContentDisposition = $"attachment; \"filename=\"File Name\"" },
};

var s3Response = await s3Client.PutObjectAsync(s3Request);
```

- **_Line 1_** : Setup the S3 client with the region we want to connect to
- **_Line 2_** : Create a new `PutObjectRequest` because we want to upload a file to S3.
- **_Line 4_** : **_BucketName_** : Set the bucket name to which the PDF needs to be uploaded.
- **_Line 5_** : **_Key_** : Create an unique key to identify the object in S3.
- **_Line 6_** : **_InputStream_** : Set the the inputStream to the PDF stream that we received from the API.
- **_Line 7_** : **_ServerSideEncryptionMethod_** : Use the AWS Key Management Service to encrypt the PDF.
- **_Line 8_** : **_ContentType_** : Set the content type to _application/pdf_ so that the browser can show the file asa PDF.
- **_Line 9_** : **_Headers_** : Add some common headers
  - _ContentDisposition_ to _attachment_ to indicate that the file should be downloaded.
  - _filename_ to the name of the File.
- **_Line 12_** : Start the asynchronous execution of the `PutObject` operation.

## Conclusion

Using this snippet, we are able to upload a PDF to a S3 bucket and encrypt it using server-side encryption.
Branching Out Into Hierarchy Data
Tags: postgres, database
Published: 2020-09-03 03:28:08

---
title: Branching Out Into Hierarchy Data
published: true
date: 2020-07-15 00:00:00 UTC
tags: 
- postgres
- database
canonical_url: https://magistratehq.com/blog/branching-into-hierarchy-data/
---

[ltree](https://www.postgresql.org/docs/current/ltree.html) is a Postgres extension that can give you and your application a lot of options around complex hierarchal relationships.

<!--more-->

At some point in an applications development lifecycle, you can end up having to figure out how to represent hierarchal data. In hierarchal data, a root or 'parent' node can have 'child' nodes attached to it. For example, `A (parent) -> B, C (children)` or `grilled cheese (parent) -> bread, cheese, mayo (children)`.

While these relationships can be stored in a variety of ways, such as raw strings, arrays, lookup tables, bitmasks, and so on... Postgres has a dedicated type and extension for this type of data called [ltree](https://www.postgresql.org/docs/current/ltree.html).

To get started with ltree, check to see if it is available in your setup:

```
select * from pg_available_extensions where name = 'ltree';
```

If you see it listed as an available extension, you can install it:

```
create extension if not exists ltree;
```

Confirm installation:

```
select * from pg_extension where extname='ltree';
```

Note: Magistrate makes your available extension list just a [click away](https://demo.magistratehq.com/magistrate#config.extensions).

Now we can build our first hierarchy:

```
create table menu (
  id serial,
  title text,
  ingredients ltree
);

insert into menu (title, ingredients) values ('basic', 'tortilla.cheese'), ('starter', 'tortilla.cheese.carne'), ('extra', 'tortilla.cheese.carne.pollo.guac'), ('setup', 'chips.salsa');
```

If I am curious what on the menu has a tortilla as the parent ingredient:

```
select * from menu where 'tortilla' @> ingredients;
```

If want something that has a tortilla and cheese:

```
select * from menu where 'tortilla*.cheese.*' ~ ingredients;
```

If I want something that has a tortilla and cheese, but not guac because of an allergy or preference:

```
select * from menu where 'tortilla.cheese.!guac' ~ ingredients;
```

One of the reasons you might lean towards a dedicated type for this problem is all the supporting functions and query options that go along with ltree.  
With the simple examples above and tiny data set, we could any solution would likely work fine. However, with more complex relationships and datasets, using ltree can give you a lot more options including more intelligent indexing for performance, recursion on your queries, and more confident precision with lquery stanzas. Using ltree can also get you out of the trap of thinking you need to build your own handler for when you leave the trivial examples.

While [Magistrate](https://magistratehq.com) can't solve all your hierarchal data needs, it can certainly get you started in making sure the extension is available and helping you determine when you have a performance issue with your lquery work.
QuickTip: GitHub profile readme
Tags: quicktip, github
Published: 2020-07-15 07:25:11

---
title: QuickTip: GitHub profile readme
published: true
date: 2020-07-15 00:00:00 UTC
tags: quicktip,github
canonical_url: https://www.ivanovyordan.com/2020/07/15/github-profile-readme/
---

GitHub is important for your career. You know It’s like your public portfolio. The question is how to make it stand out? Luckily, GitHub released a pretty cool feature, and in this quick tip, we will see how to use it.

<!--more-->

So, as we already said, GitHub recently released a new feature that can make your profile stand out, or at least look a bit more personalized. All you need to do is to create a profile-level READMEfile, and GitHub will display it on top of your page.

## Why README

We all know how important READMEs are for documenting every project. It’s often the border between working alone and finding contributors. I think using README for _documenting_ people is a great idea.

But why do we need README when we can just write a short bio? Well, Markdown is more flexible - we can place links, images, or even GIFs. README also takes more space in the centre of peoples screens. With all that freedom and space awesome people can make awesome things.

## How-To

Enough talking, let’s see how to beautify our profiles. It’s fast, and you can do it in three easy steps:

1. Go to https://github.com/new and create a repository with the same name (including casing) as your GitHub username
2. Create a `README.md` file and add your fancy code there
3. Commit (and push)

![Creating a new repository](https://www.ivanovyordan.com/assets/images/posts/github-profile-readme/new-repo.png) _Creating a new repository_

What if you already have a repository with the same name? I’d recommend renaming the existing project, or if possible, changing the content of the README file.

## Inspiration

My profile README is relatively simple. You can see how it looks like by checking my [GitHub](https://github.com/ivanovyordan/) profile.

Of course, you may have better ideas like placing animated portraits, skill endorsements or even the tracks that you are listening in Spotify. You can find all this and even more in a [GitHub repository](https://github.com/abhisheknaiidu/awesome-github-profile-readme).

I showed you mine, now it’s your turn to show me yours.
HTTP Security Headers
Tags: security, httpheaders
Published: 2020-09-08 12:04:04

---
title: HTTP Security Headers
published: true
date: 2020-07-15 00:00:00 UTC
tags: Security,HTTPHeaders
canonical_url: https://www.loginradius.com/engineering/blog/http-security-headers/
---

HTTP security headers are a fundamental part of website security. Upon implementation, they protect you against the types of attacks that your site is most likely to come across. These headers protect against XSS, code injection, clickjacking, etc. This article explains most commonly used HTTP headers in context to application security

   
[Read On](https://www.loginradius.com/engineering/blog/http-security-headers/)
An Easy and better way to check for null and undefined values in JavaScript
Tags: javascript
Published: 2020-07-15 00:00:00

---
  title: An Easy and better way to check for null and undefined values in JavaScript
  published: true
  tags: JavaScript
  date: Wed Jul 15 2020 05:30:00 GMT+0530 (India Standard Time)
  canonical_url: https://melvingeorge.me/blog/check-null-undefined
  cover_image: https://melvingeorge.me/_next/static/images/main-0cd8358f7fedc5385c94e5015c3ec520.jpg
  ---
  [Originally posted here!](https://melvingeorge.me/blog/check-null-undefined)
  
![stones placed on top of each other in beach area](https://melvingeorge.me/_next/static/images/main-0cd8358f7fedc5385c94e5015c3ec520.jpg)

<p class="text-center">
  Photo by
  <a href="https://unsplash.com/photos/H4u8efrEcVo" target="blank">
    Laya Clode
  </a>
</p>

In many cases, we have `null` or `undefined` values in our variables. We can conditionally show other relevant value using the new `??` (Nullish coalescing) operator instead of just showing `null` or `undefined` values.

Consider these variables `name` with the value of `null` and `age` with the value of `23`.

```javascript
// name and age variables
let name = null;
let age = 23;
```

Now if we try to view the values using the console.log() method it would show `null` and `23` in the console.

```javascript
// name and age variables
let name = null;
let age = 23;

console.log(name, age);
```

But we don't want an unpredictable behavior like that.

Let's now remove that unpredictable behavior using the `??` operator.

```javascript
// name and age variables
let name = null;
let age = 23;

// using ?? operator
console.log(name ?? "Anonymous", age ?? "Age not defined");
```

Now if we try to view the variables we can see that when showing the `name` variable it shows `Anonymous` and for the `age` variable it shows the number 23.

This is what the `??` operator does.

### It checks if a variable has `null` or `undefined` values and if it does contain those values it doesn't take that value and gives it what comes after the `??` operator. In our case `Anonymous` value.

Now if you try to change the `age` value to `undefined`.

it will show,

```js
Anonymous
Age not defined
```

### 🚨 NOTE: The `??` operator only checks if values are `null` or `undefined`. It doesn't check for boolean values `true`, `false` `1` or `0`. To check for boolean values you may need to use the `||` (`OR` operator) or `&&` (AND operator).

### ⚠️ NOTE: This operator is a new addition to JavaScript. You may need to use polyfills to work with older browsers.

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

---
Just Code It
Tags: programming
Published: 2020-07-15 14:45:48

---
title: Just Code It
published: true
date: 2020-07-14 19:05:00 UTC
tags: programming
canonical_url: https://www.stephanmiller.com/just-code-it/
---

I taught myself to write code. If I look back on it now, it was a lot of work and took a long time to get where I am now. But at the time, it didn’t seem like it. I was too interested in what I was building to pay attention.

But it was about a year between the idea and when I started writing code. I tried one language and didn’t like the syntax. I tried another and didn’t like it either. I stopped looking for an solution for a while because I gave up. It was just too hard to make a decision. I didn’t know where to start.

And then I got tired of my bullshit, picked a technology, and wrote the first prototype over a weekend. It did not do everything I wanted it to do. It had a lot of bugs, but it ran. And after that, I worked on it almost daily for a month.

By sitting down and actually trying to code, I caught the bug. Sitting and thinking about it for weeks did nothing. I did not progress. I was waiting for everything to be perfect. I wanted the perfect language and I wanted to know everything I needed to know to get started. And I was afraid of doing something the wrong way.

And what was this? Resistance.

Even after the first month of development, my software wasn’t even ready to be a prototype. I refactored it multiple times. Every other day I found a new bug.

I did things like generating reports on the fly and storing data in html files that I generated, because that is what I knew how to do when I started. I learned a lot by doing things that way. I learned a lot more when I realized I was doing things the wrong way and had to rewrite my code.

So just code it. Find a tutorial that does something similar to what you want to do and get started. Use Google when you get stuck. It is the only way to start.

Now if only I could figure out how to fight my resistance to writing.
FuTorrent Pro APK
Published: 2020-07-14 23:31:04

FuTorrent is an elegant, stable and simple torrent client made to make your life easier and downloading faster. It offers a nice UI and full control over your download slots. All your files are downloaded directly to your device, safely and at the speed of light.
https://aapks.com/apk/futorrent-pro/
Features include:
- Supported protocols: BitTorrent P2P, DHT, Advanced DHT Bootstrap, HTTP & UDP trackers
- Magnet links support
- Browsing for torrents
- Setting max downloadupload speed for any torrent
- Setting max downloadupload speed for the app
- Restricting download only when a device is connected to WiFi
- Setting max number of active torrents
- Changing directory of already added torrents
- Resuming, pausing and removing all torrents
- LibTorrent used as torrent engine

Don’t forget that we appreciate every feedback, rating or critic. Please don’t hesitate to leave a review, and if you find a glitch, contact us to investigate and make it even better!