teleren/devto huggingface dataset:
How to set the Webpack project root?
Tags: explainlikeimfive
Published: 2018-02-21 09:26:56

---
title: How to set the Webpack project root?
published: true
tags: explainlikeimfive
---

I've only recently started using WebPack. (with Typescript, which I've been using for a long time, and Preact since recently.)

I'm really happy with it so far - it's working great, both during development, and when building the production assets.

My question here is actually simple: how is a webpack project rooted? It doesn't seem to automatically root itself neither from the locations of the `package.json` or `webpack.config.json` files, and I can't find an option to root it.

I have a project with the following structure:

```
root/
  package.json
  styleguide/
    webpack.config.js
    styleguide.tsx
    tsconfig.json
```

I have other sub-projects besides `styleguide` in this project - that one happens to use `webpack`, others use e.g. `tsc` or `node-sass` etc., is why it's structured like this.

My webpack configuration looks like this:

```
const path = require("path");
const webpack = require("webpack");

module.exports = {
    entry: {
        "styleguide-deps": ["prismjs", "preact", "js-beautify"],
        "styleguide": "./styleguide.tsx"
    },

    output: {
        filename: "[name].js",
        path: path.join(__dirname, "/../assets/demo/"),
        libraryTarget: "amd"
    },

    plugins: [
        new webpack.optimize.CommonsChunkPlugin({
            name: "styleguide-deps",
            minChunks: Infinity,
        })
    ],

    // Enable sourcemaps for debugging webpack's output.
    devtool: "source-map",

    resolve: {
        // Add '.ts' and '.tsx' as resolvable extensions.
        extensions: [".ts", ".tsx", ".js", ".json"]
    },

    module: {
        rules: [
            // All files with a '.ts' or '.tsx' extension will be handled by 'awesome-typescript-loader'.
            { test: /\.tsx?$/, loader: "awesome-typescript-loader" },

            // All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'.
            { enforce: "pre", test: /\.js$/, loader: "source-map-loader" }
        ]
    },

    // Don't bundle these modules, but request them at runtime (client-side, via require.js)
    externals: {
        "kodus": "kodus"
    }
};

```

My `package.json` has a `scripts` entry like the following:

```
    "scripts": {
        "build-styleguide-ts": "cd styleguide && webpack",
    },

```

And the question I'm asking is, why do I have to `cd` into `styleguide` to run webpack?

I've tried e.g. `webpack --config styleguide/webpack.config.json` from the project root, and I can't get it to work.

I can use absolute paths in most places, but not for `entry.styleguide`, and it seems `./` works relative to the current directory, rather than to the project root.

My objection is that no script should ever rely on the current directory, as that's just global state, and I generally use absolute paths everywhere, but that hasn't worked for me with webpack.

How can I remove the dependency on the current directory?
Can I publish a post here that I have published in other platform i.e. Medium?
Tags: discuss
Published: 2018-02-21 06:13:21

---
title: Can I publish a post here that I have published in other platform i.e. Medium?
published: true
tags: discuss
---

I am new here and want to share interesting things I know and help others, I have some posts on Medium and I don't know if it is allowed to publish same content here, thanks!
Generates LICENSE file: git-license
Tags: git, go, github, commandline
Published: 2018-02-21 05:19:09

