teleren/devto huggingface dataset:
Horrible Howto - Get that Middle Initial
Tags: horriblesnippets, howto, snippet
Published: 2019-04-20 00:08:00

---
title: Horrible Howto - Get that Middle Initial
published: true
description: How to build the middle initial and bookmark this page.
tags: horriblesnippets, howto, snippet
---

I really just wanted to post my first post, and I had just made this snippet, so I decided to post it here!  What the hay!

```javascript
const formatMiddleInitial = middleName => (middleName ? middleName.charAt(0).toUpperCase() : null);
console.log('stuff', formatMiddleInitial('clark hark'));
```
Fetch so many things, at once
Tags: javascript, es6
Published: 2019-09-19 15:01:15

---
title: Fetch so many things, at once
published: true
tags: javascript,es6
canonical_url: https://aravindballa.com/writings/fetching-things-at-once/
---

 ![0](https://source.unsplash.com/random/800x600/?nature,food)

There is the `fetch` API in Node, which allows us to make a HTTP request and get some information from the servers. We can use that to make REST calls, get HTML content of a webpage(if we are using node for scraping) and many more things.

> This article is valid for any function that returns a promise.

An example of such call goes like this

```js
fetch('/url')
  .then(res => res.json())
  .then(data => console.log(data));

```

# The Async way

We could do the same thing, using async and await.

```js
const result = await fetch('/url');
const data = await result.json();

console.log(data);

// Or, a one-liner
// const data = await (await fetch('/url')).json(); 😉

```

# I have so many things to fetch!

Okay fine. We can do that over a classic for loop. The synchronous nature will be preserved. I mean, we can fetch one after the other, synchronously.

```js
const urls = [...];
for(const url of urls) {
    const result = await fetch(url);
    const data = await result.json();

    console.log(data);
}

```

But what if, the order does not matter? We can fetch them all at once. Yes, all at once, using the Promise API. After all, `fetch` returns a promise and that’s why we `await` for it to be resolved.

Promise API has this method `Promise.all()` , which can be awaited on for all the promises that it accepts as an argument to be resolved.

```js
const urls = [...];
const promises = urls.map(url => fetch(url));

await Promise.all(promises);

for (const promise of promises) {
    const data = await promise.json();
    console.log(data);
}

```

This will save us a lot of time. Imagine we want to parse many webpages, around 100, and each webpage takes 2 seconds to be fetched and scraped for information we need. If we fetch it one after the other, it will take us around 200 seconds, which is over 3 minutes. But if we fetch all at once, it will take under a minute.

# Like, really SO MANY!

What is we have over 10000 urls to fetch. If we do the same thing as above, we will most probably not make it. We will have to face some weird socket hangup error. What can we do about it?

There is a node package called `Bluebird` which has its own Promise API and it functions the same. It has this method called `map`, which takes an extra options argument where we can set concurrency.

`Promise.map(urls => fetch(url), { concurrency: 100 });`

This will, as we can infer from the line, concurrently fetch 100 requests at a time. This will save a significant load on CPU.

```js
const Promise = require('bluebird').Promise;
const urls = [...];
const promises = await Promise.map(
    urls => fetch(url),
    { concurrency: 100 }
);

for (const promise of promises) {
    const data = await promise.json();
    console.log(data);
}

```

Thanks for making it till the end.

Keep on Hacking! ✌
Call Us What You Want is officially on board!
Tags: opensource, news
Published: 2019-04-19 23:27:51

---
title: Call Us What You Want is officially on board!
published: true
description: This is exciting! We're finally starting our own blog!
tags: #opensource, #news
cover_image: https://thepracticaldev.s3.amazonaws.com/i/5oltdik869z734d938ek.png
---

Hello, World!

We contemplated creating our own website from zero or using a platform such as Medium. In the end, we've decided that [dev.to](dev.to) is the perfect environment for our posts — just like *Call Us What You Want*, it's 100% open source! 

Right now, you might be asking yourself: what is *Call Us What You Want*? Put it simply, we're (at least two) friends that love music and programming. We originally created this organization with our first project idea: an open source platform where people can rate the music they listen to.

{% twitter 1107781263820275712 %}

We have been working on this project (which we named [Musicritic](https://github.com/calluswhatyouwant/musicritic)) and [spotify-web-sdk](https://github.com/calluswhatyouwant/spotify-web-sdk) for over a year now and while there's still a lot of work to be done, we've sure come a long way! We'd be honored if you took your time to check out our projects and maybe contribute with them yourself.

{% twitter 1103478430555951104 %}

Here in **dev.to** we intend to discuss our experiences and share what we've been learning along the road. Code design decisions, how to contribute with our repositories, our recommended best practices... We're here to continue improving ourselves and (who knows?) inspire people to contribute with open source as well.

That's just about everything. Hope to see you all soon with posts that actually have some interesting content!

Oh, I've just come across [a pizza recipe posted here](https://dev.to/tomekponiat/my-pizza-recipe-3ook)... I guess we'll feel free to post about some other things from time to time. 😅

Until next time!
First, use the right tool for the job. Check out the options in this pocket-sized guide.
Tags: python, editors, webdev, datascience
Published: 2019-04-19 23:13:26

---
title: First, use the right tool for the job. Check out the options in this pocket-sized guide.
published: true
description: Looking to improve productivity? Check out the options in our comparison of Python editors and IDEs. Find a better fit.
tags: python, editors, webdev, datascience
cover_image: https://thepracticaldev.s3.amazonaws.com/i/lncis7b34xe9ac34o8lm.jpg
---


So you want to set up a superior Python environment, but you don’t want it to be a major hassle. Well, this was written for you!

In this post, we explore the top IDEs and general-purpose editors for all your Python programming needs.


What Are IDEs?
An integrated development environment (IDE) provides Python programmers with a suite of tools that streamline the coding, testing, and debugging process for specific use cases.

The best Python IDE for you is the one that will help you ship code faster by automating repetitive tasks, organizing information, and helping reduce errors.

What Is a Code Editor?
Code editors are tools that make writing code easier, offering syntax highlighting and code formatting, among other things. They differ from IDEs in that they have less features outside of their primary use case which is writing code.

For this reason, they are typically quicker and lighter weight, which leads some developers to preference using a code editor over an IDE.

Some code editors also deliver additional functionality, like debugging and code execution, however.

Want to know more? Check out:
https://owlskip.com/s/top-ides
Job Search - Day 1 of 42
Tags: jobsearch, jobseeking, jobhunt
Published: 2019-04-19 22:08:48

---
title: Job Search - Day 1 of 42
published: true
description: I slept in today
tags: job search, job seeking, job hunt
cover_image: https://thepracticaldev.s3.amazonaws.com/i/iu65kur20v9onni7vkzc.png
---

I slept in today
I am not sure that is what people do on the first day after being let go
This is a new experience for me - nowhere to be, yet financial secure

# Personal Professional Networks

I signed up for LinkedIn Premium - one month free

As it began to get turbulent, I began to test the waters weeks ago
If I can get a job without refreshing my resume, that would be fantastic

I connected with a local agile consultancy shop, Lean Dog
A friend reached out over Twitter when I stated I was a **free agent**

`Never burn a professional bridge`
`Make friends with your enemies`

# Not The Only One

Many of my friends were recently impacted by a round of layoffs at OnShift
I already received a hint about a fantastic Python opportunity in CLE

# [My Resume](https://drive.google.com/file/d/1UZ7cIZPTmE4SALo7kiPH_B1yoYQM4643/view?usp=sharing)

What makes a good resume? Not a one pager?!?! *<sigh>*
Everyone has opinions...

Software engineers are so dynamic, I am more than the jobs I worked

- [Brain Bit](https://brain-bit-api.herokuapp.com/dashboard)
  - Integrated professional activity tracker dashboard
- [Twitter Learning Journal](https://s3.amazonaws.com/dev3l/learning_journal/twitter_learning_journal_20170410_20180724.html)
  - Professional activities from April 2017 to July 2018
  - Spoke at Agile 2018 about the concept
- Speaking 2019 (Looking for Sponsors!)
  - [Agile & Beyond](http://www.agileandbeyond.com)
  - [Agile 2019](https://www.agilealliance.org/agile2019/)
  - [Lean Agile Scottland](https://2019.leanagile.scot)
How to turn your Pixelbook into a Pentestbook
Tags: pixelboox, pentesting, chromeos, google
Published: 2019-04-19 21:12:58

---
title: How to turn your Pixelbook into a Pentestbook
published: true
description: 
tags: pixelboox, pentesting, chromeos, google
---

![My ptf screenshot](https://thepracticaldev.s3.amazonaws.com/i/giqyutqxt0oce5stdue0.png)

Read more:
https://www.peerlyst.com/posts/how-to-turn-your-pixelbook-into-a-pentestbook-archzilon-eshun-davies
Seeking some closure
Tags: javascript, functions, closures
Published: 2019-04-19 21:00:39

---
title: Seeking some closure
published: true
description: Brief overview of a major debugging hurdle I moved past
tags: Javascript, functions, closures
cover_image: 
---

### Introduction

As part of my effort to better understand how functions work in Javascript, I had reviewed the concept of closure and how powerful it can be when it comes to organizing code. I won't go over closure here, but you can read more from Mozilla [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Closures). The specific issue I dealt with involved accessing the closure variables in an inner function.

### Can't see bloody A,B,C or D

A situation I had never encountered before involving the Scope debugging panel in Chrome. I was attempting to determine the value assigned to a variable by a function call while inside a nested function. A simplified version of the scenario is below:

~~~~
function testing() {

    var a = "modern";
    var b = "major";
    var c = "general";

    function innerFunction() {
        console.log(`Not using parent function var`);
    }

    innerFunction();

};
~~~~

If you were to run the function `testing()`, you would see that there is no sign of the variables `a,b or c` if a breakpoint is placed inside the `innerFunction()`.

![Image of Chrome debugger sidebar](https://thepracticaldev.s3.amazonaws.com/i/667dr8tvk5r1rqp5wcd8.png)

### I can't see you

What I discovered was that the values of references in the outer function are not visible in the inner function unless they are actually used. Making a one line change to the above example results in this:

~~~~
function testingClosure() {

    var a = "modern";
    var b = "major";
    var c = "general";

    function innerFunction() {
        console.log(`Using parent function var, value: ${a}`)
    }

    innerFunction();

};
~~~~

The outer `testingClosure()` function variables are now available inside the `innerFunction()` for debugging.

![Image of Chrome debugger sidebar with closure variables]
(https://thepracticaldev.s3.amazonaws.com/i/0l8h58smbjq42gzprjzd.png)

I had originally wanted to examine the value of `a` inside the inner function without writing any code, but due to the way browser debugging works, there was no way around it.

### Codepen

You can experiment with closures here:

{% codepen https://codepen.io/moremooredesign/pen/vMdVzm default-tab=js%}

Try placing a `debugger` statement in the inner function and see the `scope` difference.
Visual Studio, Why Can't You Just Let Me Have This One (Solution Folder)?
Tags: programming, organization, architecture, tips
Published: 2019-04-19 20:37:51


---
title: "Visual Studio, Why Can't You Just Let Me Have This One (Solution Folder)?"
description: This quick post covers a very simple workaround for handling Visual Studio's issue when it comes to naming Solution Folders.
tags: programming, organization, architecture, tips
cover_image: https://thepracticaldev.s3.amazonaws.com/i/9h8px3ijsr6zwihgr2wp.jpg
published: true
---

_This was originally posted on [my blog](http://rion.io)._

If you've ever worked in a large code-base of around a hundred or so projects, then you know that organizing your code can almost be as important as writing the code itself. Organization is always subjective, sometimes multiple projects are enough, sometimes it can help to organize code into things like Solution Folders, which you'd imagine would be pretty simple - but that's not always the case as you'll soon see...

## Naming is hard; Naming Solution Folders is impossible.

While it's well documented that naming things in software is challenging, you can generally come to a consensus amongst your team on _what_ to name something. Apparently, solution folders in Visual Studio are completely different animals and **the flagship IDE simply won't let you name a solution folder the same as an entity that exists within your project already:**

![](https://thepracticaldev.s3.amazonaws.com/i/r1x62nityczada7bvnfc.gif)

So after a bit of searching around - I wasn't really able to come across a clear cut solution or workaround, so I decided to write up a short post on one that I came across. Basically, Visual Studio has a bit of trouble attempting to create a logical folder of a given name when a physical folder (or some other entity like a project file) shares that same name. **The trick here is to simply create a new Solution Folder with a throwaway name:**

![](https://thepracticaldev.s3.amazonaws.com/i/0jx5dwacavm0xqqeut2l.PNG)

**Then move the contents into the folder that you'd like (at least the entity with the conflicting name):**

![](https://thepracticaldev.s3.amazonaws.com/i/q4tjkbzz1xl30o0tbpcm.PNG)

**Finally, safely rename the folder to the name of your choosing:**

![the world is right](https://thepracticaldev.s3.amazonaws.com/i/an4z7vebx1vfvedwswlh.PNG)

And that's it! Now you can easily organize your larger projects and solutions, regardless of the name that you intend to you and if it conflicts with other entities in your project.
Flashback Friday: Sh*t DEVs Say
Tags: video
Published: 2019-04-19 17:27:31

---
title: Flashback Friday: Sh*t DEVs Say
published: true
description: Highlighting the everyday life of a programmer.
tags: video
cover_image: https://thepracticaldev.s3.amazonaws.com/i/rn9ipvvyvyoovkgzk057.png
---

This was a lot of fun to make. From 'the olden days' (Fall 2016): 

{% youtube 9z-Pdfxxdyo %}

Happy Friday!
What do you think of an #offthecuff tag for stories written spontaneously and without editing?
Tags: discuss, offthecuff
Published: 2019-04-19 17:05:12

---
title: What do you think of an #offthecuff tag for stories written spontaneously and without editing?
published: true
tags: discuss, offthecuff
---

I often find myself wanting to write something, but am put off by my own process. I want a tag that conveys my writing has skipped my normal process, and thus likely a bit rougher than my other articles.

Consider what I put into a typical article:

- gather topic points and rough outline
- write first draft
- review and improve flow
- wait a day or two, review and edit language
- upload to grammar tool, make final adjustments
- post here, post there, post and promote everywhere

This certainly dissuades me from writing something quickly. Not all of my opinions are worthy of this process -- I'm willing to admit that. But sometimes I have something in my head and want to get it out!

I've used the [#discuss](https://dev.to/t/discuss) tag for this before, but then I ended up framing it that way. For my previous post, I found the [#healthydebate](https://dev.to/t/healthydebate) tag -- it appears new. Perhaps that's the right place.

{% link https://dev.to/mortoray/already-know-the-interview-code-question-don-t-admit-it-61a %}

But I also tagged it #offthecuff. For those unfamiliar with the expression, off-the-cuff refers to doing something spontaneously, without a lot of planning or foresight.

What do you think?

_I'm okay with aliasing the tag with #rambling or #curmudgeon._ :)
I'm the creator of browserless.io -- let's talk about starting your own company
Tags: ama
Published: 2019-04-19 16:57:09

---
title: I'm the creator of browserless.io -- let's talk about starting your own company
published: true
tags: ama
---

Almost 19 months ago I started a business called browserless.io. Mostly came from my attempts at writing a headless driver and scaling it for production. There's been _a lot_ of challenges and wins, so much so that there's a wealth of information now that I'd like to get out.

But I really want this to be about what _you're building_. What's keeping you from building it? Is it not ready yet? Feel free to ask questions or get ideas!
Suggest alternatives to JavaScript or is it better among any of them?
Tags: javascript
Published: 2019-04-19 16:36:26

---
title: Suggest alternatives to JavaScript or is it better among any of them?
published: true
description: 
tags: JavaScript
---

Hy there , this is my first post in Dev.to and i am Currently planning to learn JS but i wanna know is there any good alternative to JS for Web,Mobile or JS is Better of them.Sorry for my Bad English.
Why I used Python to unzip a file
Tags: python, wordpress, ssh, terminal
Published: 2019-04-19 16:09:42

---
title: Why I used Python to unzip a file
published: true
description: How Python again and again shows me life is worth living.
tags: python, wordpress, ssh, terminal
---

So my day has started like this:

I'm ssh'd into a pretty locked down server in a data center.

This server runs an instance of Wordpress that I have been tasked with migrating over to wordpress.com.

Picture wordpress.com now: 
Requires importing with large XML files, no access to the server via terminal, no access to mysql, no logs, only wp-admin via front end.

I needed to install a plugin on the site I'm migrating from but could not through the admin panel because its locked down.

####Fine.

Normally, I would just download the plug in and run scp from local to remote to get it to where it has to go.

That looks like this:
```
cd /to/install/dir
scp <filename> serveraddres:/dir/to/save/file/to
```

Enter your ssh password and thats it.

####*Alternate path...*

However, sometimes I am already ssh'd into the server and this was one of those occasions. I could have opened a new terminal tab and did the above but again trying to expedite in the least amount of steps.

What I did was use curl to download the file to the server from source skipping the step of putting it on my machine first to then copy it to the server.

That looks like this:
`curl http://sitename.com/wp-fileIwant.zip --output wp-fileIwant.zip`

Great the file is on the server.

So I tried first running `unzip` to no avail because it wasn't installed.
Then I tried installing unzip and that was a no go for some reason i didn't feel like debugging. I am wary of the rabbit holes that persistently force us devs to context switch.

Then I came across this gem:

![all you need to unzip a file with python](https://thepracticaldev.s3.amazonaws.com/i/rhf0kyxz4db7jwzenqla.png)

Which funnily enough, I *could not* open with `nano`, or `emacs` because neither was installed. So `vim` came in handy here.

Wrote the code and saved it in the dir.

Then I ran it. That looked like this:
`python unzip.py wp-fileIwant.zip`

And lo and behold my file was unzipped.

I could activate it via the front end and do what I needed.

**Thus, python.**
How to make TypeScript shut up about that library 
Tags: kludge, typescript
Published: 2019-04-19 15:56:06

---
title: How to make TypeScript shut up about that library 
published: true
description: In general, it’s good to type as much as possible so you get the benefits TS offers. But how do you silence compiler warnings when it’s not your code and the upstream library just isn’t typed correctly?
canonical_url: https://logicmason.com/2019/how-to-make-typescript-shut-up-about-that-library/
tags: kludge, TypeScript
---

April 14, 2019

TypeScript is a tradeoff.

> “I use typescript when I feel like having hours of migraines using 3rd party libraries and making sure I don’t have a single space or comma out of place! Works like a charm! Get a headache 10/10 times.”
>
> -somebody on Reddit

TypeScript can do wonders for your code editor’s ability to help you with auto-completions, it can enforce contracts between different parts of your code base in the way documentation never could, and it can help a large team move faster.

![TypeScript errors](https://thepracticaldev.s3.amazonaws.com/i/x2107udznzf4ypn6kqnz.png)

It can also drive you to the point of madness when dealing with its increasingly pedantic compiler, especially when dealing with third party libraries that have incomplete, incorrect or conflicting types.

In general, it’s good to type as much as possible so you get the benefits TS offers. But how do you silence compiler warnings when it’s not your code and the upstream library just isn’t typed correctly?

You can add this to your codebase:

```js
declare const annoyingLibrary: any;
```

And then the TypeScript compiler will stop complaining about `annoyingLibrary` types.

*Originally published at [logicmason.com](https://logicmason.com/2019/how-to-make-typescript-shut-up-about-that-library/) on April 14, 2019.*