teleren/devto huggingface dataset:
The 7 Most Popular DEV Posts from the Past Week
Tags: top7
Published: 2019-12-23 13:17:55

---
title: The 7 Most Popular DEV Posts from the Past Week
published: true
description: A round up of the most-read and most-loved contributions from the community this past week.
tags: icymi
cover_image: https://thepracticaldev.s3.amazonaws.com/i/sfwcvweirpf2qka2lg2b.png
---
Every Monday we round up the previous week's top posts based on traffic, engagement, and a hint of editorial curation. The typical week starts on Monday and ends on Sunday, but don't worry, we take into account posts that are published later in the week. ❤️


#1. Everyone is Capable

Tae'lur shares their professional coding journey with the community - we learn about interviewing, unpaid internships, and free learning resources. We also gain lots of advice.

{% link https://dev.to/taeluralexis/how-i-landed-my-first-web-developer-role-without-a-degree-or-bootcamp-lessons-learned-resources-tips-39ag %}

#2. Everything's a Box

Chen dives into the three positioning schemes -- normal flow, flat, and absolute positioning to help us understand one aspect of CSS layouts.

{% link https://dev.to/huijing/understanding-positioning-in-css-7mn %}

#3. Helpful Hotkeys

For those that use VS Code, Yuriy put together a list of their most regularly used hotkeys.

{% link https://dev.to/peacefullatom/productivity-boost-with-the-keyboard-in-visual-studio-code-35of %}

#4. Beyond the Basics

Patrik shares ten tips for using Font Awesome icons.

{% link https://dev.to/weeb/font-awesome-guide-and-useful-tricks-you-might-ve-not-known-about-until-now-o15 %}

#5. Three Reasons

As @codegar started considering the weight, components and utilities, and styling of Bootstrap, they decided to stop using the frameowork in any of their new projects.

{% link https://dev.to/codedgar/why-i-don-t-use-bootstrap-anymore-b8 %}

#6. Polygot Programming

Creator of PolyCong, Zaiste recommends four languages to consider for those learning to expand their knowledge base.

{% link https://dev.to/zaiste/programming-languages-to-learn-in-2020-to-boost-your-career-as-a-software-developer-56ll %}

#7. Getting Unstuck

Richards shares the why and how of their newest career transition: from salary to freelance, and from devops to full stack web development.

{% link https://dev.to/pencillr/from-corporate-devops-to-freelance-full-stack-3bnb %}

_That's it for our weekly wrap up! Keep an eye on dev.to this week for daily content and discussions...and if you miss anything, we'll be sure to recap it next Monday!_
Have you ever tried to create a SQUARED image gallery? CSS only?
Tags: css, square, gallery
Published: 2019-12-23 13:03:16

---
title: Have you ever tried to create a SQUARED image gallery? CSS only?
published: true
description: 
tags: css, square, gallery
cover_image: https://thepracticaldev.s3.amazonaws.com/i/0xiv6c26l8oxjtbx5yxk.png
---

Recently, I was trying to create a squared gallery, where all the images are always square, but then I realized it is not that straight forward ;). 

What I wanted to achieve was to keep all the images square and also to keep the aspect ratio.


Here is the CSS for the square-gallery parent element.

```css
.square-gallery {
  --items: 7;
  --width: 50vw;
  display: grid;
  grid-template-columns: repeat(var(--items), 1fr);
  background: white;
  width: var(--width);
}
```

I used `grid` to create a grid layout for all the gallery items. I have used CSS variables in order to keep the gallery dynamic.

Here is the styling for the gallery item:

```css
.gallery-item {
  display: flex;
  justify-content: center;
  width: calc(var(--width) / var(--items));
  padding-bottom: calc(var(--width) / var(--items));
  background-color: #ff82a9;
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
}
```


***One of the key property to keep the images square is***

```css
padding-bottom: calc(var(--width) / var(--items));
```

Its because the aspect ratio is calculated based on the element instead of the parent. 

Or a better way is to use height using the same values 

```css
height: calc(var(--width) / var(--items));
```

The choice is yours. 


Here is the final demo with some styling and transitions:
{% codepen https://codepen.io/hunzaboy/pen/bGbzEdj %}


Thanks for reading :) 

If you are interested in creating a dark mode via CSS custom properties you can check out my other article: https://dev.to/hunzaboy/the-power-of-css-properties-variables-dark-mode-b8o
How to write less & better code and do great code reviews
Tags: todayilearned, beginners, career, programming
Published: 2019-12-23 13:00:17

*TL;DR notes from articles I read today.*

### [Code less, engineer more](http://bit.ly/2PM6rrz)

>“…But just as we wouldn’t insist that every bridge be built with bespoke girders and bolts, or that all electrical plugs and sockets have their own form factors, we shouldn’t insist on custom-building every part of the designs that we craft.”

- Build only for the pieces that you absolutely must. Identify vendors for pieces you can more efficiently buy off the shelf than to build in-house. Document the rationales of your decisions for future use.
- Encourage the mindset of focusing on the impact of code and not the volume of code written in your team. 
- If and when you write a completely new component, share it with everyone in the team and the company. While sharing write about what you made, why you made it and how you did it. This helps in avoiding duplication of efforts but another teammate or another team in the company. 
- In your team, encourage & reward reusing code. 

*[Full post here](http://bit.ly/2PM6rrz), 6 mins read*

---

### [Good code reviews, better code reviews](http://bit.ly/2MiSoYf)

- You can make code reviews better by questioning the maintainability, necessity & impact of code changes in the context of your overall system. Look at abstractions introduced and aim for doing a contextual pass.
- Any good code review avoids opinionated comments/statements. You can make code reviews better by focusing on being empathetic and all-round positive, kind and unassuming. 
- Good reviewers leave as many comments and questions as are needed, and prefer connecting with the author in-person, while better reviewers will proactively reach out to the person to avoid any misunderstandings in the first place. 
- You can have better coder reviews by looking beyond the errors and trying to figure out the underlying issue.
- Companies with good code reviews ensure that everyone takes part in the code review process. Companies with better code reviews ensure that code just doesn’t make it to production without reviews.

*[Full post here](http://bit.ly/2MiSoYf), 8 mins read*

---

### [Stop writing crap code](http://bit.ly/2sc9iBb)

- Stop using else statements as your defaults. As code grows, logic gets complicated and these else statements come to bite you back while debugging code 6-12 months later.
- Take the time to find & use built-in functionality of the language you are using. It will save your code from bloating. 
- Each function should have just one job to be done. Don’t hide your logic inside functions.
- Make your code more descriptive by naming things properly, by adding code comments, etc. 

*[Full post here](http://bit.ly/2sc9iBb), 4 mins read* 

---

*[Get these notes directly in your inbox every weekday by signing up for my newsletter, in.snippets().](https://mailchi.mp/appsmith/insnippets?utm_source=devto&utm_medium=post08&utm_campaign=is)*
Weekend Challenge - Bowling
Tags: makers, javascript, jasmine
Published: 2019-12-22 21:51:38

So I've finished the first group project so that's why I'm only writing this now. We didn’t do the code review this week either so I had nothing to compare my code to this time. Anyway time to talk about the bowling challenge.

I found the bowling challenge quite difficult. We were warned that it was harder than it looked but I didn’t expect it to be that hard. Part of the reason it was so hard was because we had to write it in JavaScript. Getting the hang of prototypes is weird because they're similar to methods but just different enough to be awkward. I worked through most of it the user stories. The main problem was trying to integrate the strikes and spares, it didn't help that I didn't know the rules of bowling. But I couldn't figure it out. The JQuery wasn't too hard to figure because the documentation was very good.

I would like to try this with ruby. But I would need to find out how to add ruby to a js file. I'd also like to learn how to do DOM manipulation with only JavaScript. Overall it was a fun challenge.
React SSR webpack problem
Tags: react
Published: 2019-12-23 12:38:10

I'm facing problem with SSR webpack. In client side webpack is not implmenting the react class component behaviour correctly, I guess. Could anyone help my out of this???

webpack.client.js ---

const path = require('path')

module.exports = {
    mode: 'development',
    target: 'node',
    entry: './config/client.js',
    output: {
        filename: 'client_bundle.js',
        path: path.resolve(__dirname, 'build/public'),
        publicPath: '/build/public'
    },
    module: {
        rules: [
            {
                test: [/\.svg$/, /\.gif$/, /\.jpe?g$/, /\.png$/],
                loader: "file-loader",
                options: {
                    name: "public/media/[name].[ext]",
                    publicPath: url => url.replace(/public/, "")
                }
            },
            {
                test: /\.js$/,
                loader: 'babel-loader',
                exclude: '/node_modules/',
                options: {
                    presets: [
                        '@babel/preset-react',
                        ['@babel/preset-env', {
                            targets: {browsers: ['last 2 versions']}
                        }]
                    ]
                }
            }
        ]
    }
}


server.js ---

/* suffs ...

app.get('*', (req, res) => {
    const context = {}

    const content = ReactDOMServer.renderToString(
        <StaticRouter location={req.url} context={context}>
            <App />
        </StaticRouter>
    );

    const helmet = Helmet.renderStatic();

    const html = `
        <!DOCTYPE html>
        <html lang="en">
            <head>
                <meta charset="utf-8" />
                <meta name="viewport" content="width=device-width, initial-scale=1" />
                <meta name="theme-color" content="#48afd9" />
                <link rel="stylesheet" type="text/css" href="/static/styles.css" />
                ${helmet.title.toString()}
                ${helmet.meta.toString()}
            </head>
            <body>
                <div id="edtalk-main">
                    ${content}
                </div>
                <script src="client_bundle.js"></script>
            </body>
        </html>
    `;
    res.send(html)

})

... stuffs ***/


With this I'm not able to implement onClick, DidMount method in react class component, while functional components are working fine.
Flutter 學習日誌 Assets
Tags: flutter
Published: 2019-12-23 12:24:51

##匯入圖片資源
在 pubspec.yaml 加入指定圖片資源

```
assets:
 - assets/food/food_1.jpeg
 - assets/drink/drink_2.jpeg
```

也可加入指定目錄下所有圖片

```
assets:
 - assets/
```

上述方式僅匯入該目錄下圖片，不包含子目錄下的圖片。子目錄圖片需個別定義，注意：最後須以 "/" 結尾

```
assets:
 - assets/food/
 - assets/drink/
```

[AssetImage](https://api.flutter.dev/flutter/painting/AssetImage-class.html) 類別會根據裝置尺寸及比例選擇適當資源。
Flutter 存取的首要圖片為 1.0x 圖片，若要支援其他比例圖片，在其 1.0x 圖片目錄下建立對應比例的子目錄 (1.5x, 2.0x, Nx)

```
//建立方式1
assets:
 - food_1.jpeg
 - 1.5x/food_1.jpeg
 - 2.0x/food_1.jpeg

//建立方式2
assets:
 - icon/food_1.jpeg
 - icon/1.5x/food_1.jpeg
 - icon/2.0x/food_1.jpeg
```
CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. 
Tags: help
Published: 2019-12-23 12:21:28

Hello! I'm trying to use GitHub Graphql and in some petitions, I get the error in the title.
Do you know how to solve it? I tried with a public proxy but I get anyway... 
Thanks!

 method: 'POST',
    mode: 'cors',
    origin: 'myapp.url',
    body: JSON.stringify({query}),
Justin Sun Promotes a Potential Pyramid Scheme Game on Tron Network
Tags: blockchain, blockchainnews, blockchaintechnology, cryptocurrency
Published: 2019-12-23 12:02:24

Ironically, Justin Sun also kept pushing up Tron’s chart prices on his screen looking at the action. The prices have also surged partly due to Bitcoin’s [BTC] decisive price action as well. The “boxes” are expected to give rewards to their owners, while Justin is targeting to make $15 million today.

https://www.cryptoknowmics.com/news/justin-sun-promotes-a-potential-pyramid-scheme-game-on-tron-network
Null and undefined in JavaScript
Tags: javascript, codenewbie
Published: 2019-12-23 11:18:07

`Null` and `undefined` in javaScript seems the same but there is a significant difference between the two. In this article let us explore the similarities and differences between them.

## Undefined
  Undefined means `no-value`. if you have declared a variable but did not initialize/assign it with any value,By default it stays `undefined`, If you try to read a non-existing property in an object it gives `undefined`. you can also assign a variable as `undefined`.

```javascript
   let i;
   console.log(i); //undefined
   i={};
   console.log(i.something); //undefined
   i= undefined;
   console.log(i); //undefined
```


## Null
  Null is `non-existing value` or you can also say `no object value`.A variable becomes `null` only when you assign it as `null`. so `null` doesn't come by default.

```javascript 
   let i;
   console.log(i);// undefined
   i = null;
   console.log(i);// null
```

Both null and undefined evaluates to `falsy`.
```javascript
   let i; 
   if(i){
     console.log('truthy');
   }
   else{
     console.log('falsy');
    } //prints falsy
   i=null;
   if(i){
     console.log('truthy');
    }
   else{
     console.log('falsy');
    } // prints falsy
```
  as we can see both `null` and `undefined` evaluates to `falsy` values.

 But interestingly if we check the type of `null` it gives object even though 
 both `null` and `undefined` are said to be primitives. This is regarded as 
 mistake in javaScript implementation.
```javascript
   console.log(typeof null); //object
   conosle.log(typeof undefined); //undefined
```
Why `typeof null` gives `object` is explained in [this](https://v8.dev/blog/react-cliff) v8 article.  
![v8](https://v8.dev/_img/react-cliff/02-primitives-objects.svg)

following the above image Brendan Eich the (creator of javascript) designed JavaScript to make typeof return 'object' for all values on the right-hand side. That’s why `typeof null` gives `object` despite the spec having a separate Null type.

one more thing is when we compare null and undefined with `===` it returns `false` but when we compare `null == undefined` it returns `true` because of type-coercion.

#### summarizing the post:
1. undefined means `not-defined`. a variable is `undefined` until you give it some value.
2. null means `no-value`. something becomes null only if it is made(assigned) null.
3. null and undefined both evaluate to falsy.
4. null and undefined both are primitive values.
5. `typeof null` gives `object`.


if you like my post please do like. you can also follow me here on dev.to or on [twitter](https://twitter.com/ReddyAravind178)
I'm building a blog about building a blog
Tags: gatsby, react, graphql, tailwindcss
Published: 2019-12-23 10:54:15

---
title: I'm building a blog about building a blog
published: true
description: 
tags: gatsby, react, graphql, tailwind
---

Some time ago I noticed there was money to be made on [Medium](https://medium.com/). I joined the [Medium Partner Program](https://medium.com/creators) and moved some of my posts behind the [metered paywall](https://help.medium.com/hc/en-us/articles/360018834314-Stories-that-are-part-of-the-metered-paywall). Time to become a millionaire.

I quickly wrote a new blogpost and shared it here and on [Reddit](https://www.reddit.com/). This received some backlash as someone commented "Too bad you care about money more than sharing it. ¯\(ツ)/¯". That hurt, but it was also kinda true.

This sparked a thought in my head. I can just create my own blog. Maybe add some ads. And still become a millionaire. I can just blog about building a blog. Easy does it.

I already have 3 posts:

- [Gatsby From Scratch](https://dev.bartwijnants.be/gatsby-from-scratch/): Create a very simple Gatsby site from scratch without using a starter.
- [Fill The Head The Rest Will Follow](https://dev.bartwijnants.be/fill-the-head-the-rest-will-follow/): Add a header and manifest to a Gatsby site using some basic GraphQL.
- [Tailwind](https://dev.bartwijnants.be/tailwind/): Use the Tailwind CSS framework in a Gatsby site.

And a ton of notes waiting to be converted to posts.

[Check it out](https://dev.bartwijnants.be/)!
5 PENYANYI WANITA YANG MEMILIKI SUARA TERTINGGI DI DUNIA
Published: 2019-12-23 10:41:06

Dengan memiliki suara yang bagus, seseorang sudah memiliki modal untuk menjadi penyanyi. Namun tentu tidak semua penyanyi khususnya penyanyi wanita memiliki kemampuan untuk mencapai nada-nada tinggi ketika mereka menyanyikan lagu. Beberapa penyanyi wanita berikut ini ternyata memiliki kemampuan untuk menjangkau nada tinggi sehingga bakat mereka pun diakui oleh dunia.  

1. Georgia Brown
Wanita kelahiran Naples, Italia pada 29 Juni 1980 ini merupakan penyanyi dengan suara yang mampu mencapai oktaf tertinggi yaitu hingga 8 oktaf. Kemampuannya ini pun telah diakui dunia dan tercatat dalam Guinness World Record, dengan rentang vokal antara nada G2 hingga G10. Bahkan Georgia Brown dapat mencapai nada hingga 5 oktaf saat menyanyi dengan lirik, dan hingga saat ini belum ada yang dapat melampaui bakat luar biasa tersebut.

2. Whitney Houston
Whitney Houston juga termasuk penyanyi wanita yang memiliki suara tertinggi hingga mencapai 5 oktaf. Wanita kelahiran New Jersey, Amerika Serikat pada 9 Agustus 1963 ini bahkan tetap memiliki artikulasi yang sangat jelas saat mencapai nada tertinggi. Salah satu lagu miliknya yang begitu fenomenal adalah I Will Always Love You, bahkan hingga sekarang masih sering didengar atau dinyanyikan oleh masyarakat di berbagai negara.

3. Mariah Carey
Sama seperti Whitney Houston, Mariah Carey juga dapat mencapat nada tertinggi hingga 5 oktaf, atau dengan rentang vokal antara F#2 hingga F7. Penyanyi yang lahir pada 27 Maret 1970 di New York ini bahkan juga memiliki bakat dalam menciptakan lagu, menjadi seorang produser hingga aktris yang sangat diakui kemampuannya. 

4. Christina Aguilera
Penyanyi yang terkenal dengan penampilannya yang seksi ini lahir di New York pada 18 Desember 1980. Christina dapat mencapai nada hingga 3 oktaf, dan dapat menahan napas hingga 17 detik saat bernyanyi. Selain menyanyi, Christina juga sering menulis lagu. Setidaknya, empat buah lagu miliknya pernah menempati posisi nomor 1 pada Billboard Hot 100.

5. Celine Dion
Penyanyi kelahiran Kanada pada 30 Maret 1968 ini sangat terkenal di berbagai negara, dan lagunya yang paling hits adalah My Heart Will Go On. Lagu tersebut dijadikan sebagai soundtrack untuk film Titanic, dimana film tersebut juga mencapai kesuksesan besar. Celine Dion dapat mencapai nada tinggi hingga 3 oktaf, dan suaranya terdengar sangat jernih mencapai nada tertinggi.

Nah, itulah lima penyanyi wanita yang memiliki kemampuan mencapai nada tertinggi dan telah diakui oleh dunia. Tentunya kemampuan mereka tidak hanya muncul begitu saja, karena dengan latihan yang konsisten dan terus belajar lah yang membuat nama mereka kini dikenal oleh seluruh masyarakat di berbagai negara. Visit : <a href="https://www.koploers.com/">Download Lagu Full Album</a>
Having fun with Kubernetes - Chapter 3
Tags: kubernetes, docker, deployment, loadbalancer
Published: 2019-12-23 10:35:05

Okey, from [previous chapter](https://www.martinpham.com/2019/12/07/having-fun-with-kubernetes-2/) you had built your first Docker image – it’s everything you need to run the application everywhere: A PHP-FPM 7.4 installation, a codebase contains the PHP files. Let’s continue with the k8s chapter – where we’re gonna setup our first k8s to deliver our application to 1 million people!

Before getting your hands dirty, let’s talk a bit about our infrastructure – aka our [k8s cluster](https://kubernetes.io/docs/concepts/overview/components/)

![Our infrastructure](https://thepracticaldev.s3.amazonaws.com/i/elbmq2f23mih7q3dbdpa.png)

- We need to have a [Master server](https://kubernetes.io/docs/concepts/overview/components/#master-components) to manage our k8s stuffs behind.
- We will use our 2 servers as 2 [Nodes](https://kubernetes.io/docs/concepts/overview/components/#node-components), to host our containers which run the application.
- Inside each node, we will make several [Pods](https://kubernetes.io/docs/concepts/workloads/pods/pod/) – the minions which contain our containers.
- Inside each Pod, we will run 2 containers: one is a nginx (from an [official nginx image](https://hub.docker.com/_/nginx)), one is php-fpm (from our application image we've created before). nginx serves incoming HTTP request, passes to PHP-FPM container, and returns response to client.
- To config nginx, we’re gonna use a [ConfigMap](https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/), so our Pod can run with decoupled configurations.
- To deploy our Pods, we’re gonna use a [Deployment](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/) to keep our deployment easily, ensures zero-downtime rolling out/rolling back.
- To balance the requests, we will use a [LoadBalancer Service](https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer)
- Finally, to allocate our Pods depends on traffic, we will use a [HorizontalPodAutoscaler](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/)

In this way, our Deployment controller will creating & managing Pods, based on Rolling Update strategy and Horizonal Pod Autoscaler’s requirements.

Inside every Pod, an nginx container will take configuration from Config Map, handles incoming request, passes to the php-fpm container (in the same Pod).

And in front of all, a Load Balancer will take requests from client, and balances them to our minions.

![Our minions](https://media.giphy.com/media/HyanD1KpfzPiw/giphy.gif)

In [the next chapter](https://www.martinpham.com/2019/12/08/having-fun-with-kubernetes-4/), we're gonna setup our own k8s cluster. Don't miss it!
Mobile Application Development Company
Published: 2019-12-23 09:54:23

<a href="https://hipster-inc.com/software-services/mobile-application-development/">Mobile application development</a> included Application Development and UI/UX design, it’s a process by which an application is specially developed for mobile devices. The application can either runs on Android, iOS, or both platforms which varies from frameworks. No matters it’s a native app or hybrid app, our dedicated team will nail your project by giving free pieces of advice, awesome UI/UX design, and bespoke application that fits your requirements.