teleren/devto huggingface dataset:
How do you cope with bad code?
Tags: discuss
Published: 2019-09-11 13:25:19

I don't really know how to put it without sounding like a crybaby but let's say I currently need to work on some really bad code (both in quality and structure) and I don't have to time (deadline) to fix/change/refactor anything. I end up implementing some things by writing really dirty code (because it needs to be adapted to the already existing code) and I absolutely hate it and feel bad about it.

Anyway, not asking for a solution or anything, I know I'll just have to make do, it's part of the job, but for those of you who are/were in a similar situation: how do you cope with this? How do you stop caring too much about quality and just do what must be done?
Are You a Mediocre Developer? ME TOO
Tags: webdev, career, discuss
Published: 2019-09-11 13:12:54

---
title: Are You a Mediocre Developer? ME TOO
published: true
description: 
cover_image: https://thepracticaldev.s3.amazonaws.com/i/iddlw6frfiwd2hd4a2tj.png
tags: webdev, career, discuss
---

## Story Time

Recently, I applied for a job...

I was asked to do this test task:

![task-pic](https://thepracticaldev.s3.amazonaws.com/i/4d9be9ffibyoaygo97v4.png)

Quite simple, I did it with some extra bonuses, like using Vue.js and deploying onto Heroku. [Here is the repo url: Debtor Administrator](https://github.com/yaseralnajjar/Debtor-Administrator)

What I got in response was:

![tl-dr](https://thepracticaldev.s3.amazonaws.com/i/4wj9j7qokktul7i15jck.png)

* If you would like to hear the full story, I've written it into the comments.





## Setting The Bar

![high-bar](https://timcoffeyart.files.wordpress.com/2011/10/setting-the-bar-high.jpg)
*Original pic: https://timcoffeyart.wordpress.com/2011/10/26/setting-the-bar-high/*

Don't get me wrong, I'm not saying they should've hired me...

I'm just saying **their bar seems non-realistic!**

Recently, many companies are just setting the bar too high.

You realize this when they start inventing stuff like:

1. 10x Engineer.
2. Full Stack DevOps Developer (I'm not kidding!).
3. Passionate engineers (who work overtime and learn on their free-time).
... etc

Like, SERIOUSLY?!





## Good vs Great

There is a fine line between good and great, the best way to describe it is [how Steph explained it in her awesome post](https://dev.to/stephsmithio/how-to-be-great-just-be-good-repeatably-bk5):

> **Perhaps “great’, is just “good”, but repeatable.**

Hmm, how many people are "good"? and how many people are "great"?

The reality of how good most people are is just in this curve:

![good-curve](https://thepracticaldev.s3.amazonaws.com/i/42svzf40zpn1s2zhmo0e.png)

* This is called the "normal distribution" in statistics which you might not even care about 😄

You see right there, the percentage of people who are great and bad is just super small.

The odds are, **mostly me and you fall among the GOOD developers**.

So, instead of chasing that dream of being a "ninja developer":

* How about you **stop chasing that stupid dream**, FOR REAL!

* How about you **love being a good developer, repeatedly**.

* How about **investing in yourself** and learning new stuff every single day.

* How about you accept that **it's very okay to take a break sometimes**.
React custom hook question
Tags: discuss, react, typescript
Published: 2019-09-11 12:32:23

I have been implementing a React custom hook. In the project, I noticed a pattern when getting data to the React components.

- first, we check do we have data already in the store (selector in the function will give the data)
- if not, we dispatch an action that will have a token and parameters

As it is a crucial part of the app, I thought someone with hook experience might have a look at this. 

Especially, the payload and action part. Should I use `usePrevious` hook and use `isEqual` from lodash. Or, `useMemo`?.

All ideas appreciated, thanks!


```
/* annotated version of the hook */

export function useFetchIfNeeded<T>(
  selector: (state: AppState) => T,
  action: (payload: any) => ThunkAction<any, any, any, any>,
  payload: Object,
  checkFn?: (input: T) => boolean
) {
  // redux hook
  const dispatch = useDispatch()
  
  // get token
  const token = useSelector((state: AppState) => state.global.token)
  
  // get data using the selector function
  const data = useSelector(selector)

  // use check function to verify do we need to fetch data or not
  // default is null comparison
  const check = useCallback(() => (checkFn ? checkFn(data) : data !== null), [
    checkFn,
    data
  ])
  const fetch = useCallback(() => {
    if (!token) {
      return
    }

    if (check()) {
      return
    }

    dispatch(
      action({
        ...payload,
        token
      })
    )
    // TODO: action and payload are objects, should I make my own comparison?
  }, [dispatch, token, check, action, payload])
  useEffect(() => {
    fetch()
  }, [fetch])
```
JavaScript Import in VSCode IntelliSense
Tags: help, vscode, javascript
Published: 2019-09-11 11:33:34

I try to set up a JavaScript project in Visual Studio Code.
Everything works fine, except IntelliSense. In my particular case, I added _Styled Components_ and _PropTypes_, but both packages won't get suggested as import.

![](https://thepracticaldev.s3.amazonaws.com/i/0v7b155shasdkrywj1sk.png)

I already created a `jsconfig.json` file in my project root, but that didn't help either.

```json
{
  "compilerOptions": {
    "target": "es6",
    "module": "commonjs",
    "jsx": "react",
    "allowSyntheticDefaultImports": true
  },
  "exclude": ["node_modules", "public", ".cache"]
}
```

Is there anything else I need to configure, or do I have to install an extension?

Would be awesome if anyone can help 🥳
I am a YC alumnus & 3X VC-funded founder-CTO. AMA!
Tags: ama, career, programming, startup
Published: 2019-09-11 10:49:26

I am an engineer who has founded three startups in the last 10 years. The first two were funded by Sequoia Capital & YCombinator. The current one is backed by Accel Partners. I have also worked at three other growth stage tech startups.

Having seen multiple product lifecycles, I have experienced the pain of creating & scaling products from scratch. Most of my experience and expertise comes from Distributed Systems.

On the non-tech side, I love building teams and going through the zero-to-one phase in a startup. 

Feel free to ask anything about the YCombinator application process, entrepreneurship, building engineering teams, scaling products or anything else you are wondering about.
Useful NPX
Tags: npx, npm, useful
Published: 2019-09-11 10:39:28

---
title: Useful NPX
published: true
description: Some really useful npx scripts for developers.
tags: npx, npm, useful
---

You probably use, or at least have heard of, `npx` if you work with Javascript. If not, look it up. It's really handy.

Here are some commands I run on the reg with npx:

---

```
npx okimdone npm install
```
If you have your volume up, a voice will tell you when the command you entered is done. It's really handy for tasks that take ages but want to come back to after.

---

```sh
npx npm-check

# Options
-u - Interactive Updates
-y - Update everything
-s - Skip unused
-g - Global
```
Checks your installed npm packages and gives you info about them. It's great for seeing if you have stuff in your package.json that your aren't actually using in your app.

Running `npx npm-check -su` will simply update all of your packages.

---

```sh
npx npkill
```
Run this from the folder that holds all of your projects. It will list out every node_modules folder from there along with the amount of disc space it is using. You can then go through them and delete the node_modules folders individually by hitting the space bar.

---

```
npx generact
```
If you are creating components for react, this is really useful.

Generact will duplicate a component you already have made and give it a new name. It will copy the old components file structure and change the component name anywhere it is written inside it.

---

```
npx samuelbeard
```
Just thought this was neat.

---

If you know of any more npx tools that are super useful, bung em in the comments.
JSON Discoverer - Visualize the schema of your JSON documents
Tags: json, uml, api
Published: 2019-09-11 10:33:23

<a href="http://som-research.uoc.edu/tools/jsonDiscoverer/#/">JSON discoverer</a> allows you to discover the implicit schema of your JSON documents. 

Any JSON document includes both metadata (i.e., the schema) and data (i.e., the objects/values conforming to the schema). The problem is that typically the metadata part is implicit (alternatives like [JSONSchema](https://json-schema.org/) exist but are not widely used) and must be inferred from the slight (nested) structure of the data itself.

This makes really difficult to *read* a JSON document. Given a JSON document our tool will generate a [UML class diagram](https://modeling-languages.com/uml-tools/) to visualize the structure of the document and a UML object diagram to show the JSON data itself as an instance of the schema. 

We believe the tool is very useful to quickly grasp, for instance, the kind of response that an API call is providing.

Moreover, our tool also helps you to defect possible combinations between different APIs by discovering common schema parts among them. 

Indeed, the tool provides three different services:

- Simple Discoverer
The simple discovery mode analyzes a single JSON definition and provides both the schema and the data.

<img src="http://som-research.uoc.edu/tools/jsonDiscoverer/images/simpleLanding.png" alt="Simple JSON Discoverer">

- Advanced Discoverer
The advanced mode analyzes sets of JSON definitions and discovers the common schema among them.

<img src="http://som-research.uoc.edu/tools/jsonDiscoverer/images/advancedLanding.png" alt="Simple JSON Discoverer">

- API Composer
The API composer helps you to identify API compositions in a graphical way.

<img src="http://som-research.uoc.edu/tools/jsonDiscoverer/images/compositionLanding.png">

For this later part, we have a (separate and more recent) tool that you can also take a look at: [REST API Composer](https://modeling-languages.com/rest-api-composer/). For the rest, JSON Discoverer work as smooth as the first day and has helped a lot of people since. Give it a try!
Bootcamp challenge and how I have adapted In the last few weeks 
Published: 2019-09-11 10:10:28

In general, adaptability by definition is Ability of an entity or organism to alter itself or its responses to the changed circumstances or environment. Adaptability shows the ability to learn from experience and improves the fitness of the learner as a competitor.
https://en.wikipedia.org/wiki/Adaptability
In leal life of a human, I can explain adaptability as  The ability for people, teams, and organizations to adapt to changes in their environments, stay relevant and avoid obsolescence and also adapt you must be open to change, which means you must have the will—emotional tolerance, mental fortitude, spiritual guidance—to not only face uncertainty but smack it in the face and press on.

                       basic of my adaptation
In general the key helps me to adapt in my last few weeks in bootcamp challenges are based on the following facts:
1. hard work ; hard work helps me to adapt cause i was getting the chance to pass first week of bootcaacmp so i decided all my power than what i use before in my first week so that to never fail at the end while i was having to do something and achieve my dreams
2. coleagues motivation: also i get a good team which motivates me remind me that  the time gone can't come again so that try all my best to never loose a chance to pass also week 2
3. LFA feedbacks: actual it's not easy to know how to figure out errors and fix them on your own while you are a beginner in coding it's very taff but because I was looking how technology is changing the world I try my best to ask google,my colleagues other people so that to fix all the errors I get and implement the feedbacks perfectly
4. to be focus: sometimes in my last week because of working hard i thought that i can leave it but also i remembered that chance comes once in life that's why i decided to never give up still push as much as i can so that to achieve my dreams
4. pray: praying is one of the things strengthen my adptability where i put all my faith in god cause i was struggling to learn and know new things and use it also to provide finished products to my LFA so all of that to get out of them and thinking well with fresh mind i use praying and strengthen me that what i see looks like impossible to me  that is possible in front of good
The Word that Kills your Dreams🔥
Tags: career, startup, challenge, beginners
Published: 2019-09-11 08:22:43

Hello,

Do you know the single most deadly word that is killing the dreams of achieving anything?

**"Until."**

It gives excuses a valid reason without you even realizing it. It comes in a variety of phrases.

**I can’t do it until ___**

**I can’t start until ___**

I can't start a business until I learn to be more productive, master my emotions, enhance my leadership skills, etc.

I can't start building a list of potential customers until I fix my social media profiles, get my landing page with a great design, and get 5 blog posts published.

I can't share my idea until I am sure it will be a great success.

I need to wait until ______

And so, on….

It's almost impossible to put an end to the until excuse when you aren't sure of the outcome of the action not taken.

"Until" makes people stuck in a perpetual mode of waiting.

And here's the worst part.

When you are trying to avoid the real work, the work you want to do, you replace it with mindless activities.

You start reading many blog posts about entrepreneurship, startups, personal growth, and productivity.

You are buying biographies of Steve Jobs, Elon Musk, Buffet, Gates, and many others, reading them to know how they achieved their dreams.

You feel good about it because you are busy doing something productive. You are just keeping yourself fooled so that you don't regret you are avoiding the real work.

It's a smart trick you play on your mind.

But why are you waiting?

The most honest answer is fear. Fear of failure or fear of not knowing the outcome.

Because if you don't start, there's still hope. If you don't begin, you can't fail.

However, the opposite is true too.

If you don't start, nothing will change, and there's no real hope of anything to be better. If you don't begin, you're guaranteed to fail.

If you're sitting around waiting for the perfect moment to act, you are just robbing yourself of the chance to succeed.

This is a huge mistake. Don't let it ruin your future.

Now is the moment to change your life because starting now has lots of advantages.

You can achieve your goals sooner because the sooner you begin any journey, the sooner you reach your destination.

And Action leads to results. Action leads to inspiration. Inspiration leads to even more action. It multiplies and produces more results.

Take a deep breath and start today.

You'll never be 100% ready or comfortable, so you better begin right now and accept the challenge.😃

*Written by Shradha Sharma-Inc42*
The joys and perils of working remotely
Tags: remote, productivity, career
Published: 2019-09-11 09:42:38

For the past two years or so, I have been a part of a team spread across three timezones, representing at least eight different cultures. In one sense this sounds like a disaster already! However, we have made it work remarkably well and I feel like it has been a great success - though not without its challenges.

In this post, I want to talk through some of the successes and struggles, reflecting on what went well and what could have been done better, in the hopes that others will be able to celebrate the joys with me and learn from the perils in order to avoid facing them first-hand. So, without further ado, here we go!

## Joys
* Despite the distance, we really do gel as a team and have a real laugh - I have definitely made some life-long friends through the experience
* We work well together and are able to ship great software
* We learn a lot from each other, in terms of technology and in terms of culture, personality, etc
* Personally, I am often way more productive from home - without the distractions of an open plan office
* No commuting!

## Perils
* Communication is just _never_ as good when it's not face to face - instant chat and even video calling are great tools, but are only ever going to be "next-best-things" to good old fashioned talking to each other face to face
* Colleagues being "away" on chat when you are desperate for help is _really_ frustrating!
* Feeling disconnected from the office goings-on, whether it’s work things or the ‘watercooler’ chat!
* Not being able to get hold of _anyone_ - for example if they’re all in a location-based meeting and unavailable on chat...
* Things like VPN issues can be absolutely disastrous for productivity, especially when paired with the point above about not being able to get hold of people!

I totally understand and agree with the productivity gurus saying you should turn off _all_ notifications and "make your apps work for you" rather than the other way around. The downside is that it can, for your remote colleagues, make it very difficult to contact you and can actually leave them feeling disconnected and under appreciated.

Overall, I would still say that remote working _does_ work, but you and your team have to all _want_ it to work and commit to being available, building rapport beyond boring work interactions, and ultimately treating each other as humans and as equals.

There are loads of other pros and cons that I can’t think of right now - why not suggest your own in the comments if you have similar experiences!
★ Generating speaker cards using Tailwind and Laravel
Tags: laravel, php
Published: 2020-01-02 23:36:28

---
title: ★ Generating speaker cards using Tailwind and Laravel
published: true
date: 2019-09-11 09:15:00 UTC
tags: laravel, php
canonical_url: https://freek.dev/1448-generating-speaker-cards-using-tailwind-and-laravel
---

I'm currently organizing the [Full Stack Europe conference](https://fullstackeurope.com/). The first edition will be on 23 - 25 October in the beautiful city of Antwerp, Belgium. I believe that the best apps or sites aren't built by programmers. They're built by teams. That's why we designed this conference for everybody and don't stick to just one aspect of programming.

Like many other conferences, we'd like to give our speakers and workshop teachers a small image that they can share on Twitter or use in their slides. Such a card image should have the photo, name of the speaker and a few details of the conference.

I could have opened an image editor and handcraft 20+ of those images. But instead, I used my PHP and front end knowledge to generate those cards.

I created a Laravel app, installed [Tailwind](https://tailwindcss.com/), and got to work. First, I created [a view where all the speaker cards are displayed](https://github.com/fullstackeurope/cards-generator/blob/master/resources/views/cards.blade.php).

Each card on that page should be converted to an image. A while ago I made a package called [Browsershot](https://github.com/spatie/browsershot), that can convert any webpage to an URL. Under the hood, it uses headless Chrome to achieve that. Browsershot also has an option to render a specific dom node to an image.

This is the code used to generate image cards for each of the speakers.

```php
Browsershot::url('http://cards-generator.test/')
  ->select($elementId)
  ->deviceScaleFactor(2)
  ->windowSize(2000, 2000)
  ->save(storage_path("app/cards/{$slug}.jpg"));
```

In the Laravel app, I've put that piece of code in [a handy artisan command](https://github.com/fullstackeurope/cards-generator/blob/326a70f6b8361a13ba4b05cec8ca8d81c206d338/app/Console/Commands/GenerateCardsCommand.php).

Here are some of the cards that were generated:

![card](https://freek.dev/uploads/media/fseu-generator/card-1.jpg)

![card](https://freek.dev/uploads/media/fseu-generator/card-2.jpg)

![card](https://freek.dev/uploads/media/fseu-generator/card-3.jpg)

![card](https://freek.dev/uploads/media/fseu-generator/card-4.jpg)

Even though I mainly identify as a backend developer, my basic frontend skills did come in handy.

If you want to step a bit out of your comfort zone, and want to learn a bit about the parts of the stack you might be uncomfortable with, consider coming to our conference. You'll find all info on [fullstackeurope.com](https://fullstackeurope.com). I might be biased, but I really do think it's going to be an excellent event worth your time.
Pssst, wanna a little computer science?
Tags: career, computerscience
Published: 2019-09-11 07:48:36

A few days ago one of the candidates wasn't able to tell us the difference between stack and queue.

> You're asking questions that could be googled in five minutes, and I'm more into practice, let me do a test task

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

My answer was really polite and really strict: there are some things you should know off the top of your head.

If you don't want to be humiliated on tech interviews, there are two ways.

First and easy-peasy: switch back to the occupation you've come from into development.

Second and hard: DO SOME COMPUTER SCIENCE. Stop asking questions on StackOverflow and forums, stop reading medium, stop writing applications (you probably doing that wrong anyway). Just do THE FREACKING COMPUTER SCIENCE. 

Here is good guy Robert Sedgewick (see cover). [He will guide you through forests of algorithms and fields of data structures][1]. Did you ever play Dark Souls? This is worse. But if you have ever finished it - you should remember THAT feeling.

Or you can just drop it back to normal life without pain and software development. Up to you.

[1]: https://www.coursera.org/learn/algorithms-part1
WillCore.Requests: Auto Generating Fetch and XMLXHR Requests for Web API
Tags: csharp, javascript
Published: 2019-09-11 07:47:39

#.NET CORE 2.2 WebAPI and JavaScript

A developer usually tend to avoid repetitive work. In coding we have the DRY principle, and I like to apply that philosophy to the way I code. That is why I got frustrated typing out Fetch request after Fetch request trying to consume a .NET Core Web API service I wrote for a project of my own. Why can't I just reference a WSDL and add a service reference to my JS?

That is when I got the idea to write a library to build JS code from your controllers, parameters and results. The generated code should also have full JSDoc comments so you can have intellisense support in Visual Studio. 

I tried different routes, from T4 templates to building JavaScript via a node reference in C#. In the end I ended up with custom templates and a hierarchical C# class structure mimicking that of JavaScript.

I am planning to add the following to the library: 
1) C# code generator that will also automatically build a NuGet package with all the code to consume your API.
2) C# class and action level attributes that allows you to generate custom JSDoc description comments.
3) Functionality to auto generate a HTML page that will allow you to add predefined, calculated and static parameters and results for every controller action, so that you can test your API by simply open the page.

I think it turned out pretty good, but any feedback is welcome. 

Please note that the library is still in alpha state, but I have used it on a different projects and it seems quite stable. Is this something people would use?

GitHub: https://github.com/PhilipCoder/WillCoreRequests