teleren/devto huggingface dataset:
The 7 Most Popular DEV Posts from the Past Week
Tags: icymi
Published: 2017-08-14 14:41:11

---
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.
cover_image: https://thepracticaldev.s3.amazonaws.com/i/xsr1z6iqv0pd7p3s6ns3.png
tags: icymi
---

_Every Monday we round up some of the last week's top posts, comments, and tweets. If you have any feedback, please leave a comment._ â¤ï¸

#1. AMA w/ Wes Bos

Well this was awesome. Wes Bos, a fullstack dev who makes really popular online courses, did an AMA on dev.to. He shared things ranging from his favorite thing about javascript to what his process for planning an online course is. 

{% link https://dev.to/wesbos/im-wes-bos-ask-me-anything  %}

#2. Rundown of array functions

According to Andrew, there's a lot of hullabaloo about array functions. In this post, he tells us when to use map(), filter(), reduce(), or forEach(). 

{% link https://dev.to/andrew565/which-array-function-when %}

#3. "Hello Ricardo!"

A story on how a _network engineer_ became a **software developer** â¤ï¸

{% link https://dev.to/rfunk82/how-a-single-line-of-code-changed-my-life %}

#4. GraphQL in the Cafeteria  

This week, our must popular [#explainlikeimfive](https://dev.to/t/explainlikeimfive) was about GraphQL. The discussion was filled with lots of good explanations, but Ben's South Park answer was definitely a favorite. 

![southpark-image](https://res.cloudinary.com/practicaldev/image/fetch/s--p-M0lKz8--/c_limit,f_auto,fl_progressive,q_auto,w_880/http://moviesmedia.ign.com/movies/image/article/695/695459/isaacs-hayes-leaves-isouth-parki-20060313030816056-000.jpg)

{% link https://dev.to/johnpaulada/explain-graphql-like-im-five/comments %}

#5. Object-oriented programming is _not_ dead
Weighing the pros and cons of object-oriented programming vs. functional programming, the author concludes that object-oriented programming is the way to go. 

{% link https://dev.to/riccardo_cardin/object-oriented-programming-strikes-back %}

#6. Good reads
A community-sourced list of software books to read. 

{% link https://dev.to/ben/what-are-the-most-interesting-readable-software-books %}

#7. To pair program...or not to pair program?
Some swear by it, most stay away from it. Our author tries to explain why he's a fan of collaboration, mentorship, and code reviews, but not a fan of pair programming. 

{% link https://dev.to/mortoray/why-im-not-a-fan-of-pair-programming %}

_That's it for our weekly wrapup! 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!_
Pwned Pass – Available from the Play Store
Tags: softwaredevelopment, android, app, development
Published: 2020-02-09 12:37:34

---
title: Pwned Pass – Available from the Play Store
published: true 
date: 2017-08-14 07:00:29 UTC
tags: Software Development,android,app,development
canonical_url: https://www.funkysi1701.com/2017/08/14/pwned-pass/
---

Pwned Pass is now available from the [Google Play Store](https://play.google.com/store/apps/details?id=pwnedpasswords.pwnedpasswords).

![Pwned Pass](https://i1.wp.com/www.funkysi1701.com/wp-content/uploads/2017/08/Screenshot_20170813-205152.png?resize=169%2C300&ssl=1)

Pwned Pass is a simple android app that allows you to type in a password and tells you if it has been used in a data breach.

Troy Hunt of [Have I Been Pwned?](https://haveibeenpwned.com/) recently added a new API to his website which allows you to search his extensive database of pwned passwords, 306 million of them. I have simply created a Android frontend to this API.

The API itself takes a SHA1 hash of the password and either returns a HTTP 200 if the password is found or a HTTP 404 if the password does not exist in the HIBP database. For more details of how Troy Hunt created this check out his [blog post](https://www.troyhunt.com/introducing-306-million-freely-downloadable-pwned-passwords/).

My app simply generates a SHA1 hash of anything that is typed in and then passes this to Troy Hunt’s API. I then get the HTTP return code so I know if the password exists or not.

It should be noted that:  **Do not send any password you actively use to a third-party service – even this one!** I don’t log anything that you type into my app and all I am then doing is passing a SHA1 hash over SSL to HIBP. However you shouldn’t trust my word alone.

The app itself is written in Visual Studio with Xamarin Forms in a similar fashion to the app I talked about [last week](https://dev.to/funkysi1701/android-app-development-and-the-visual-studio-mobile-centre-lob-temp-slug-1114404).

As I am using Xamarin Forms there is the potential that I may develop iPhone or UWP versions of this code in the future. With that in mind I have made use of interfaces for the android specific parts of the code.

I also make use of the [modernhttpclient](https://www.nuget.org/packages/modernhttpclient/)nuget package due to problems I encountered with httpclient and SSL. This is due to limitations of what libraries are available in mono and what has been implemented, I suspect there are better ways to solve this but that is all part of the fun.

Please do have a look at Pwned Pass and let me know what you think. Especially if it doesn’t work or throws errors. I would like to spend time making this app as good as I can make it.

The post [Pwned Pass – Available from the Play Store](https://www.funkysi1701.com/2017/08/14/pwned-pass/) appeared first on [Funky Si's Tech Talk](https://www.funkysi1701.com).
What's your absolute favorite snack food while coding and why does it hit the spot?
Tags: offtopic, justforfun, discuss
Published: 2017-08-14 13:49:03

---
title: What's your absolute favorite snack food while coding and why does it hit the spot?
published: true
description: 
cover_image: https://thepracticaldev.s3.amazonaws.com/i/fqnsxq54tvz1vflgnald.jpg
tags: offtopic, justforfun, discuss
---

![](https://thepracticaldev.s3.amazonaws.com/i/gsc07ch7dd9opo02326j.jpg)


Mine is anything that has a satisfying crunch that I can bury in authentic hummus or guacamole. I live for one-handed access to savory, salty, possibly tangy, and rich flavors :D!
Kafka usage — tips&hints
Tags: bigdata, apachekafka, tipsandtricks, kafka
Published: 2018-03-03 08:52:52

---
title: "Kafka usage — tips&hints"
published: true
tags: big-data,apache-kafka,tips-and-tricks,kafka
canonical_url: 
---

Today we will talk about [Apache Kafka](https://kafka.apache.org). As you probably already know, Kafka is “a distributed streaming platform”, so it could be used as Queue, Message Bus,&nbsp;etc.

But this story isn’t about Kafka it self. It is about issues I faced recently developing one Kafka based service. Small application consuming messages from defined topic and validating them according to the schema. Nothing like rocket science.&nbsp;But.

1. Upfront check version of your Kafka server — even minor version difference could break API. Like server version 0.10.0.1 isn’t compatible with client 0.10.1.1. Just pay attention.
2. Check which compression mechanism is used on your Kafka server. [GZip](https://www.gnu.org/software/gzip/) and [Snappy](https://google.github.io/snappy/) are supported. In my case it was Snappy, and you know what? It requires [glibc](https://www.gnu.org/software/libc/). And my base docker image was Alpine. And Alpine does not have support of glibc. So, choose the right base&nbsp;image.
3. If you use Kafka Streams API and want to split one stream into two based on some predicate your could pass this predicate to `_branch_` method along with predicate that always returns true — some sort of _everithingElsePredicate(_Predicate { \_, \_ -\> true&nbsp;}).
4. kafka-console-consumer and kafka-console-producer — your best friends to debug your Kafka&nbsp;app.
5. If you are going to scale you app to process some topic in parallel way don’t forget to increase number of partitions on that topic. But keep in mind that it is only possible to increase number of partitions but there is no way&nbsp;back.

That’s all I have in mind to&nbsp;mention.
My love for my keyboard
Tags: vim
Published: 2017-08-13 16:23:29

---
title: My love for my keyboard
published: true
description: 
tags: vim
---

I recently fell in love with this very awesome chrome extension called Vimium. For those who really love Vim and hate touching your mouse and arrow keys, this extension is a blessing. I have been using this for a while now and I am in love with it.

It has many shortcuts which make your Chrome experience amazing. Give it a try you nerds, I am sure you will love it.

A quick list of commands that you can use:
![](https://thepracticaldev.s3.amazonaws.com/i/qefe6uak2hmejq8gb6ci.png)
Where do you keep your technical documentation?
Tags: documentation, wiki, discuss
Published: 2017-08-13 11:53:37

---
title: Where do you keep your technical documentation?
published: true
description: 
tags: documentation, wiki, discuss
---

I wonder where you all keep your technical (or maybe your project) documentation. Do you write it down in Word, Excel or s.th.? Or do you use other tools for it?.

Let me know! :)
How I want my command inputs, but nobody agrees
Tags: command, input
Published: 2017-08-13 04:38:55

---
title: How I want my command inputs, but nobody agrees
published: true
description: When managing what each command does, I would very much like to keep it simple.
tags: command, input
---

```Go
switch cmd {
case "help":
    search := strings.Join(args, " ")
    printHelp(search)
case "exit":
    closing = true
case "exec":
    if nargs < 1 {
        stdutil.PrintErr("exec <command>", nil)
        return
    }
    ...
```
This is some source code from my old version of my crappy application DiscordConsole, written in Go. (A rewrite is being made.)
I chose it because it perfectly demonstrates how I want my command systems, and also how languages make this difficult.
Come on, I know you like your OOP, but isn't it damn overkill to
```Java
public interface CommandHandler {
    public String[] acceptCommands();
    public int minArg();
    public int maxArg();
    public void handleCommand(String, CommandArgs);
}
public class EchoCommand implements CommandHandler {
    public String[] acceptCommands() {
        return []String{"echo"};
    }
    public int minArg() { return 1; }
    public int maxArg() { return Integer.MAX_VALUE; }
    public void handleCommand(String cmd, CommandArgs args) {
        System.out.println(args.join());
    }
}
...
```
To me that's just plain ugly. And oh god how inefficient.
*Sorry for the mix of programming languages, I thought Java perfectly described OOP, and Go perfectly described how I want my command systems while still using the "switch" keyword and not "match" like Rust does.*

But there is this one advantage with your system. It allows splitting commands in multiple files. And now you won't stop nagging on me and how horrible my command system is.
Yes, it's true I can't split mine into multiple files. It's true that's really a problem once you get more than 3 commands. But it's also the OOP way makes unecessary allocations and function calls, and is a pain to set up.

So let's think outside the rules of any programming language. What is a perfect command system to me?
```Rust
match cmd {
    "echo" => {
        usage_min!(1, "No argument specified");
        println!("{}", args.join(" "));
    },
    "some_long_command" => include!("commands/some_long_command.rs"),
    ...
}
```
This example was written in Rust. The `match` keyword is like `switch` but cooler. It perfectly demonstrates how macros are THE way to make a cheap application look good in code, and yes, that is saying all languages that don't have them suck. I love macros.
It also shows that it very nearly *is* possible to make a non-OOP command system look good, AND split it into multiple files. The only thing stopping us is that the `include!` keyword in Rust exists, but it doesn't see local variables and macros.
Still then, a lot more languages should have macros, and a lot more languages should be able to include a file's contents without any hygiene and stuff.

*This whole post is essentially me hoping [#32379](https://github.com/rust-lang/rust/issues/32379) gets fixed...*
Bootstrapping a Node With No Internet
Tags: devops
Published: 2019-01-04 02:50:52

---
title: Bootstrapping a Node With No Internet
published: true
tags: devops
canonical_url: 
---

When you bootstrap a node using `knife bootstrap` Chef assumes that you’ll have access to the internet. It uses this to download the client package and some metadata, but you don’t have to be connected to the internet to bootstrap a node.

This is especially handy in cases where you have a firewalled setup that won’t let you get packages from the internet.

There’s two ways to solve this. The first is to take advantage of the `--bootstrap-install-command` flag.

## For distro’s that use `apt`

```
$ knife bootstrap chefnode -N MyNewNode --bootstrap-install-command "curl http://your-internal-server/chef.deb -o /tmp/chef.deb && dpkg -i /tmp/chef.deb
```

## For distro’s that use `yum`

```
$ knife bootstrap chefnode -N MyNewNode --bootstrap-install-command "yum install -y http://your-internal-server/chef.rpm"
```

This method is a good choice for one-offs, or a very small number of machines, but if you have anymore than that then the better option is to make a bootstrap template.

## Making your own bootstrap template

Bootstrap templates are simply `erb` files that Chef uses to determine how to bootstrap a node. You can override the default one with the `knife` flag `--bootstrap-template`

You can make your own template and place it in `~/chef-repo/.chef/bootstrap` (you may have to make the `bootstrap` directory).

The easiest way to do make your own template, is to start with the default [Chef template](https://github.com/chef/chef/blob/master/lib/chef/knife/bootstrap/templates/chef-full.erb) and modify it to contain the bootstrap commands you need, similar to the above.

Once you’ve created and saved your own template, you can now change your command to (assuming you made a `debian.erb`):

```
$ knife bootstrap chefnode -N MyNewNode --bootstrap-template debian
```

You may have noticed that these two methods are functionally the same, pass the command in and it gets interpolated into the template, make a template and put your command in, same result. The reason I recommend you use templates for more than a few nodes is because you can keep your bootstrap files in version control, though it takes a few more steps.

### Version controlling your bootstrap files

Since `knife` will look in a few places for a `.chef/bootstrap` directory, we have to keep our bootstrap files there somehow. The problem is we shouldn’t commit `.chef` directories to version control since the directory contains keys. Instead what you can do is make a `~/chef-repo/bootstrap` folder that contains your files and instead of creating the directory as we did above, instead we’d symlink it.

From your `~/chef-repo`:

```
$ ln -s ../bootstrap .chef/bootstrap
```

Now you can add your `~/chef-repo/bootstrap` directory to your next commit without exposing keys or having to keep track of a bunch of bootstrap commands.

What do you think? Leave a comment. Click here if you would like to see more like this: https://ThaiWood.IO/DevTo
How to deploy Rails 5.1.2 and Yarn on Dokku
Tags: rails, dokku, yarn
Published: 2018-02-04 00:24:19

---
title: "How to deploy Rails 5.1.2 and Yarn on Dokku"
published: true
tags: rails, dokku, yarn
canonical_url: https://michiels.io/2017/08/13/how-to-deploy-rails-5-1-2-and-yarn-on-dokku.html
---

Last week I deployed a new custom deployment of Airstrip on a Microsoft Azure cloud of one of our clients. For this deployment, I used the new Rails 5.1.2 that uses Yarn to deploy JavaScript and CSS assets.

We use Intercity and Dokku to deploy our apps and deploying Rails 5.1.2 on Dokku is a little different if when you use the new Yarn system to install your assets.

[Read the full post on my Medium](https://medium.com/@michiels/how-to-deploy-rails-5-1-2-and-yarn-on-dokku-65ddbade9a58)
My Emacs
Tags: emacs, programming, setup
Published: 2017-08-12 20:05:57

---
title: My Emacs
published: true
description: A big fan of Emacs but a pretty stock configuration
tags: emacs, programming, setup
---

I've been using Emacs for months now. When you get into this world you see a lot of people saying that Emacs its like an Operating System or that setting up Emacs its a lifetime task, and that's true, you actually never get bored.

I started with a fairly simple configuration back then, with **stock Emacs** (no Spacemacs, no other people's configuration). At first it looked difficult but I wanted something simple, not a super-big overloaded IDE, that I could control with only the keyboard and doesn't have too many distractions for me so I was happy about that.

## My Configuration Becoming Literate

Then I started to add those things I didn't wanted. Why? Well maybe because you can, and you can do it with code! Started to learn Scheme/Lisp and Elisp (the Emacs version of this Scheme language) to create a bunch of functions and I saw a lot of videos of the **EmacsConf** to find new things to do. I moved all my configuration to a technique I now love: *Literate Programming* (which I'm actually thinking of creating a new programming/scripting language focused on this technique)

Back then, as I said, I added a lot of unneeded features that even though looked good it was "overloading" my Emacs. This is how it looked (2017/7/5)

![My overloaded Emacs configuration](https://thepracticaldev.s3.amazonaws.com/i/u8d2i79bt1c0v0lr77qc.jpeg)

## Coming Back to Stock Emacs

As the time went by, I understood that Emacs *can be an IDE* but *it's more like an Operating System* and since I use CLI programs, Emacs should be one of those. I started to remove unnecessary things from my configuration and replacing packages to Elisp functions (Still in progress with these). I also started creating my own low-contrast/low-distraction theme.

## Checkout My Configuration

I use Emacs everywhere and for everything so I need my configuration wherever I go. I share my files through GitHub so you can checkout and download my configuration from here: https://github.com/elnawe/.emacs.d.

This is the current state:

![Current Emacs state (with a little bit of Go code)](https://thepracticaldev.s3.amazonaws.com/i/j1gkgl6bhwxd2yjrk6hi.png)

----

PS: When will we have dev.to's API? I want a Terminal client! :D
Invisible reCAPTCHA on mobile?
Tags: discuss, bruteforce, security
Published: 2017-08-12 00:01:40

---
title: Invisible reCAPTCHA on mobile?
published: true
description: Google's new invisible reCAPTCHA is great for the web, but how do you use those protected endpoints on mobile?
tags: discuss, brute force, security
---

To prevent brute force on our login/register forms we've implemented Google's [invisible reCAPTCHA](https://developers.google.com/recaptcha/docs/invisible) on our website. However we can't present a mobile user with this on the app we're developing. So I was wondering is there a simple and protected way to login a user into our app?

Now the first things that come to mind would be to implement a mobile login/register endpoint, but an attacker would easily get this endpoint and start brute forcing it.

The next thing that I came up would be to ask the API for a token and use that to login the user, however this would mean to to block an IP address after X failed attempts, and it starts to feel like we're going to be developing our own version of CAPTCHA.

And another one would be to create something similar to OAuth, but UX would suffer because the user would have to be presented a web page and from time to time he might see a CAPTCHA.

Do you have any ideas for a simple implementation which would prevent an attacker from brute forcing the app?

For now the second method seems the most reasonable. I've stumbled upon websites before which give like 10 attempts to login with an X email address and then block that user from logging in for a while.

{% youtube hdJ7PTdPaqc %}

As much as I remember this video used to have this form submitted once before and reCAPTCHA didn't show up. I can only guess that part got trimmed. Seems like reCAPTCHA decides when to "test" the users by simply comparing timestamps.

P.S. I can't think of a title which does not seem like click bait ðŸ˜…
Webhook notification from Netlify to Discord
Tags: netlify, slack, discord, webhook
Published: 2018-03-26 20:02:33

---
title: Webhook notification from Netlify to Discord
published: true
tags: netlify,slack,discord,webhook
canonical_url: 
---

Moving from Slack to Discord is a huge pleasure. Sure it lack some functionalities that Slack has to offer, but Discord clients are super fast and smooth and comes with voice chat. At the end of the day, performance is what matters the most.

One of the problem I had to deal with is moving the Netlify notifications from Slack to Discord. Here in this post, I will talk about the process of me figuring it out. However, if you are just looking for a solution just like I was, jump forward to TLDR;.

## What I thought

At first, I thought that I only need to create a incoming webhook on Discord to get a webhook url.

<amp-img on="tap:lightbox" role="button" tabindex="0" width="926" height="283" layout="responsive" src="/assets/img/discord-webhook.png"></amp-img>

Afterward, create a outgoing webhook on Netlify.

<amp-img on="tap:lightbox" role="button" tabindex="0" width="810" height="450" layout="responsive" src="/assets/img/netlify-normal-webhook.png"></amp-img>

Copy the webhook url from Discord and paste into Netlify.

<amp-img on="tap:lightbox" role="button" tabindex="0" width="810" height="450" layout="responsive" src="/assets/img/copy-webhook-discord-netlify.png"></amp-img>

> You know what? It doesn’t work!

## What’s wrong?

The problem is that the JSON format sent from Netlify isn’t compatible with Discord. After searching around, I found this part [inside Discord Developer Documentation](https://discordapp.com/developers/docs/resources/webhook).

<amp-img on="tap:lightbox" role="button" tabindex="0" width="743" height="322" layout="responsive" src="/assets/img/discord-slack-webhook.png"></amp-img>
## TLDR;

In Netlify, create a **Slack intergration** webhook (_yeah, Slack_), paste your **Discord webhook url** and append `/slack`

<amp-img on="tap:lightbox" role="button" tabindex="0" width="810" height="450" layout="responsive" src="/assets/img/discord-as-slack-netlify.png"></amp-img>

> Have fun :)

<amp-img on="tap:lightbox" role="button" tabindex="0" width="810" height="450" layout="responsive" src="/assets/img/netlify-discord-notification-demo.png"></amp-img>
Hi, i am @ramolec
Tags: presentation
Published: 2017-08-11 14:03:16

---
title: Hi, i am @ramolec
published: true
description: presentation
tags: presentation
---

Hi everyone, i am a newbie study-webdev, i am here for study and find any articles about elm, elixir, phoenix, postgresql, and more.

The enviorement here is great, and dev.to is better than medium! yeahh!

Let's code!
One tiny detail about The Saff Squeeze
Tags: tdd
Published: 2017-08-11 13:44:17

---
title: One tiny detail about The Saff Squeeze
published: true
description: 
tags: tdd
---

The Saff Squeeze technique, introduced by Kent Beck few years ago is very nice. (Unfortunately, the original article has long gone, but there's an archived copy: [Hit 'Em High, Hit 'Em Low](https://web.archive.org/web/20090301204625/http://www.threeriversinstitute.org/HitEmHighHitEmLow.html)) There's just one extra detail, worth noting. If you write a failing test, then on every failure, you'll need to check how exactly how it failed. Because if the reason for failure has changed, it means you did something wrong, and it's time to go one step back. But there's a trick. If you rewrite the test so it asserts on the wrong behaviour, it will be green (until you fix the code, of course). And what it means, is that your code is *failing in a certain known way*. No surprises. I find this variation to be a bit more convenient.