teleren/devto huggingface dataset:
If Hemingway Wrote JavaScript
Published: 2019-12-29 18:15:49

__This Post originally was published in the Junior Dev Insights Newsletter. Sign up here to receive more of these every week: [https://learn.21-lessons.com/junior-dev-insights](https://learn.21-lessons.com/junior-dev-insights)__

> It is better to learn JavaScript late than never to learn it at all.
	- Sir Arthur Conan Doyle

This is a quote from "If Hemingway Wrote JavaScript". If you haven't read it, it's showcasing JavaScript Code as it had been written by famous book authors such as Virginia Woolf or Franz Kafka. It's humoring to read the code and the comments, written in a similar fashion as their books. Every chapter is about solving a particular programming problem such as writing a function that returns the Fibonacci numbers.  Then, a handful of authors showcase their solution. 

I like the book very much for the excellent stories but also because it's illustrating pretty well that there's always more than one solution available for a given problem.

I spent a good deal thinking about the reasons why this book is so fascinating.
When I grew up, I got taught implicitly that there's always a definite solution for a given problem or task. Any deviation would cost points. I had a hard time learning this but also an even harder time to unlearn it again when I started with programming. When you're sitting in front of the computer and wondering how to write these specific lines of code in the best way, it's up to you to figure out the best way. Most of this will come from experience. Going over the same code over and over again, you develop a feeling for readability but also maintainability. 

There are standard applications that solve common problems such as spreadsheet calculations or word processing, but there will always be the need for more niche solutions. It's a bit like the Red Ocean vs. Blue Ocean Strategy. In short, the red ocean describes a world where market share is finite, and in order to increase your share you need to compete with others.
In contrast, the Blue Ocean describes a world where there's uncontested market space, without relevant competition. The latter comes with a mindset of finding solutions that might not be standard, not written down in any books. It's a "thinking out of the box" exercise where you need to combine various aspects from existing methods or procedures to create something new. It's challenging, because of the lack of definite instructions but also exciting. You get to design the world as you like.

In order to get there, you need to build up your own personal toolbox. This consists of Design Patterns, patterns you learn from other people's code, knowledge of available libraries and so on. This helps to build up knowledge you can draw from when the next new project comes your way.
What first Azure cert to take - AZ-900 or AZ-103?
Tags: cloud, azure, certification
Published: 2019-12-29 18:13:51

Hello, Dev.to crowd.
From Microsoft Ignite conference, I happen to have one free voucher for any Azure cert to take, now trying to figure out which one should I be taking. I have about 4 months before the voucher expires

My background - I've never worked with Azure for anything serious, unlike other major clouds (I have AWS and GCP architect certs for example).

AZ-900 (Fundamentals) looks easy but what would you guys do - apply more effort and study for AZ-103 (Azure Administrator) or just pass the AZ-900? 

This one voucher I have was free to me, but still want to spend it meaningfully ;)

Cheers!
We Hate Captchas!
Published: 2020-01-12 04:09:10

---
title: We Hate Captchas!
published: true
date: 2019-12-29 18:01:25 UTC
tags:
canonical_url: https://cohan.dev/we-hate-captchas/
---

