teleren/devto huggingface dataset:
Reading Snippets [36 => Grids]
Tags: css, beginners
Published: 2020-01-19 14:18:57

If there are more grid items than cells in the grid or when a grid item is placed outside of the explicit grid, the grid container automatically generates grid tracks by adding lines to the grid. 

A fixed number of lines and tracks that form a grid can be defined by using properties, grid-template-rows, grid-template-columns, and grid-template-areas, are known as 

<kbd><small>Source:<a href="https://css-tricks.com/difference-explicit-implicit-grids/">CSS Tricks</a></small></kbd>
The memory usage of the oldest site in Chromium and Firefox
Tags: html, browser, benchmark, memory
Published: 2020-01-19 13:52:06

This post is a reply for a comment by [@codemouse92](https://dev.to/codemouse92/comment/kdoh) at [What's the most wasteful software?](https://dev.to/ben/what-s-the-most-wasteful-software-l78)
<hr>

The [oldest website still online](http://info.cern.ch/hypertext/WWW/TheProject.html) is a single 2.17 KB HTML file with a 1.37 KB favicon. This is you memory snapshot at Chromium and Firefox:

## Chromium 79 (2.2 MB)
[![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/rgtx743er87yjluhxt3n.png)](https://thepracticaldev.s3.amazonaws.com/i/rgtx743er87yjluhxt3n.png)

## Firefox 72 (0.52 MB)
[![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/sb9julpzxpo813imie9d.png)](https://thepracticaldev.s3.amazonaws.com/i/sb9julpzxpo813imie9d.png)
Creating a Template on KDE Plasma
Tags: linux, plasma, template, create
Published: 2020-01-19 13:43:45

In too many forums, I saw KDE Plasma users don't know how to create a template file for right-click context menu.

In post, I will show you, how to create template file for KDE Plasma.

Maybe you saw template folder in your home directory. But it's invalid to plasma. Ofcourse this is not mean you can't create template file.

You can create template file in this way.

###Step.1

Navigate to `/usr/share/templates/` and create `.source` directory into this directory.

###Step.2

Create a `main.go` file. It can be empty.

###Step.3

Go back to `/usr/share/templates/` and create `gofile.desktop`.

###Step.4

Write this code (on the below).

```
[Desktop Entry]
Name=Go Main File...
Comment=New Go Main File:
Type=Link
URL=.source/main.go
Icon=text-x-go

```

Now you can use this template :smile:
I'm a beginner of Rust but making a programming language by rust
Tags: rust, opensource, beginners, language
Published: 2020-01-19 13:14:21

Rust has an awesome parser [Pest](https://github.com/pest-parser/pest) which is elegant and fun to use.  
To make a programming language, you need a lexer and a parser. I'm using Pest as a parser in my [project](https://github.com/lechatthecat/oran). I'm a beginner of Rust, so I'm learning Rust by making the project.
Daily Developer Jokes - Sunday, Jan 19, 2020
Tags: jokes, dailydeveloperjokes
Published: 2020-01-19 13:00:26

---
title: "Daily Developer Jokes - Sunday, Jan 19, 2020"
description: "Check out today's daily developer joke! (a project by Fred Adams at xtrp.io)"
series: "Daily Developer Jokes"
cover_image: "https://private.xtrp.io/projects/DailyDeveloperJokes/thumbnail_generator/?date=Sunday%2C%20Jan%2019%2C%202020"
published: true
tags: #jokes, #dailydeveloperjokes
---

Generated by Daily Developer Jokes, a project by [Fred Adams](https://xtrp.io/) ([@xtrp](https://dev.to/xtrp) on DEV)

___Read about Daily Developer Jokes on [this blog post](https://xtrp.io/blog/2020/01/12/daily-jokes-bot-release/), and check out the [Daily Developer Jokes Website](https://dailydeveloperjokes.github.io/).___
### Today's Joke is...
![Joke Image](https://private.xtrp.io/projects/DailyDeveloperJokes/public_image_server/images/5e12592f4bd15.png)

---
*Have a joke idea for a future post? Email ___[xtrp@xtrp.io](mailto:xtrp@xtrp.io)___ with your suggestions!*

*This joke comes from [Dad-Jokes GitHub Repo by Wes Bos](https://github.com/wesbos/dad-jokes) (thank you!), whose owner has given me permission to use this joke with credit.*

<!-- 
Joke text:
___Q:___ Why do Java developers wear glasses?

___A:___ Because they don't C#!
 -->
Add header to Header Search Paths via cocoapods
Tags: ios, cocoapods, headersearchpaths
Published: 2020-01-19 12:32:46

---
title: Add header to Header Search Paths via cocoapods
published: true
description: 
tags: ios, cocoapods, header search paths 
---

If at some point - for some weird reason - you need to append some new headers to your current Header Search Paths, you can write something along these lines:

```ruby
def append_header_search_path(target, path)
    target.build_configurations.each do |config|
        xcconfig_path = config.base_configuration_reference.real_path

        # a positive lookbehind regular expression (?<=)
        # to keep the delimiter at the end of each string:
        file_data = File.read(xcconfig_path).split(/(?<=[\S])\n/)

        # Copy current headers
        header_search_paths = ""
        header_search_paths_index = nil
        file_data.select.with_index do |val, index|
          if /HEADER_SEARCH_PATHS/ =~ val
            header_search_paths = val
            header_search_paths_index = index
          end
        end

        # Append the new header
        new_header_search_paths = header_search_paths << " #{path}"
        file_data[header_search_paths_index] = new_header_search_paths

        # Write it back to the file
        file_data = file_data.join("\n")
        File.write(xcconfig_path, file_data)
    end
end
```

Then, you can use it in a `post-install` action:

```ruby
post_install do |installer|
    installer.pods_project.targets.each do |target|
      if target.name == "AnyProject"
          puts "Updating #{target.name} HEADER_SEARCH_PATHS"
          append_header_search_path(target, "${PODS_ROOT}/../new_header")
      end
    end
  end
```
Tic-Tac-Toe Game with Flutter
Tags: flutter, tictactoe, games
Published: 2020-01-22 16:39:27

---
title: Tic-Tac-Toe Game with Flutter
published: true
date: 2020-01-19 11:57:22 UTC
tags: flutter,tic-tac-toe,games
canonical_url: https://www.mobileframeworks.dev/flutter-tic-tac-toe/?ref=devto
---

 ![Tic-Tac-Toe Game with Flutter](https://www.mobileframeworks.dev/content/images/2020/01/IMG_20200119_124529-1.jpg)

Check the code source of the famous game Tic-Tac-Toe game implemented with flutter.

[See Post](https://www.mobileframeworks.dev/flutter-tic-tac-toe/?ref=devto)
Adding an RSS feed to GitHub Pages
Tags: github, rss, todayilearned, beginners
Published: 2020-01-19 11:41:09

This post was originally published on [my blog](https://dzhavat.github.io/2020/01/19/adding-an-rss-feed-to-github-pages.html).

---

Yesterday I decided to add an RSS feed to my blog. I hoped that it was going to be easy since the blog is build with Jekyll and hosted on GitHub Pages. There must be something already build-in, right? 

Well, it turned out that there was! And the setup was a piece of cake 🍰

Here are the steps that I took:

* Opened the `_config.yml` file and added the following lines:

```yml
plugins:
  - jekyll-feed
title: Dzhavat Ushev’s blog
description: Welcome to my blog
author: Dzhavat Ushev
```

Apparently, GitHub Pages supports a [list of plugins](https://pages.github.com/versions/) but not all of them are enabled by default. [`jekyll-feed`](https://github.com/jekyll/jekyll-feed) is one of them. To enable it, the only thing I had to do was add it to `plugins` array in the `_config.yml` file.

After pushing this to GitHub, the site was rebuild and a `feed.xml` file was generated. I could access at `site.github.io/feed.xml`.

The properties `title`, `description` and `author` are optional. I added them because I wasn’t happy with the defaults. For more settings, check out the [`jekyll-feed`](https://github.com/jekyll/jekyll-feed) repo.

* The next step was to add this line in the `head` of all HTML layout files:

```html
<link rel="alternate" type="application/atom+xml" title="{{ site.title }}" href="/feed.xml">
```

This helps if someone wants to subscribe to my blog using a feed reader, like [Feedly](https://feedly.com).

* The final step was to make a link to the feed that is accessible from each page. In my case this looked like this:

```html
<a class="btn btn-rss" href="/feed.xml" target="_blank">RSS</a>
```

That’s it! This took me just a few minutes to figure this out and now I have an [RSS feed of my posts](https://dzhavat.github.io/feed.xml). Subscribe if you want to read them. 😊
What technologies can help building an interactive map of nodes, that may be linked to each other (JS)
Tags: javascript
Published: 2020-01-19 11:00:27

I'm looking for any tool (software, SaaS, open source libraries, etc.) that could help represent an interactive list of nodes that may be connected to each other, using javascript.

Here are a few requirements:

- Renders in a browser environment (canvas, webGL, svg, etc.)
- Compatible desktop and mobile
- Interactive (detection of hovering, click event, etc.) on both nodes and connections
- Interconnected (node can be linked to other(s), through connections)
- Concept of proximity between nodes (some may be further away than other, depending on some criteria)
- Allows for visual customisation of the nodes/connections representation (CSS, etc.), to replace a "dot" with an image, for instance

Here is a visual that shows what it ***could*** look like:

[![enter image description here][1]][1]

A few considerations:

- I'm not looking for "the best" tool, but for any tool that matches those requirements.
- *I'm not sure if the term "map" is the best one, don't hesitate to propose a better term.*
- Optionally, a demo featuring the technology would be a great addition. 


  [1]: https://i.stack.imgur.com/Y8zj8.png
NN+DDD = webdev productivity ++ 
Tags: webdev, productivity
Published: 2020-01-19 10:43:57

todays webdev productivity top tips
* NN
* DDD/DIT (think the opposite of DRY)
* DOD (devto members only)

## NN 
never install/update/upgrade anything NEW (client or server) natively (NN) - always use a docker image or vm or virtual node or virtual python 

## DDD/DIT
do, doc, do again (DDD) aka do it twice (DIT) ! 
ie
* do it 
* doc it 
* do it again (FROM your docs) 
* optionally fix your docs if they are wrong (mine always are)

YES you do need to repeat yourself (!DRY) until the docs are 100% accurate 

## DOD
finally of course DEVTO members will doc it on devto (DOD)
4 tips to level up your Swift
Tags: swift, ios
Published: 2020-01-19 10:36:51

Swift has number of advanced features that can help you write more concise and prettier code. 

You probably won’t use these daily but when you do, you will be happy that you know them. 

### `case let` to unwrap optionals in for loop

Sometimes you have collection that may contain nil values. Instead of guard or if let inside the loop you can do the following:

```swift
for case let item? in items
```

Note the ? after item. Now you will get only non-nil items and they will be non-optional.

### Cleaner range checking

Want to find out whether number falls in particular range? Instead of the usual two ifs and && you can use Range type and its contains method. 

```swift
Range(min...max).contains(num)
```

Even neater? Use the tilda operator like so:

```swift
min...max ~= num
```

### Easy randomness

Don’t forget, that Swift has so many `random` methods. For example you can use `Bool.random()` to simulate 50/50 chance. There are same methods on `Int`, `Double` even `CGFloat`.

### @autoclosure

This is another of these features you may use once every few months but when you do, you will be glad it is there. What it does? It is basically syntactic sugar to hide closure behind traditional parameter.

Broadly there are two very useful use cases. 

* Always getting the current value of value type
* Only using function argument if really needed

Regarding the first use case. I found `@autoclosure` helpful when designing data model for table view sections that can have variable number of rows but may not be backed by traditional arrays. If you set model `rowCount` with `@autoclosure` in your section model, you can change it and it will be reflected automatically on table view reload.

If you were to use just `Int`, the inial value would get copied and subsequent changes to your section model would not be reflected in table view.

For the second use case, remember that even if your function takes simple argument like a `String` in runtime, this string can be produced by expensive function that may do some heavy work before returning this string.

Logging is good example, because you may wish to log additional information only in debug mode. With `@autoclosure` the expensive method mentioned above would be executed only if the method body needed it to log.

```swift
func log(_ message: @autoclosure () -> String) {
    #if DEBUG
    print(message())
    #endif
}
```

Built-in `assert` [works this way](https://github.com/apple/swift/blob/master/stdlib/public/core/Assert.swift). It only works in debug mode and thanks to its parameters being `@autoclosure` nothing expensive can ever get executed in release mode.
Finding Bad Commits Using 'git bisect'
Tags: git, tutorial
Published: 2020-01-19 10:01:31

Simply put, [git bisect](https://git-scm.com/docs/git-bisect):

> git-bisect - Use binary search to find the commit that introduced a bug


I'll go through an example to better demonstrate how it works.

Let's create an empty Git project, and add the following commits:

```sh
git commit --allow-empty -m 'good commit 1'
git commit --allow-empty -m 'good commit 2'
git commit --allow-empty -m 'good commit 3'
git commit --allow-empty -m 'good commit 4'
git commit --allow-empty -m 'good commit 5'
git commit --allow-empty -m 'good commit 6'
git commit --allow-empty -m 'BAD COMMIT'
git commit --allow-empty -m 'good commit 7'
git commit --allow-empty -m 'good commit 8'
git commit --allow-empty -m 'good commit 9'
git commit --allow-empty -m 'good commit 10'
```

We have just discovered a bug, but we're unsure which commit has introduced it. Git bisect for the rescue!

We first need to run `git bisect start` in order to start the wizard:

```sh
git bisect start
```

Now we'll need to tell Git what was the **last** commit known to us that introduced the bug. Assuming we've discovered the bug on the last commit:

```sh
git bisect bad HEAD
```

And of course, the **oldest** commit known to be good:

```sh
git bisect good HEAD~9
Bisecting: 4 revisions left to test after this (roughly 2 steps)
[375c587c8da1c90d07fd58a2402fd8bcf842ffd2] good commit 6
```

Now Git will perform the binary search on our history, and will checkout a commit that we'll need to decide whether it was good or bad.

We're now on "*good commit 6*", a commit before the bug was introduced

```sh
git bisect good
Bisecting: 2 revisions left to test after this (roughly 1 step)
[f14653c6730ef0537dbf8ec541997d7e9deb5e2a] good commit 7
```

This commit is *not* good, as the code already includes the "BAD COMMIT". So we need to tell Git that it's bad:

```sh
git bisect bad
Bisecting: 0 revisions left to test after this (roughly 0 steps)
[421dab9fc7f885dfadb3c7a37d70fa7dfbb6f3d1] BAD COMMIT
```

And finally, the bad commit:

```sh
git bisect bad
421dab9fc7f885dfadb3c7a37d70fa7dfbb6f3d1 is the first bad commit
```

`git log` will now reveal that it's actually the "BAD COMMIT" that introduced the bug:

```sh
git log | grep "BAD COMMIT" -B 5
commit 421dab9fc7f885dfadb3c7a37d70fa7dfbb6f3d1
Author: MarounMaroun <maroun email>
Date:   Sun Jan 19 11:28:03 2020 +0200

    BAD COMMIT
```

That's all!
Flutter Calculator mobile application
Tags: flutter, fluttercalculator, calculator, mobile
Published: 2020-01-22 09:38:08

---
title: Flutter Calculator mobile application
published: true
date: 2020-01-19 09:44:07 UTC
tags: flutter, flutter-calculator, calculator, mobile
canonical_url: https://www.mobileframeworks.dev/flutter-calculator/?ref=devto
---

 ![Flutter Calculator](https://www.mobileframeworks.dev/content/images/2020/01/calc.png)

This is a simple calculator application built with Flutter.

[See Code](https://www.mobileframeworks.dev/flutter-calculator/?ref=devto)
life inside a virtualbox
Tags: virtualisation, desktop, webdev, productivity
Published: 2020-01-19 09:29:33

here's proof (as if it were needed) that i do indeed spend all day inside a xubuntu (or linuxliteos) virtualbox

and YES it does make me more productive despite the 5% loss in cpu power (whats 5% of 2Ghz anyway) for starters i NEVER have have any gnu/linux driver issues with my hardware (that saves at least week a month)

![windows desktop with linuxliteos vm](https://res.cloudinary.com/osde8info/image/upload/v1579425775/DESKTOP_g8pdcr.png)

tags : #xubuntu #linuxliteos #wevdev #desktop #ide #virtualbox
React Navigation 5 for React Native: Features (Part 2)
Tags: reactnative, react, learning, youtube
Published: 2020-01-19 08:53:51

This video goes into more depth about React Navigation 5 and its features and functionality.

Included in this video guide:
* Adding Vector Icons
* Creating a Drawer Navigator
* Nesting Navigators
* Using the Navigation Service with and without props
* Customising your navigation header

{% youtube 54aPIdfClY8 %}

If you want to see my previous post, you can find the link below: https://dev.to/adriantwarog/react-navigation-5-for-react-native-getting-started-5b49
Golang atomic.AddInt64 not fast ////
Tags: go, atomic, mutex
Published: 2020-01-19 08:29:43


I benchmarked golang simple countup of not fixed code, mutex, atomic.AddInt64 or atomic.Value on goroutine.

## Result

fastest result: `atomic.Value` > `mutex` > `not fixed code` > `atomic.AddInt64`


**One time result**

```bash
$ go test -bench .
goos: linux
goarch: amd64
BenchmarkInc_Countup-4           	 2000000	       957 ns/op
--- BENCH: BenchmarkInc_Countup-4
    acounter_test.go:13: 1 -> 1
    acounter_test.go:13: 100 -> 100
    acounter_test.go:13: 10000 -> 9752
    acounter_test.go:13: 1000000 -> 982973
    acounter_test.go:13: 2000000 -> 1962072
BenchmarkLock_Countup-4          	 2000000	       936 ns/op
--- BENCH: BenchmarkLock_Countup-4
    acounter_test.go:20: 1 -> 1
    acounter_test.go:20: 100 -> 100
    acounter_test.go:20: 10000 -> 10000
    acounter_test.go:20: 1000000 -> 1000000
    acounter_test.go:20: 2000000 -> 2000000
BenchmarkAtomic_Countup-4        	 2000000	       943 ns/op
--- BENCH: BenchmarkAtomic_Countup-4
    acounter_test.go:27: 1 -> 1
    acounter_test.go:27: 100 -> 100
    acounter_test.go:27: 10000 -> 10000
    acounter_test.go:27: 1000000 -> 1000000
    acounter_test.go:27: 2000000 -> 2000000
BenchmarkAtomicValue_Countup-4   	 2000000	       904 ns/op
--- BENCH: BenchmarkAtomicValue_Countup-4
    acounter_test.go:36: 1 -> 1
    acounter_test.go:36: 100 -> 54
    acounter_test.go:36: 10000 -> 7125
    acounter_test.go:36: 1000000 -> 791697
    acounter_test.go:36: 2000000 -> 1586774
PASS
```


**Three times result**

```bash
$ for i in $(seq 1 3); do go test -bench . | grep 'ns/op'; done
BenchmarkInc_Countup-4           	 2000000	       998 ns/op
BenchmarkLock_Countup-4          	 2000000	       986 ns/op
BenchmarkAtomic_Countup-4        	 2000000	      1130 ns/op
BenchmarkAtomicValue_Countup-4   	 2000000	       987 ns/op
BenchmarkInc_Countup-4           	 2000000	       989 ns/op
BenchmarkLock_Countup-4          	 1000000	      1113 ns/op
BenchmarkAtomic_Countup-4        	 1000000	      1010 ns/op
BenchmarkAtomicValue_Countup-4   	 2000000	      1013 ns/op
BenchmarkInc_Countup-4           	 1000000	      1018 ns/op
BenchmarkLock_Countup-4          	 1000000	      1311 ns/op
BenchmarkAtomic_Countup-4        	 1000000	      1051 ns/op
BenchmarkAtomicValue_Countup-4   	 1000000	      1125 ns/op

```


## Code

{% gist https://gist.github.com/YooWaan/4fec0d47e22334b29bfd42aefcc99d8d file=main.go %}

## Benchmark Code

{% gist https://gist.github.com/YooWaan/4fec0d47e22334b29bfd42aefcc99d8d file=main_test.go %}
Thank note to Dev Community
Tags: community, github, general
Published: 2020-01-19 07:54:38

Hey all,

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/axoh152558h03ccbpqck.jpg)
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/dp5j836k7qscytlpiegr.jpg)

Thanks to all for your support and feedback for our Futter open-source library GetFlutter. Since we launched we are still tending on GitHub.

If you haven't checked our library then check out our GitHub repo:

https://github.com/ionicfirebaseapp/getwidget
Difference between Map and Filter functions in Python
Published: 2020-01-19 07:50:58



In Python, map and filter functions application look similar and establishing the difference between the two might be sometime confusing.

In this post, I would like to highlight the basic difference between the two functions with clear examples.


While Maps takes a normal function, Filter takes Boolean functions. As a matter of fact, filter are maps with conditional logic, a Boolean logic.


Let's put this into perspective with examples.


nums = [11, 22, 33, 44, 55]

Below is an example using map

map = list(map(lambda x: x**2, nums))
print(map) 
### [121, 484, 1936, 3025]

Below is an example using filter

filter = list(filter(lambda x: x%2==0, nums))
print(filter)
### [22, 44]
 
As you can see, the two examples modified the nums list. But while Map modifies the list with a normal logic that produces another list, Filter modifies the list with conditional logic that filters out some elements--those that do not meet the conditions of the Boolean logic---from the nums list.

I hope this brings a clearer picture into the concept of map and filter in python.

Thanks
Freecodecamps Product Landing Page
Tags: codepen, html, css, beginners
Published: 2020-01-19 07:23:16

{% codepen https://codepen.io/thunderfury1208/pen/ZEYqNqa %}



This was definitely a challenge for a newbie such as myself! Definitely got ahold of how important divs and id's are to CSS. This took me about 2 days to complete. mainly trial and error and I got to embed a video :) I had to search up @media for sure.
Resources for html and css
Tags: html, css
Published: 2020-01-19 07:20:41

Hey guys, are you interested in a list of HTML and CSS resources that takes you from a beginner to a master ? I have devised a list of resources that I love and would like to know your favourites as well ! Please take a look at my favourite resources for beginners, intermediate and advanced learners !
https://easyontheweb.com/the-best-resources-for-html-and-css/
Resources for html and css
Tags: html, css
Published: 2020-01-19 07:19:41

Hey guys, are you interested in a list of HTML and CSS resources that takes you from a beginner to a master ? I have devised a list of resources that I love and would like to know your favourites as well ! Please take a look at my favourite resources for beginners, intermediate and advanced learners !

https://easyontheweb.com/the-best-resources-for-html-and-css/
Success and Work Relation
Tags: discuss, career, productivity
Published: 2020-01-19 06:36:12


## success.isRelatedTo(work)

Success is a term which have different meaning for everyone, but one thing which can be generalized is that success is the outcome of (hard/smart)work. or as it goes:

>The only place where success comes before work is in the dictionary.      
             - Vidal Sassoon

There can be some situations where this may not apply. I want to explore experiences of y'all. So please share your beliefs/ideas/opinions about success and work. Tell me your interesting stories.

Cheers 🥂

You may connect with me on [twitter](https://twitter.com/codewithankit) or checkout my #devdiaries on [instagram](https://instagram.com/pagalprogrammer)