teleren/devto huggingface dataset:
42 things you MUST stop obsessing about if you want to become a good $PERSON
Published: 2020-01-12 04:18:32


Being French, I have lots of practice at being cynical and ironic  against people who think they know everything but in fact they know shit.

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

You may guess that this character trait can easily backfire, and in fact you are right.

France is a country where _people have built pretty much everything they need to be happy but at the same time struggle to be happy because everything in France is so terrible_. 

Doesn't that sound pretty much like the software industry?

# Permanent Stress is making you insane

I have been reading a lot of what you write here, guys and girls.

And I have noticed something:

**You are stressing out like crazy for a lot of things that don't matter very much and this is not helping you at all**.

OK, so now I have a very productive way to use my French skills for a good purpose.

> Whenever I see that you are being stressed out for 42 little things that do not matter very much, I will be really glad to use French irony to help you find out that the 42 things that are stressing you out, well, they do not, in fact, matter very much.


# You MUST and SHOULD do all those things but in fact no

I can see that you are **sweating** for a lots of things like:

> To have a job as a junior developer, you MUST answer those 42 meaningless interview questions

Oh no, you don't!

> To become productive, you MUST try out immediatly those 42 distracting tools instead of fixing that little bug that you have right now on production

Oh no, you don't!

> Here are the top 42 best practices that you MUST know because they are helpful to smomebody but not you.

Oh no, you don't!

> Here are 42 top programming books that you MUST know to be finally good enough.

Oh no, you don't!

> Here are 42 open source projects that you SHOULD check out immediatly instead of doing something meaningful with your life

Oh no, you don't!

> Here are 42 powerful rich dudes with an inflated ego that you SHOULD pay your reverence to

Oh no, you don't!

> Here are 42 tutorials you SHOULD do this week if you don't want to be a failure

Oh no, you don't!

> Here are 42 hype buzzwords that you SHOULD understand even if they meaningless if you don't want be to be left out.

Oh no, you don't!

> Here are 42 crazy things you MUST do if you want to become successfull like those well known powerful jerks!

Oh no, you don't!

---

Ok, I continue on and on but I think that you are starting to sense a general pattern.

# You are overthinking it
spark-submit command builder with live preview
Tags: spark, bigdata, productivity, scala
Published: 2020-01-12 03:53:28

As a spark developer, you might need to add numerous configuration parameters to run your Apache Spark application with optimal settings. If you look at the number of [configuration](https://spark.apache.org/docs/latest/configuration.html) options available in the spark-submit command, you would definitely appreciate, the kind of optimisations you could do. 

There is a simple [tool](https://gigahex.com/tools/spark-submit), just to build this spark-submit command at [Gigahex](https://gigahex.com). Gigahex is an upcoming platform for monitoring and receiving alerts for Spark based application.

Here's the video tutorial.


{% youtube lYixQA3sgyY %}
PHP: Two to one (take 2 strings and return sorted unique string)
Tags: php
Published: 2020-01-12 02:47:18

PROBLEM: 
Take 2 strings s1 and s2 including only letters from ato z. Return a new sorted string, the longest possible, containing distinct letters,
each taken only once - coming from s1 or s2.
Examples:
a = "xyaabbbccccdefww"
b = "xxxxyyyyabklmopq"
longest(a, b) -> "abcdefklmopqwxy"
a = "abcdefghijklmnopqrstuvwxyz"
longest(a, a) -> "abcdefghijklmnopqrstuvwxyz"

EXPLANATION:
In the longest() function we will implement the following;

STEP 1) Combine the two strings
We concatenate (combine two strings in php by the . )


STEP 2) And then convert it into an array

str_split() function lets us pass a string and convert it into an array , here we dont specifiy the second parameter hence it defaults to one 
https://www.php.net/manual/en/function.str-split.php 

STEP 3) Sort the elements of the array

By just passing an array into the sort() function , it will sort it out we dont need to do this
$arr = sort($arr), infact this is not gonna work ! ( sort($a) passes the value by reference because of that we don't need to assign it to the second variable , learn more: https://www.php.net/manual/en/array.sorting.php) 

STEP 4) Convert it into a string while turning the characters in the array into unique characters
$returnstring= implode("",array_unique($arr));