As part of the [Year of More](https://cohan.dev/more) I’ve decided this year to do 12 projects over 12 months. I might have already cheated a bit.

I bought a website. Not something I’ve done.. ever before, but this one I liked the look of. The site is called [We Hate Captchas](https://wehatecaptchas.com/).

A little while back I posted an ask on Hacker News “[Are there any viable alternatives to reCAPTCHA?](https://news.ycombinator.com/item?id=21642808)” and didn’t get much of a response outside of “There are other services”. My desire however was not to bring back the old solve-the-words thing that generally got in the way or proved completely impossible for some users with disabilities, I wanted the invisibility of Google’s reCAPTCHA but without the Google part.

Earlier today I happened across a tweet from Dalton Edwards, who’s created such a product. He’s selling up so that he can focus on other projects and was looking for a buyer.

> Project for Sale: [https://wehatecaptchas.com/](https://wehatecaptchas.com/)
> 
> Sale includes ownership of all source code and the wehatecaptchas.com domain.
> 
> Please DM me if you have any questions or wish to make an offer. Thanks 😃— Dalton Edwards ([@DaltonEdwards](https://twitter.com/DaltonEdwards)) [December 27, 2019](https://twitter.com/DaltonEdwards/status/1210660551233343493)

Normally I imagine you should throw down a load of red tape for your standard website purchase but heck, I had a bit of cash knocking about and a need for a reCAPTCHAless CAPTCHAless CAPTCHA (what?). I figured the juice is worth the squeeze if I can ensure there’s an alternative to reCAPTCHA out there. Anyway short story shorter, I went and bought it.

In case anyone’s actively using it as-is I’m going to keep it online and working. In future I’ll rework some of it, change some things here and there, maybe even change domain? Admittedly the first thing I did once we’d sorted the payment/code exchange was grab nocaptcha.net. Aside from that, you keep doing you.

The site will stay up and running, if there are any changes made they’ll be done in a manner that doesn’t break anyone’s current use of the site.

Does this count as a project for The Year of More? I’m not sure yet, I guess if I give it at least a month’s worth of time throughout the year I can count it as the 13th project! Sweet!
Mock software developer interviews
Tags: career
Published: 2019-12-29 16:49:45

Hello! While this time of the year is typically a dull period at work, but is also when many of us plan to switch jobs/careers. In the spirit of giving back, I’m planning to run a little experiment - for  the next 2 weeks, I will be doing 45 min mock interviews for software developers. These interviews will be generic and the primary goals are
- Talk to a seasoned interviewer, better than practicing with friends 
- Cover basic programming skills and system design concepts
- Provide candid feedback - you never get these in real interviews

Format:
First 5 minutes - Intro. Be prepared to answer questions about the experience listed on your resume.

Next 30 minutes - Generic software developer phone screen. Expect some basic programming and algorithm questions, system design concepts and simple coding problems. Use any language of your choice.

Last 10 minutes - will provide candid feedback on our conversation and pointers for improvement

Schedule your time at https://calendly.com/sharath-prabhal/interview

FYI, this is totally FREE and open to developers and aspiring developers from all over the world.

My creds at https://www.linkedin.com/in/sharathprabhal/

#developers #software #interviews #mockinterviews #coding
Keeping your sanity in the face of tough deadlines
Tags: timemanagement, softwaredevelopment, leadership, coding
Published: 2019-12-29 16:24:26

---
title: Keeping your sanity in the face of tough deadlines
published: true
description: 
tags: timemanagement,softwaredevelopment,leadership,coding
---

When work gets stressful due to deadlines, mistakes and difficult people, your favorite thing can become your prison.

You love to code, but suddenly a herculean slog of development and debugging stands between you and basic sanity and well-being. You feel trapped by your own passion.

It’s necessary to prioritize your well-being above everything else. If you start to feel work crossing that line, it’s time to take a timeout and a step back.

Get in the right head space. Do something else for a while. Read, play, be with the people you love.

And if you get the chance, find a way to remind yourself that you still love what you do. Work on a project on your own time that’s just fun to you and has nothing to do with your day job.

This last suggestion may be counter to most common advice about avoiding burnout. I can hear you say, “More coding? That’s the thing that I’m sick of in the first place!”

I think it’s more likely that you’re sick of dealing with unreasonable deadlines and people. You’re worn down by scheduling pressures that have built up over time. It’s the current, temporary situation that’s unpleasant and unrelenting.

All this has nothing to do with what got you into software development in the first place. You can remind yourself of this by working on your own stuff, on your own time. This will prevent you from strictly associating software development with pain. Building stuff can be fun, remember?

Maybe you even had a role in causing the situation you’re in, and your guilt around that has been fueling you to slog on. Good - you can learn from the mistakes that got you into here and avoid repeating them. That lesson is one of those hard-won rewards that comes with experience.

Of course, none of this will make the painful situation go away. When you come back to work, the problems will be there waiting. But you’ll be fresh. And your outlook will be calibrated knowing that this challenge is temporary, and in the grander scheme of things you still love what you do.
Common android utility functions made easier with kotlin-extensions
Tags: android, kotlin, kotlinextensions
Published: 2019-12-29 16:16:07

As `kotlin` has taken over most of Android development ecosystem, by now we all are aware of all the goodies that kotlin offers. One of the most liked goodies is `extension-functions`. 
Following are some of the extension-functions that come in handy in day-to-day android application development.

#### Showing/ hiding views
```kotlin
fun View.visibleOrGone(show: Boolean = false) {
  this.visibility = if(show) {
    View.VISIBLE
  } else {
    View.GONE
  }
```

#### Hide Keyboard
```kotlin
fun View.hideKeyboard() {
  (context.getSystemService(Context.INPUT_METHOD_SERVICE) as? InputMethodManager)?.let { inputManager -> 
    inputManager.hideSoftInputFromWindow(windowToken, 0)
  }
}
```

#### EditText after text changed
We can pass the function to be performed after edit text input changes as `closure`.
```kotlin
fun EditText.afterTextChanged(afterTextChanged: (String) -> Unit) {
  this.addTextChangedListener(object : TextWatcher {
    override fun afterTextChanged(s: Editable?) {
      afterTextChanged.invoke(s?.toString())
    }
    override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) { // na
    }
    override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { // na
    }
  })
}
```

#### RecyclerView set divider
`dividerResId` is the divider drawable if we have to provide custom divider.
```kotlin
fun RecyclerView.setDivider(dividerResId: Int? = null, orientation: Int = DividerItemDecoration.VERTICAL) {

  val dividerItemDecoration = DividerItemDecoration(this.context, orientation)

  dividerResId?.let { resId ->
    this.context.getDrawableResource(resId)
      ?.let { divider ->
        dividerItemDecoration.setDrawable(divider)
      }
  }
  this.addItemDecoration(dividerItemDecoration)
}
```

#### Accessing resources with ContextCompact
```kotlin
fun Context.getColorResource(colorRes: Int): Int {
  return ContextCompat.getColor(this, colorRes)
}

fun Context.getDrawableResource(drawableRes: Int): Drawable? {
  return ContextCompat.getDrawable(this, drawableRes)
}
```

#### TextView extensions to set drawable
```kotlin
fun TextView.setDrawable(
  @DrawableRes
  drawable: Int, start: Boolean, end: Boolean, top: Boolean, bottom: Boolean
) {
  when {
    start  -> this.setCompoundDrawablesRelativeWithIntrinsicBounds(drawable, 0, 0, 0)
    end    -> this.setCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, drawable, 0)
    top    -> this.setCompoundDrawablesRelativeWithIntrinsicBounds(0, drawable, 0, 0)
    bottom -> this.setCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, 0, drawable)
  }
  this.compoundDrawablePadding = 8
}
```

I hope this will be helpful. I will add more in future. Please provide feedback in comments.
How to automate continues deployment for iOS App using FastLane and GitLab Runner

Tags: ios, devops
Published: 2019-12-29 16:14:03

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/7jr5vd3z0w2kfbl5c73g.jpg)
First, let’s say we have a __Branch called Staging__ we want to upload a new build to the App Store Connect when code is pushed to __Staging__ Branch.

You Should First Setup [Fastlane](https://docs.fastlane.tools/getting-started/ios/setup/) and [Gitlab Runner](https://about.gitlab.com/blog/2016/03/10/setting-up-gitlab-ci-for-ios-projects/) Then assign that runner to your GitLab Project.

You Should also [Setup Fastlane match](https://docs.fastlane.tools/actions/match/) action for ensuring that the app is signed before uploading.
in our __Fast file__, we will add a lane responsible for archiving and uploading a build to the App Store Connect. This lane takes two parameters target and identifier.
![](https://thepracticaldev.s3.amazonaws.com/i/0lj93y8po1n94se7gdvb.png)

1. First, we are setting environment variable DELIVER_ITMSTRANSPORTER_ADDITIONAL_UPLOAD_PARAMETERS for fixing Firewall Issues that you may face [More Details](https://docs.fastlane.tools/actions/upload_to_app_store/).

2. Then we are building the project and generate IPA using GYM you can [check all its parameters](https://docs.fastlane.tools/actions/gym/#gym).

3. Then uploading this IPA using PILOT action you can [check all its parameters](https://docs.fastlane.tools/actions/pilot/).

__in our .gitlab-ci.yml we will call this lane when code is pushed to Staging Branch__
![](https://thepracticaldev.s3.amazonaws.com/i/6bbpd3sa7h27bvgqglwf.png)
*Don’t forget to replace your* __target name__, your __App ID__ (Bundle ID) *and your* __registered runner tag.__

__Explanation:__ 
              *we just add one stage for our pipeline it’s called deploy you can add more like a test, lint, build whatever you need to call. Then our deploy stage will run when code only pushed to a branch called staging. our scripts will first run match to ensure Appstore distribution certificates are set. Then we are run the lane that we added to Fast File and passing its parameters.*
This Code Snippet Will Make You Think That `switch ... case` Statements Are Obsolete
Tags: javascript
Published: 2019-12-29 16:13:03

### Before

~~~ js
let b;

switch (a) {
  case '#':
    b = 'one';
    break;
  case '##':
    b = 'two';
    break;
  default:
    b = 'unknown';
}
~~~

### After

~~~ js
let b = ({
    '#': 'one',
    '##': 'two'
})[a] ?? 'unknown';
~~~
Easy-TOTP, A Time-Based authorization token generator library for C#
Tags: webdev, csharp, productivity
Published: 2019-12-29 15:53:05

---
title: Easy-TOTP, A Time-Based authorization token generator library for C#
published: true
description: An easy to use, flexible Time-Based One Time Password TOTP library with AES encryption support for C# in dotnetcore  
tags: webdev, csharp, productivity
cover_image: https://thepracticaldev.s3.amazonaws.com/i/54j0ldqua6xiethibxrv.jpg
---
One easy and secure way to communicate between your web application and your Restful backend services in a micro-service driven architecture is to use a dynamic API-KEY via Time-Based One Time algorithm instead of a constant API Key or JSON Token. each time that the web application sends a request to any of the Restful backend servers, it will include a new API Key which has been generated by the **Easy TOTP** library. On the service side, by using the same **Easy TOTP** library the same API-Key can be generated to be compared with the generated API_Key by the web application in order to authenticate the request.

## Easy-TOTP 's Benefits

- Easy to implement and use
- Lightweight
- Secure
- Flexible

The API-Keys generated by **Easy TOTP** are valid in short time span which will be given to the library on the initialization as "Time Step".

![Easy TOTP flow](https://thepracticaldev.s3.amazonaws.com/i/q1hqzzkdn6jbf9vo4rs0.png)

## Prerequisite

> [Time-Based One Time Password (TOTP)](https://en.wikipedia.org/wiki/Time-based_One-time_Password_algorithm)
>
> [Advanced Encryption Standard (AES)](https://en.wikipedia.org/wiki/Advanced_Encryption_Standard)

## Resources

> [Github Repository](https://github.com/alicommit-malp/EasyTotp)
>
> [Nuget Package](https://www.nuget.org/packages/EasyTotp/1.0.0)

## Usage

```c#
string Key = "12345678901234567890123456789012"; //32 chars

var totp = new Totp()
    .Secret(Key)
    .Length(8)
    .ValidFor(TimeSpan.FromSeconds(5));

var output = totp.Compute();

//output = 12345678

```

## Usage With Encryption

```c#
string Key = "12345678901234567890123456789012"; //32 chars
string _aesKey = "12345678901234567890123456789012"; //32 chars
string _aesIv = "1234567890123456"; //16 chars

var totp = new Totp()
    .Secret(Key)
    .Length(8)
    .ValidFor(TimeSpan.FromSeconds(5))
    .UseDefaultEncryptor(_aesKey,_aesIv);

var output = Convert.ToBase64String(totp.ComputeEncrypted());

//output = DV/tzyq8YG+BRZGSpOVNZQ==

```

Happy coding :)
Daily Challenge #148 - Disemvowel Trolls
Tags: challenge
Published: 2019-12-29 14:30:15

---
title: Daily Challenge #148 - Disemvowel Trolls
published: true
series: Daily Challenge
description: Trolls are attacking your comment section!
tags: challenge
---
**Setup**
Trolls are invading the comment section!

To deal with the threat, write a function that takes a string and returns a new string with all vowels removed (`y` not included). 

**Example**
`"This website is for losers LOL!"` => `"Ths wbst s fr lsrs LL"`

**Tests**
`"No newbies allowed, go to #beginners"` =>
`"LULZ TROLLED"` =>

Try to keep it simple. Have fun!

***
_This [challenge](https://www.codewars.com/kata/52fba66badcd10859f00097e) comes from osuushi on CodeWars. Thank you to [CodeWars](<https://codewars.com/>), who has licensed redistribution of this challenge under the [2-Clause BSD License](<https://opensource.org/licenses/BSD-2-Clause>)!_

_Want to propose a challenge idea for a future post?  Email **yo+challenge@dev.to** with your suggestions!_
The startup idea evaluation meter
Tags: startup, sideprojects
Published: 2019-12-29 14:02:39

I was missing a tool to evaluate startup ideas. I found this awesome lecture by YC’s Kevin Hale on how they evaluate startup ideas (they probably did more than 100K) and created a meter for it (you get a score). You can check it out on my blog: https://www.polidoesntcare.com/blog/the-startup-idea-evaluation-meter
Reading Snippets [22]
Tags: javascript, beginners, todayilearned, books
Published: 2019-12-29 12:38:49

The console API contains few other methods that have practical use, especially when time is of essence. 

If you want to take a look at all object's properties and methods, you can print it out directly into the console using <code>console.dir()</code> method. 

What's fantastic is that you can even output DOM elements.

You can track the amount of time between function calls with <code>console.time()</code> and <code>console.timeEnd()</code>. This can be helpful when optimizing code. 

Source- Javascript Grammar
How to inherit tags in YouTrack from task to subtask
Tags: javascript, youtrack, agile, kanban
Published: 2019-12-29 12:37:43

If you are using [JetBrains YouTrack](https://www.jetbrains.com/youtrack/) as your Task tracker, you are probably already familiar with Workflows. This is an event-based code snippet that allows you to perform some routine tasks automatically or on schedule. These workflows are written in JavaScript, so most of the team could easily create routines they need. Because in my team both frontend-developers were very busy with the refactoring of some core module, I decided to write a script on my own.

So, imagine, you have tags in your project and every time you add or remove a tag from a card, you would like to populate this change top-to-bottom and bottoms-up: from task to subtask and from subtask to parent. So, how would you inherit a tag in Youtrack? Here is a code snippet:

```javascript
var entities = require('@jetbrains/youtrack-scripting-api/entities');
exports.rule = entities.Issue.onChange({
  title: 'Inherit tags',
  guard: function(ctx) {
    return ctx.issue.tags.added.isNotEmpty() || ctx.issue.tags.removed.isNotEmpty();
  },
  action: function(ctx) {
    var issue = ctx.issue;
    issue.links['parent for'].forEach(function(childIssue) {
      issue.tags.added.forEach(function(tag) {
        childIssue.addTag(tag.name);
      });
      issue.tags.removed.forEach(function(tag) {
        childIssue.removeTag(tag.name);
      });
    });
  },
  requirements: {
    
  }
});
```

If you would like to copy tag from subtask to parent, here it is:

```javascript
var entities = require('@jetbrains/youtrack-scripting-api/entities');
exports.rule = entities.Issue.onChange({
  title: 'Populate tags up',
  guard: function(ctx) {
    return ctx.issue.tags.added.isNotEmpty() || ctx.issue.tags.removed.isNotEmpty();
  },
  action: function(ctx) {
    var issue = ctx.issue;
    issue.links["subtask of"].forEach(function(parentIssue) {
      issue.tags.added.forEach(function(tag) {
        parentIssue.addTag(tag.name);
      });
      issue.tags.removed.forEach(function(tag) {
        parentIssue.removeTag(tag.name);
      });
    });
  },
  requirements: {
    
  }
});
```

I hope it helps!
**Simon Osipov**
[Web](https://simonosipov.github.io/)
[Twitter](https://twitter.com/OsipovSimon)
[FB](https://www.facebook.com/osipov.simon)
[GitHub](https://github.com/SimonOsipov)
[LinkedIn](https://www.linkedin.com/in/simon-osipov/)
[Telegram](https://t.me/SimonOsipov)
[Data Engineering TG channel RUS](https://t.me/ohmydataengineer)
How I Implemented Private Messages on my Website
Tags: html, svg, twitter, conversation
Published: 2019-12-29 12:25:30

After implementing the [dark mode](https://francoscarpa.com/articles/darkmode/), I wanted to continue in the process of improving my website with other useful functionalities. Now, if you have a Twitter account, you can send me a **private message**, much like as you do every day on Facebook, WhatsApp, Instagram, etc. If you feel more comfortable using messages instead of e-mails, you can write me one now.

# **→ Read the [article](https://francoscarpa.com/articles/privatemessages/) on my personal website**.
10 minutes me kitni % Todo App bna sakte ho? (Urdu/Hindi)
Tags: react, urdu, hindi, 10minchallenge
Published: 2019-12-29 12:09:48

"Todo App bnana koi halwa🥣 nhi"


10 minutes me kitni % Todo App bna sakte ho?


UNCUT/non-edited video


Source code >>>[here](https://github.com/NomanGul/10Min-Todo-App)<<<


![in 10 minutes](https://media.giphy.com/media/l4FB6D5zYQRluSno4/giphy.gif)