---
title: "Generates LICENSE file: git-license"
published: true
tags: git,golang,github,command-line
canonical_url: https://blog.web-apps.tech/generate_license_with_gitlicense/
---
_this post originally appears on [blog.web-apps.tech](https://blog.web-apps.tech/)_

 ![Generates LICENSE file: git-license](https://blog.web-apps.tech/content/images/2018/02/git-logo.png)

When we create a new repository on [GitHub](https://github.com), we can choose an open source license.

![Generates LICENSE file: git-license](https://blog.web-apps.tech/content/images/2018/02/create_new_repo.png)

We choose an OSS license, then, `LICENSE` file is put into the new repository.

Now, I'm usually using [`hub`](https://hub.github.com/) command to create a new repository.  
I'll do below to create:

```
$ mkdir my_new_repository
$ cd my_new_repository
$ git init
#
# ... some code writing and commit ...
#
$ git create # git command is aliased to hub
$ git push -u origin master
```

In this flow, I can write description for repository<sup><a href="#fn1" id="fnref1">[1]</a></sup>, set homepage<sup><a href="#fn2" id="fnref2">[2]</a></sup>, make the repository private<sup><a href="#fn3" id="fnref3">[3]</a></sup>, but I **CANNOT** choose LICENSE.  
I can choose and create LICENSE file on the GitHub web page, or I can copy from my other repositories because its content is fixed.  
However, I don't do that.

Thus I created [`git-license`](https://github.com/nasa9084/git-license), which is subcommand for git.  
As you know, when you put `git-XXX` executable into your PATH, you can use `git-XXX` command as subcommand of git like `git XXX`.

`git-license` is written in Go.  
So its executable is only one binary, and it means very easy to start using.  
If you have already had Go environment, you can install with:

```
$ go get github.com/nasa9084/go-license
```

If not, you can download binary for your os from [Releases page](https://github.com/nasa9084/git-license/releases).

The command creates LICENSE file you choose using [GitHub Licenses API](https://developer.github.com/v3/licenses/), so network connection is required.

If there's some bugs, comment, or enhancement, please feel free to make issues or make Pull Request.

* * *
<section>
<ol>
<li id="fn1">
<p>with <code>-d</code> option <a href="#fnref1">↩︎</a></p>
</li>
<li id="fn2">
<p>with <code>-h</code> option <a href="#fnref2">↩︎</a></p>
</li>
<li id="fn3">
<p>with <code>-p</code> option <a href="#fnref3">↩︎</a></p>
</li>
</ol>
</section>
🔥 Rad Resources 💯
Tags: resources, design, development
Published: 2018-02-21 02:49:53

---
title: 🔥 Rad Resources 💯
published: true
description: Neato resources for your next project.
cover_image: https://thepracticaldev.s3.amazonaws.com/i/eyoe3ngv0vdpkihldkh5.png
tags: resources, design, development
---

Hey there! I sure love me some neat web tools/resources. There always seem to be new ones released every week. I decided to list some of my favorite randome resources below for DEV/DES/ETC.

## **Presentation-Related**

- [Carbon](https://carbon.now.sh)

## **Fonts**

- [Arch](https://archetypeapp.com/#)[e]()[type](https://archetypeapp.com/#)

## **Colors**

- [Coolors](https://coolors.co/)
- [Grabient](https://www.grabient.com/)
- [Gradiblock](https://gradiblock.com/)

## **Shadows**

- [Box-Shadows Generator](https://www.cssmatic.com/box-shadow)
- [Text shadows](https://css3gen.com/text-shadow/)
- [Material Shadows](https://codepen.io/sdthornton/pen/wBZdXq)

## **Illustrations**

- [Undraw Illustrations](https://undraw.co/illustrations)

## **SVG**

- [Triangle pattern generator](http://qrohlf.com/trianglify/)
- [SVG-REPO](https://www.svgrepo.com/)
- [SVG Icons](http://www.heroicons.com/)
- [Compressor](https://jakearchibald.github.io/svgomg/)
- [Hero Patterns](http://www.heropatterns.com/)
- [SVG Backgrounds](https://www.svgbackgrounds.com/)

## **Placeholders**

- [Placeholder.it](http://via.placeholder.com/350x150)
- [Fillmurray](http://www.fillmurray.com/)
- [Picsum](https://picsum.photos/)

## **Reference**

- [Array Explorer](https://sdras.github.io/array-explorer/) by Sarah Drasner
- [Array Manipulation Copy/Paste](https://surma.github.io/underdash/) by Surma

## **Utility**

- [https://hreftools.com/](https://hreftools.com/)

## **Meta**

- [MetaTag Generator](https://megatags.co/#generate-tags)
- [Hey Meta](http://www.heymeta.com/url/www.modayil.me)

## **Utility CSS Libraries**

- [TailwindCSS](https://tailwindcss.com/)
- [Tachyons](http://tachyons.io/#principles)

## **Inspiration**

- [Gangbase](https://gangbase.design/)
- [Creative Portfolios](http://www.creative-portfolios.com/)
- [More portfolios](http://bestfolios.com/)
- Nice [copywriting](http://heynishi.com/)

Do you have any rad resources you'd like to share? Rad resources only, please 🙏.
Be a Learner
Tags: discuss, career, beginners
Published: 2018-02-21 01:56:54

---
title: Be a Learner
published: true
description: 
tags: 
- discuss
- career
- beginners
---

![](https://i.imgur.com/Ug7AkZ6.png)

> The central task of education is to implant a will and a facility for learning; it should produce not learned but learning people. The truly human society is a learning society, where grandparents, parents, and children are students together.
>
> In a time of drastic change it is the learners who inherit the future. The learned usually find themselves equipped to live in a world that no longer exists.
>
> —Eric Hoffer

In our pursuits we should aim to be a learner, not learned.
Why I take MCP exams.
Tags: mcp, exam
Published: 2018-02-21 01:44:30

---
title: Why I take MCP exams.
published: true
description: In this article, I explain why I take MCP exam.
tags: mcp,exam
cover_image: https://thepracticaldev.s3.amazonaws.com/i/007wocqyc2ucvzilui6t.png
---

I love certification not only Microsoft ones but others as well. But my friends often ask me why I take exam because most of them think certifications are useless. Well, I can understand why they feel in that way, but this is how I use exam to learn more.

# As a learning catalog
I don't know everything, of course, thus what I do search or learn are limited to what I know or what I am interested in right now. To broaden my skill and knowledge, I need someone or something tells me which technologies or products are available to learn. That's why I go to [MCP exam list](https://www.microsoft.com/en-us/learning/exam-list.aspx) to see which exams are available, that gives me options to learn new things.

# As a learning guideline
When I decide which service or product to learn, then I need someone tells me where to start. 

- Most exam gives me **skill measured** section, where I can see terminologies or knowledge I should know.  
- I can follow the section to learn the service or products one by one.

# As a real scenario
After I completed my learning, and hands-on, I yet need real experience and need to know the scenario. 

- Each exam gives us around 30-100 questions
- Some exam gives case study base which is great way to test the knowledge

I know that some people say exam questions don't make sense. However, exam quality is actually getting better and better. You can also give feedback if you will.

# IT pro exams?
I am a developer, yet I take IT Pro exams. Why? 

- Because I can learn the things from the other direction. For example, I can learn design pattern of the service or product by knowing what features the product has.
- I can see what challenge IT pro guys have so that I can work better with them. And now DevOps time, so I need to know IT pro things anyway :)

Okay, that's it. Because I learn new things to improve myself, I never study to pass the exam, thus I often fail. Which is actually good as I have another chance to learn deeper :)

## Resources
Followings are resources I usually use.
[Microsoft Virtual Academy (Free)](https://mva.microsoft.com/)
[Channel 9 (Free)](https://channel9.msdn.com/)
[Pluralsight (Not Free)](http://pluralsight.com)

Hope you share how you learn new things as well!

Ken
Mr. & Mrs. Developer
Tags: discuss, pair, programmig, couple
Published: 2018-02-21 00:26:06

---
title: Mr. & Mrs. Developer
published: true
tags: discuss #pair #programmig #couple
---

Is there's any Mr. & Mrs. Developers on dev.to? (i.e) Couples who are developers.

I would love to hear about sharing knowledge, discussions, mutual helps, etc.,

Thanks.
Do we care more about what we've done or how we did it? 
Tags: career, productivity, technology, culture
Published: 2018-02-20 21:58:31

---
title: Do we care more about what we've done or how we did it? 
published: true
description: An annoying trend in the software industry is to talk more about how something was accomplished rather than what was accomplished.
tags: career, productivity, technology, culture
---

## My crawling skin
I just ran screaming from my LinkedIN feed. As you can imagine, most of my LinkedIN connections are fellow software industry veterans. Many of them are now managers, while I've chosen to stay in the technical track.

What made me run away?

Well, it was a familiar trope that I've just hit my limit on. You might say it was the straw that broke the camel's back. 

I saw yet another post urging me to come build something exciting with Go, Kubernetes, and React.

## Technology brand-name vomit

Developers and ex-developers have a bad habit of focusing on their work and not the result of their work. I see way too much preoccupation with algorithms and names of technologies, and not much concern over what's actually accomplished by their use. Did we help someone? Did we make someone's day better? Did we at least make something that sucked suck a little less?

No! But we used Kubernetes, Docker, Go, React.js, Webpack, Swagger, and who knows what other shiny logo-plastered over-hyped library, framework, or tool.

What do you expect me to say?

"Ooooohhhhhh!!!?"

"Aaaaaahhhhh!?"

No! Go do some real work!


## Turn it off

Sorry that this is turning into a rant, but I'm tired of posts from developers on LinkedIN, Reddit, and other social media networks ejaculating about the latest container technology they deployed in on the latest public cloud platform they contracted with using the latest top-trending language and framework package that everyone's tripping over their feet to tell us about.

It reminds me a bit much of the shallowness I thought I was escaping by becoming a software engineer. I mean, I already know where to go (my local gym) if I want to hear a bunch of body measuring. "Oh wow, look at that . . . I've got these rock hard abs here, thanks to my Whey Shake 2000 and the Bowman-self-musculator."

It all feels like the shallow Californian to me. Like something from the Blink 182 song, "Mutt:" 

> He pauses shaving and he tells himself that he is the bomb
> She has her curlers set, her credit cards are paying the funds
> ... And it is way too unhealthy 
> Often they've typically been starved for attention before

Does this attitude really have any place in software? 

I don't think so.

## Do we care more about what we've done or how we did it? 

So can we just change the conversation? What if I tell you I don't care if you use Cobol or PHP, Maven or Gradle, Rails or Spring or Boost or even straight-up assembly language? Next time you want to describe what you do, tell me what difference it makes for someone besides yourself. 

Deal?
Quick Start with Redux and Redux-Saga using Redux-Box
Tags: javascript, react, reactnative, redux
Published: 2018-02-20 21:09:26

---
title: Quick Start with Redux and Redux-Saga using Redux-Box
published: true
description: Using redux-box in your react, react-native applications to quickly set up redux and redux-saga in modular fashion
tags: javascript, react, react-native, redux
---

{% youtube z3cp6xs2HmE %}

It's a quick tutorial for all the visual learners, showing how you can use redux and redux-saga in your react / react-native applications to manage the store in a modular and expressive fashion.

##What's Redux-Box:
Setting up and organizing a redux store in your react/react-native projects can be a tedious and daunting task. Redux-Box aims at extracting the complexity in setting up redux with redux-saga, without losing the flexibility or without introducing new bizarre terms.

---

For more info, here's the Github repo: 
https://github.com/anish000kumar/redux-box
How do you handle client timeouts?
Tags: discuss, api, node
Published: 2018-02-20 19:24:24

---
title: How do you handle client timeouts?
published: true
tags: discuss, API, node
---

You have an endpoint which does some valuable computations, and it's supposed to answer within say 3000 ms. Therefore, the client has 3000 ms as the timeout setting for the request. For whatever reason, some % of requests started to take 6000ms. What happens now is that execution continues after the client disconnects. The result is then just discarded.

The question is: how do you deal with it (if at all) using your current technology? Do you abort the computations and how do you do it?
How Handwriting converted into font?
Tags: fontcreation, python
Published: 2018-02-20 19:01:54

---
title: How Handwriting converted into font?
published: true
description: Hi all..For our project we decided to make an android application which will convert our handwriting style to a font family(.ttf).We can read the handwrite through mobile touch screen and other one is by scanning a sheet of paper which contain all the alphabets,numbers, special characters which we written in our handwriting style...but now it's looks like very tough to implement.I have no idea about creating the font file.Any help? Please.. 
tags: font creation,python
---
Customize Database Queries in AdonisJS
Tags: node, tutorial, javascript, mysql
Published: 2018-02-20 18:21:25

---
title: Customize Database Queries in AdonisJS
published: true
description: Customize Lucid database queries based on user input or other logic to make your API routes more reusable.
tags: node, tutorial, javascript, mysql
cover_image: https://thepracticaldev.s3.amazonaws.com/i/mb1n8cafmrwvlmam22s2.png
---

> Subscribe to my YouTube channel for [more tutorials on working with VueJS and AdonisJS -- an MVC framework for NodeJS](https://www.youtube.com/channel/UCF5w1QdWroWOoxxXMgp88AQ?sub_confirmation=1)!

In this video I show you how to customize Lucid database queries based on user input or other logic to make your API routes more reusable. 

This information will help you a lot if you want to create filterable / searchable lists of data.


{% youtube lzhHjE6Ry3c %}


## Links:

[Github Repo](https://github.com/patrickodacre/simple-api-adonis-js/tree/lucid_custom_queries)

**Related YouTube Videos**

[Use Lucid ORM to Query Related Data from a MySQL Database](https://www.youtube.com/watch?v=_zUF_mhubL0)

[Apply Constraints to Lucid Relationships in AdonisJS](https://www.youtube.com/watch?v=eOOdseihjSI)
Technical debt kills your company
Tags: technical, debt, software, startup
Published: 2018-02-20 18:17:23

---
title: Technical debt kills your company
published: true
cover_image: https://i2.wp.com/alediaferia.com/wp-content/uploads/2018/02/nexus-y-la-deuda-tecnica-55-638.jpg?w=638&ssl=1
canonical_url: "https://alediaferia.com/2018/02/14/technical-debt-kills-your-company/"
description: "Frequent and unplanned changes are vital in the early stages of a startup. Being conscious of the technical compromises you're making will help your engineering organization grow healthier and able to manage technical debt."
tags: technical,debt,software,startup
---

[Technical debt kills your company](https://alediaferia.com/2018/02/14/technical-debt-kills-your-company/)

My 2 cents on technical debt as a summarization of what I've seen over the years in my working experiences.
Hardcoded.
Tags: culture, productivity
Published: 2018-02-20 18:14:31

---
title: Hardcoded.
published: true
description: I've hardcoded scripts that send me a summary of the previous day's activity with a positive twist. I'm done screwing around.
tags: culture, productivity
canonical_url: https://listed.standardnotes.org/@mo/944/hardcoded
---

There is one recurring aspect of my life that always shackles me. My dependence on external activity. Notifications.

Notifications of themselves carry no meaning and have no inherent value. I had been in one very particular setting so uncontrollably enamored by the interfacial beauty of a notification, that I glorified and fell weak at all the powers it had on me. Is it the font color? The way it says that word? No, it’s the dopameaning we’ve ascribed to that particular shape on a screen.

I don’t have to go into detail about which nature of notifications have me personally enslaved. It’s arbitrary. But we all know the sort. Some days, I live wholly notification-to-notification. I smoke them more habitually than a stone-hooked three-pack-a-day smoker. In between, it’s that scratching anxiety. When will I have the next one? How about.._now!_

Of course, it’s all glory and self-ejaculation until you flip your phone and…nothing. A sour punch in the face. _Really?_

Any reasonable person observing this behavior in themselves would immediately be appalled at its inelegance and correct it at once. But, I never notice it. I never notice it’s happening, until precisely all the damage has been done. Knocked out, misshapen, and heavily inclined to the ground, I start to figure something must be wrong. 

And it’s painfully glaring once you notice it.

Earlier today, I took steps to cull the notifications that make it to the fore of my attention. I don’t need to know everything the _second_ it happens. It can wait. I’ve replaced my real-time reports of business activity with daily reports that email me once in the morning everything I need to know. I figure this way, you can only be insulted once.

I’ve even hardcoded positive messages like “you had #{num_signups} yesterday, which is fantastic” and “your recurring revenue total is #{total}, which is excellent, and means you can continue doing this for a long time to come.” I've even made a weekly report with a postscript that reminds me something I so easily forget: "Keep doing what you're doing. This is it. You're already here. Just do the best work you can, every day."

I figure, if we’re so gullible as to be furiously enthralled with a bubble on a screen, might as well spin the story and craft a nice little narrative around it. My petty brain will fall for shit like that any day of the week.
[JS] Calculate phonetic similarity of two strings, any ideas?
Tags: help, javascript
Published: 2018-02-20 17:23:14

---
title: "[JS] Calculate phonetic similarity of two strings, any ideas?"
published: true
tags: help, JavaScript 
---

I am working on a natural language processing engine. It uses the Google Speech API to transcribe short recorded spoken audio and then the interpreter tries to make sense of it.

I now want to calculate the phonetic similarity between two strings, preferably in javascript. Not compare two audio files because the words or phrases are from different speakers. 

For the sake of example _beef_ and _leaf_ sound 87% the same. The words _deaf_ and _cave_ something like 29%. (made up percentages)

A value between 0 and 1 is obviously fine too. Same difference.

Any ideas? Is this impossible?