Implode will return a string with the separator specified (first parameters) , here we assign “” (nothing)

STEP 5) Return the string

ANSWER:
```php
<?php 
function longest($a, $b) {

$all = $a.$b;
 
$arr = str_split($all);
sort($arr);
 
$sortedstring= implode("",array_unique($arr));
  
 
return $sortedstring;

}
?>
```
Who uses IRC?
Tags: watercooler, irc
Published: 2020-01-12 02:35:44

Just curious who out there still uses this as a primary tool.  [IRC](https://en.wikipedia.org/wiki/Internet_Relay_Chat) was a [huge component](https://en.wikipedia.org/wiki/Nerd) of my middle school-to-high school experience, so ~2003-2010, but I haven't really touched it since except for a few one-off questions.

Where do you lurk?

*Photo by Museums Victoria on Unsplash*
January 11th: Week in Review 🎉🎉
Tags: discuss, watercooler, todayilearned, career
Published: 2020-01-12 02:15:37

Been a minute since I published my last week in review. Time got away from me (read: I'm winding down a Red Dead Redemption 2 binge that went on for a little too long). 


The year ended and the new one began, we did it! :clap: :clap:


Things I learned/did this week: 
- Deleting an entry out of an array in JS doesn't cause the length of the array to get updated, thanks [You Don't Know JS](https://github.com/getify/You-Dont-Know-JS)
- I picked up coding [basic-music-player](https://github.com/Danondso/basic-music-player) again, nice to get back to personal project coding
- Java has a var keyword 🤷

I read one whole article this week but I enjoyed it, [Adrian's](https://dev.to/adrianbdesigns) post on the [Revealing Module Pattern](https://dev.to/adrianbdesigns/revealing-module-pattern-in-javascript-28hl) in JS. 


Hope your year is starting off well. I'm hoping to write some tech articles this year on Kubernetes and JS. See ya soon! 👋
Basic curl options
Tags: curl, linux, beginners
Published: 2020-01-12 01:52:10

---
title: Basic curl options
published: true
description: 
tags: curl,linux,basic,beginners
---

# Overview
Here are some super basic curl command options all web-application-developers should know.
If there is/are any other command option/options, you think, should be on the list, plz leave a comment below with the option/options.

# Add headers
You can use `-H` to add headers to your request.

```
$ curl -H "Content-Type: application/json" http://localhost:8888
```

# Make a POST request with Parameters
You can make a post request with parameters with the `-d (-data) ` flag.
You can specify the method you want to use with `-X`. In this case, you are specifying to use the `POST` method.

```
$ curl -d '{"name":"value1", "content":"value2"}'  -X POST http://localhost:3000
```

# Get verbose response 
You can get verbose response with the `-v` option. The `-v` stands for `-verbose`. 

```
$ curl -v http://localhost:8888
```

# Fetch only the HTTP headers

You can use `-I/--head` flag to only fetch the headers.

```
$ curl -I http://localhost:8888
```

# Add cookies

You can pass the data to the HTTP server as a cookie with the `-b/--cookie` command.
NOTE that the file specified with `-b/--cookie` is only used as input. No cookies will be stored in the file. To store cookies, use the `-c/--cookie-jar` option 

```
$ curl -c cookie.txt -b cookie.txt -b "name=value" http://example.com
```

# Send Data like sending them via forms
This lets curl emulate a filled-in form in which a user has pressed the submit button. This causes curl to POST data using the `content-type multipart/form-data` according to RFC1867. 

```
$ curl -F title="Test" -F author="Test" -F attachment-file=@test.txt http://localhost:8880
```

# Resources
Here are some resources to know more about the curl command.

- [curl man page](http://www.mit.edu/afs.new/sipb/user/ssen/src/curl-7.11.1/docs/curl.html)
- [List of `curl` options · GitHub](https://gist.github.com/eneko/dc2d8edd9a4b25c5b0725dd123f98b10)
Completely Left Linux..for realz
Tags: linux, wsl, windows, javascript
Published: 2020-01-12 01:46:16

Just as an update to the [Why I'm sort of leaving Linux](https://dev.to/vetswhocode/why-i-m-sort-of-leaving-linux-1oh7) post this past October. 

A lot of people wanted to know if I would stick with Windows or if I would give in and return to Linux. And I still am using Windows. I did play with Linux a little on and off still. In general though I am still on Windows. And i've made the next step. 

What is the next step you may ask? Well I went completely in and just purchased a [Surface Laptop 3](https://www.microsoft.com/en-us/p/surface-laptop-3/8vfggh1r94tm?activetab=overview). So there is no going back to Linux on this puppy. Well there is WSL of course, but that is part of the point. I'm even planning on selling my Galago Ultra Pro. 

Either way, like I said I promised an update. Maybe in another week I will give the [Surface Laptop 3](https://www.microsoft.com/en-us/p/surface-laptop-3/8vfggh1r94tm?activetab=overview) a review. 

Happy New Year and keep on coding.
Top 10 Most Popular Torrent Sites of 2019
Published: 2020-01-12 01:07:41

Below is the full list of the ten most-visited torrent sites at the start of the new year. The list is based on various traffic reports and we display the Alexa rank for each. In addition, we include last year’s ranking.

Most Popular Torrent Sites

1 - YTS.am
YTS.am is the unofficial successor of the defunct YTS or YIFY group. The site typically rebrands third-party releases of popular movies. While these were banned by several other torrent sites, YTS is now more popular than ever.

Alexa Rank: 205 / Last year #5

2 - 1337x
1337x has been a stable presence in this list for many years. It has as a dedicated group of uploaders that provide fresh content. Despite ISP blockades in several countries it continues to grow.

Alexa Rank: 248 / Last year #3

3 - The Pirate Bay
The Pirate Bay turned 15-years-old last year and is the oldest site in this list. If we counted all traffic from proxy domains it would likely still be on top, but due to frequent downtime and connectivity problems it’s now in third position.

Alexa Rank: 288/ Last year #1

4 - RARBG
RARBG has dropped two places compared to last year. The site operates several domain names, but only the one with the most traffic counts for this list. RARBG was founded in 2008 and specializes in high-quality video releases.

Alexa Rank: 325 / Last year #2

5 - Torrentz2
Torrentz2 launched as a stand-in for the original Torrentz.eu site, which voluntarily closed its doors in 2016. Despite some issues with disappearing torrent links early last year, it’s still going strong.

Alexa Rank: 498 / Last year #4

6 - NYAA.si
NYAA.si is a popular resurrection of the anime torrent site NYAA. The site was suspended by Cloudflare last year but found a suitable alternative soon after.

Alexa Rank: 549 / Last year #8

7 - LimeTorrents
LimeTorrents has been around for more than half a decade. A few month ago the site’s operator changed LimeTorrents’ domain name and updated its homepage in response to various blocking efforts.

Alexa Rank: 962 / Last year #7

8 - Zooqle
Zooqle, which boasts more than 3.8 million verified torrents, kept its spot in the top 10. The site was openly advertised as an alternative to Bitsnoop, which shut down in 2017.

Alexa Rank: 1,753 / Last year #10

9 - EZTV.ag
The original TV-torrent distribution group EZTV shut down after a hostile takeover in 2015, with new owners claiming ownership of the brand. The group remains active, albeit not without controversy. Just a few month ago ETTV accused the group of ‘stealing’ its releases.

Alexa Rank: 1.950 / Last year #6

10 - [Filmes Torrent](https://baixar.club)
FilmesTorrent has been around for several years. The torrent site regained a spot in the top 10 this year after a year of absence. It’s a no-nonsense index that provides torrents to millions of users each month.

Alexa Rank: 2,018 / Last year #NA
I wrote an unbeatable Tic-Tac-Toe AI in Java
Tags: java, ai, minimax
Published: 2020-01-12 00:37:42

I just wrote a Java program that cannot lose at a game of Tic-Tac-Toe. Your best hope is to tie it in a game.
You can find the full code here: [github.com](https://github.com/jaeheonshim/Tic_Tac_Toe_AI)

It works by using the minimax algorithm. I'll be writing an article about this on my [personal blog](https://jaeheonshim.com) soon.

I would appreciate it very much if you could take a peek at the code and tell me what you think. Any feedback would be very much appreciated!
Does every backend need to be an API?
Tags: discuss, help, javascript, webdev
Published: 2020-01-12 00:22:54

At the Flatiron school, every project went through the same process: use rails to create a REST API and create a separate repo for you front end (in vanilla JS or React), which makes sense with the MVC design pattern. 

But as I sat at my computer (finally back in working order) today, I've found myself unable to kickoff my first Node.js project. Not only do I not have `rails new` to get things started, but I have absolutely no idea of **how to start** the project. This made me start questioning how I've been doing things all along. 

To offer some background, I want to create a Pomodoro single page application similar to the [Marinara] (https://chrome.google.com/webstore/detail/marinara-pomodoro%C2%AE-assist/lojgmehidjdhhbmpjfamhpkpodfcodef) Chrome extension, which I currently use. This project would use vanilla JS, Postgres (if hosting on Heroku), Node.js/Express.

As I mentioned the Flatiron way would be to:
1. create 2 repos- frontend and backend
2. set up the backend as a REST API for CRUD actions
3. use the Fetch API to connect your frontend to your backend

Considering this isn't a CRUD app, is creating my backend as an API still the best approach? Aside from MVC, how would you structure a relatively small project like this? I've read into other design patterns, but still unsure.
The moment you write a macro. 💡
Tags: rust
Published: 2020-01-12 00:15:47

It's my second dip into Rust, the first time I got mad and rage quit a project because Rust is so damn good at stopping me from doing bad things.

This time away, must have let me absorb a large portion of the things I had read because for whatever reason, I'm not getting angry and actually it seems intuitive. 🤷‍♂️

Anyway macros, why I don't like them: abstraction, it's not something that helps me learn anything. 

But that opinion changed a bit today I wrote a macro because I noticed something about Rust, a function with side effects is hard to write, functions seem to work best if they return a thing back to the "top level" and composition is key to this putting more complex things together, I found that I needed to write some really repetitive code several times and my code is starting to look hostile.

It turns out that macros seem to talk to the language as it parses, allowing you to dynamically insert templated pieces of code, a complex set of behaviour can be cut down to one line. I suppose it's a bit like code snippets in your IDE that expand into whatever, but you write this in the source of your project. I'm not sure the best way to store macros however, I really don't want this in my main module.

I think I want to use macros for code that is just painfully verbose and unwieldy but I will only when I have wrote the working version first, I doubt I will do everything in macros or start one from scratch.

Perhaps that's just where I am in my Rust journey.
Reducing the file size of open source fonts
Tags: frontend, fonts, performance
Published: 2020-01-12 20:57:45

---
title: Reducing the file size of open source fonts
published: true
date: 2020-01-12 00:00:00 UTC
tags: frontend, fonts, performance
canonical_url: https://www.mgrossklaus.de/blog/reducing-the-file-size-of-open-source-fonts
---

I was recently working on the relaunch of my website and wanted to include the open source font [Inter](https://rsms.me/inter/). Unfortunately, even the _woff2_ versions of each different font style were at least 100kb large. As I wanted to use three font styles, this was, of course, way too much.

Fortunately, I knew that it is possible to reduce the file size by only using certain characters. After a quick search I stumbled upon [FontForge](https://fontforge.org/), which allows you to edit all sorts of things in open source fonts (I honestly do not have a clue what most of them are). I opened the font files and saw that all kinds of characters (romanian, greek, kyrillic and other letters, characters for spacings, mathematical characters and so on) were included. Since my website does not have any user generated content, I knew pretty well what kind of characters I would need. Especially for bold and italic font styles, the amount of necessary characters is very limited. That way I was able to remove most of the characters and decrease the total size of all font files **from 314kb to 39kb**.

The steps to do that are the following:

1. Open a font file via _File_ → _Open_
2. Go to _Element_ → _Font Info_ (opens a new window) → _Unicode Ranges_
3. Select an entry in the list
4. In the other window deselect the characters you want to keep and remove the selected characters via _Encoding_ → _Detach & Remove Glyhphs…_
5. Repeat that for every entry in the _Unicode Ranges_ list
6. Create a new font file via _File_ → _Generate Fonts…_

Admittedly, the UX could be a bit better and depending on your font files, this can be quite time-consuming. Nevertheless, it is fairly easy with _FontForge_ to remove characters from a font file and the results are definitely worth it.

_Note:_ At the time of writing this, the security restrictions on macOS Catalina do not allow you to open font files from your “Downloads”, “Documents” and “Desktop” folders. Move the font files in any other folder if _FontForge_ says “Unauthorized / Operation not permitted”. See also [this issue](https://github.com/fontforge/fontforge/issues/4082) on GitHub.
When related projects develop synergy, both advance faster
Tags: gamedev
Published: 2020-01-11 22:54:59

Building upon the first post in this series, about getting over the hump... now that I have a better idea of what I'm doing, it occurred to me that, since I am making 2 games simultaneously with the new engine - [LaserTank Improved](https://github.com/PuttySoftware/laser-tank-improved) and [Fantastle Reboot](https://github.com/PuttySoftware/fantastle-reboot/) - advancements made in one game potentially benefit the other game too. Nowhere is this more apparent than this [pair](https://github.com/PuttySoftware/laser-tank-improved/commit/9113af71d065403399a37d8f5ee647d90b82442a) of [commits](https://github.com/PuttySoftware/fantastle-reboot/commit/7b0a1f3b84e14d91f52ae4e90ebb20694315768f) - the two projects end up sharing most of their code, as well as all 16 dependencies, afterwards.

I fully expect this trend to continue as both games develop further and establish their own unique identities, since plenty of common functionality will exist. Why reinvent the wheel every time if you don't have to?
const 📦, seal 🤐, freeze ❄️ & immutability 🤓 in JS
Tags: javascript, webdev, beginners, tutorial
Published: 2020-01-11 22:43:54

Immutable data can not be changed once created. Most of the times this leads to simpler and less error-prone code. That's why immutable data structures are quite often a hot topic. Let's see what we can achieve with JS!

So *const* for the win you might say, because this way you create constants, right? Well ... no. With const, you create a variable, that can't be reassigned.

So the following code won't work:

```js
const x = "Dog"
x = "Cat" // crashes with "Uncaught TypeError: Assignment to constant variable."
```

With *let* and *var* it's possible to reassign variables, of course.

So, but why isn't const immutable then? Let's see what happens, when we use an object instead of a primitive value.

```js
const obj =  { name: "Doggo" }
// let's change a property
obj.name = "Kitty"
// and add one
obj.animal = "cat"

console.log(obj) // {name: "Kitty", animal: "cat"}

// reassigning will not work
obj = { name: "Birdo" } // crashes with "Uncaught TypeError: Assignment to constant variable."
```

So we can still add and change properties of objects. But there is a `seal` method and a `freeze` method on Object, that basically do exactly what they say. Let's have a look at *seal* first:

```js
const obj =  { name: "Doggo" }
// let's seal our object
Object.seal(obj)
// let's change the property again
obj.name = "Kitty"
// and also add one again
obj.animal = "cat"

console.log(obj) // {name: "Kitty"}
```

So what happened here? The *name*-property could be changed, but the *animal* property could not be added. That's exactly what *seal* does: it prevents properties to be added to an object. Existing properties can still be changed. 

The *freeze* method prevents both, changing as well as adding/deleting properties.

```js
const obj =  { name: "Doggo" }
// let's freeze our object
Object.freeze(obj)
// let's change the property again
obj.name = "Kitty"
// and also add one again
obj.animal = "cat"

console.log(obj) // {name: "Doggo"}
```

Okay, so using *const* in combination with *Object.freeze* will give us immutability, right? Well ... again no. The freeze method is no so called deep freeze. This means, that only your first level object is actually frozen; objects within this object aren't. Let's have a look at an example:

```js
// we'll give the dog an owner, that also has a name (mine ;) 
const obj = { name: "Doggo", owner: { name: "Ben" } }
// we'll again freeze the object
Object.freeze(obj)

// and this time we'll change the name of the owner
obj.owner.name = "Bla"

console.log(obj) // {name: "Doggo", owner: {name: "Bla"}}
```

To actually achieve immutability you could create a deep freeze method, to recursivly runs to all object properties and freezes all nested objects. Let me know if you're interested in a tutorial on this!

Or you can use a library like [Immutable.js](https://github.com/immutable-js/immutable-js)

---

Want to get better at Web Development?
[🚀🚀🚀subscribe to my weekly ✉️newsletter](https://codesnacks.net/subscribe/)