teleren/devto huggingface dataset:
TIL: How to create your custom Node.js REPL
Tags: node
Published: 2019-08-26 18:21:40

---
title: TIL: How to create your custom Node.js REPL
published: true
tags: node
canonical_url: https://www.stefanjudis.com/today-i-learned/how-to-create-your-own-node-js-repl/
---

Today I came across [a quick video](https://www.youtube.com/watch?v=rBnmkgfEUSA) which explains functionality about Node.js and its REPL ([Read-Eval-Print loop](https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop)).

While I use the built-in REPL from time to time (type `node` into your terminal to start it) I haven't used the [REPL module](https://nodejs.org/api/repl.html) before. It turns out that you can create your custom REPL with just a few lines of JavaScript:

```javascript
// index.js
const repl = require('repl');

const state = {
  printSomething() {
    console.log("That's awesome!");
  }
};

const myRepl = repl.start("stefan's repl > ");

Object.assign(myRepl.context, state);
```

If you're like me and like to prototype in a console, this can become very handy. You could create an entry script for your application that provides all the initialized objects and functionality. 

![Screenshot of a terminal: start a new REPL by running "node index.js" and see the available command 'printSomething'](//images.ctfassets.net/f20lfrunubsq/3ThVsUOwFhhzxQCaRV8lm8/28ac1d8fc83a4010be01ae28f0529a8e/repl.jpg)

By providing your own REPL that includes all the needed state you can "just REPL away" without starting a debugger and attaching breakpoints. 🎉
Defining Idempotent
Tags: general
Published: 2019-08-29 16:17:50

---
title: Defining Idempotent
published: true
tags: general
canonical_url: https://stephencharlesweiss.com//2019-08-26/idempotent/
---

Idempotent is a word that gets thrown out a lot within computing but that I continually forget what it means.From Wordnik, the definition: <sup>1</sup>

> _n._ In _multiple algebra_, a quantity which multiplied into itself gives itself. Ordinary unity is _idempotent._  
> _adj._ ( [computing](https://www.wordnik.com/words/computing) ) Describing an action which, when performed multiple times, has no further effect on its subject after the first time it is performed.  
> _adj._ Said of an element of an [algebraic structure](https://www.wordnik.com/words/algebraic%20structure) (such as a [group](https://www.wordnik.com/words/group) or [semigroup](https://www.wordnik.com/words/semigroup) ) with a [binary operation](https://www.wordnik.com/words/binary%20operation) : that when the element operates on itself, the result is equal to itself.

So, a subject is considered idempotent if performing an action multiple times has no effect after the first time.

Examples helped solidify my understanding <sup>2</sup>:

> In mathematics, an idempotent operation is one where _f(f(x)) = f(x)_. For example, the `abs()` function is idempotent because `abs(abs(x)) = abs(x)` for all `x`.

Similarly deletion operations are idempotent because you can’t delete an item multiple times. For example:

```
target.delete(value)
target.delete(value)
```

The second delete call will not have any effect on the target since the value it’s trying to delete is not present to be acted upon.

# <svg aria-hidden="true" focusable="false" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg>Footnotes

- <sup>1</sup> [Idempotent | Wordnik](https://www.wordnik.com/words/idempotent)
- <sup>2</sup> [What is an idempotent operation? - Stack Overflow](https://stackoverflow.com/a/1077421/9888057)
- [Idempotence | Wikipedia](https://en.wikipedia.org/wiki/Idempotence)
Kartitude racing game. Who will beat my lap record of 17.88?
Tags: gamedev, unity3d, gamejam, karting
Published: 2019-08-25 23:52:58

Hello everyone I made a karting game for the unity game jam starting august 27th 2019 here it is https://connect.unity.com/p/kartitude give it a try and share

#karting #unity #game #gamer
LeetCode "Longest Common Prefix"
Tags: leetcode, python
Published: 2019-08-25 23:49:03

---
title: LeetCode "Longest Common Prefix"
published: true
description: Solution of LeetCode "Longest Common Prefix"
tags: ["leetcode", "python"]
---

Oh😮 I didn't know that question number is not fixed😧

[Longest Common Prefix](https://leetcode.com/problems/longest-common-prefix/)

```python
class Solution:
    def longestCommonPrefix(self, strs: List[str]) -> str:
        if len(strs) == 0:
            return ''
        
        # check what is needed length
        min_len = len(strs[0])
        other_strs = strs[1:]
        for s in other_strs:
            len_s = len(s)
            if min_len > len_s:
                min_len = len_s
        
        # check prefix
        c = ''
        prefix = ''
        for i in range(min_len):
            c = strs[0][i]
            for s in other_strs:
                if c != s[i]:
                    c = ''
                    
            # not longer a prefix
            if not c:
                break
                
            prefix += c
                
        return prefix
```
What Should I Make Next? Quick Project Ideas
Tags: beginners, webdev, projects, ideas
Published: 2019-08-25 23:16:36

---
title: What Should I Make Next? Quick Project Ideas
published: true
description: 
tags: beginners, webdev, projects, ideas
---

Ever since I finished up at the Flatiron School at the end of May, I've been trying to come up with a cool, new project idea. But here I am, almost three months later and I haven't started one. I've been stuck in decision paralysis and it's time to break free!

I've heard from a lot of people to just start something, especially when you're a junior dev. Instead of trying to reinvent the wheel, make a simple site that has some functionality. The point is to get practice and learn a new thing or two.

So for my blog post this week, I'm just going to make a big list of project ideas! No longer can I complain that I don't have an idea!

* todo app (just kidding!)
* clone of a popular social media site
* site that gathers and displays news about a specific topic
* site to order food from a local restaurant, with a shopping cart
* clock that you can change from analog to digital
* simple chat room
* bill splitting app like [Splitwise](https://www.splitwise.com/)
* site that changes colors based on the weather
* funny name generator
* site to save and display articles you want to read later
* date suggestions
* bio site about someone famous that you like
* copy a simple game, like tic-tac-toe, hangman, or snake
* chatbot
* counter to log how many glasses of water you've drunk
* site for cute pictures of your pet
* simple quiz game
* place to keep track of all the shoes you want to buy
* web scraper
* net worth tracker
* calculator
* music suggestions based on a given song/artist
* site that simply tells you if it's going to rain or not
* spoiler alert browser extension - notifies you if the page contains certain keywords
* e-commerce clone
* a site that just plays Mariah Carey music videos
* word-a-day site
* recipe generator

There we have it, no more excuses! I hope this inspires you to start something new today!
Clippy revival
Tags: showdev, electron
Published: 2019-08-25 23:12:07

---
title: Clippy revival
published: true
description: Clippy, now anywhere
tags: #showdev, #electron
---

For many people Office's Clippy was the first virtual assistant before chatbots where everywhere around. Many people still miss it and it's random tips.

[Clippy.js](https://www.smore.com/clippy-js) is one of the projects that aimed to revive Clippy "to any website for instant nostalgia".

Based on this JS library and using Electron, the javascript framework that everyone loves to hate, I created the [Desktop Clippy](https://github.com/CGReinhold/desktopclippy), a Clippy adaptation that will give you a random quote every 10 minutes.

![Desktop Clippy](https://thepracticaldev.s3.amazonaws.com/i/8oc10jkt5me6640i5nj7.gif)

I'm sure that is not the best idea for an Electron application, but suits well for a fun weekend project and to try out different technologies.
Are utils (folder where you put random stuff you don’t know where to put otherwise) a code smell?
Tags: discuss, healthydebate
Published: 2019-08-25 22:27:40

---
title: Are utils (folder where you put random stuff you don’t know where to put otherwise) a code smell?
published: true
tags: discuss, healthydebate
---

Personally, I love them. The way I think about is every function in that folder is npm package (or other package manager module) which was just never published. 

Inspired by this article https://neilkakkar.com/things-I-learnt-from-a-senior-dev.html
Why I Won't Hire You - 5 Honest Tips to a Better CV
Tags: career, cv, resume, coverletter
Published: 2019-08-25 22:10:06

---
title: Why I Won't Hire You - 5 Honest Tips to a Better CV
published: true
description: 5 tips on avoiding common problems when writing a resume. Based on personal recruiting experience.
tags: career, cv, resume, cover letter
cover_image: http://bit.ly/2Zh3DsU
---

Recently, I had the immense pleasure to go through several hundreds of CVs. I threw 95% of them to trash. Are you wondering how to get in the lucky 5%? Read on and follow the simple tips:


# 1. Keep it short
Your resume should fit on one page; two pages at maximum. If it's longer, it's not a sign of your overqualification but rather of the lack of communication skills.

# 2. Leave out irrelevant and obvious experience
Spare your future employer the details about your part-time jobs at school, unless, of course, it's the only experience you have. It really doesn't help if you tell me how delicious burgers you were preparing at McDonald's or how many graves you dug (true story btw).
If you really feel the urge to share such things somewhere, do it on LinkedIn.

If you are applying for a job in IT and include Word or Excel in your resume, congratulations, you've just ruled out yourself… Unless you are an Excel guru who can craft a multi-sheet tax calculation form. 

Are you tempted to add "10 years experience in XML"? Perish the thought!

![Grave Digging](https://thepracticaldev.s3.amazonaws.com/i/ci99e23o1sk5lrvi2shl.jpg)

# 3. Don't try to fool the recipient
Do not try to name every technology you've ever come across…list things that you specialize in. I've seen elaborate tables and charts indicating how many years and months of experience a candidate has in each programming language.

Frankly, the numbers don't tell me much. I need to see you think and code. 

Write honestly what kind of projects you've worked on, what was your contribution and please, be brief.

## The fewer graphics, the better
Using pie charts, progress bars, or other sophisticated visuals to indicate the level of your skills is a big NO-NO. With the exception of people applying for a graphic designer or BI analyst jobs. Remember, it's a resume - not an infographic.

![Intelligence -10](https://thepracticaldev.s3.amazonaws.com/i/tv3d72canjkt9b2mpet5.png)

# 4. Make it personal
Do not broadcast your CV. By broadcasting a CV you are basically saying "I don't care where I will work. I don't want to excel in anything, I just want your money for whatever I'll be doing."

It shows a lack of motivation and disrespect to people reading your CV. You are wasting everybody's time.

Do proper research and craft a resume to fit the few carefully chosen potential employers.

# 5. Attach a cover letter when it makes sense
Are you moving to a different tech stack? Are you changing roles or field of expertise completely? Attach a cover letter and explain your motivation.

---
It's that simple. The less information you include and the fewer companies you address, the higher is the chance of you getting hired! Isn't that great? :D
Job interview and helping in a conference organisation
Tags: networking, techtalks, career
Published: 2019-08-25 21:34:36

You did a job a interview for a software developer position and some questions were like:
- Do you have a blog?
- Are you a contributor of any open source project?
- Do you have a pet project?
- What’s your twitter account? who do you follow on twitter?

You might agree or disagree if this is a good way to select a software developer or not and probably you’d have answered no to at least one or to all these questions, what it is pretty normal for many IT professionals. How many of your colleagues would say yes to all these questions? 


All these question are about how you get involved in the software community in general, so why not be part of your local community?  

I'm a software developer just like you and I found very nice way to improve my career and myself helping in the organisation of JBCNConf (www.jbcnconf.com).

Although this is not the same as having a tech blog or being a committer in a open source project, it helped me to “open some doors” in my career. In every interview with a recruiter or with a tech lead this was seen as a plus. Of course this isn’t a free pass to a new job, but I never got reject by a recruiter, but helping in a conference organisation is not only to show off to recruiters that you're engaged in a community. It's about networking and soft skills as well. I can give you 4 examples to follow:

1. Engage with others communities to promote the conference help with communication skills (networking)
2. Analyse papers from speakers help to guide what is the most important and relevant for the community (tech skill)
3. Organising speakers' accommodation and expenses help to get one out of the comfort zone doing administrative tasks (soft skill)
4. And I don’t even need to mention all the advantages you get of being in a conference ;-)

I hope this has helped you to discover one more way to engage in the software community and improve your chances in the interviews for the next time.

Photo by Edwin Andrade on Unsplash
Three Ideas for Scoping Work Safely
Tags: scoping, softskills, beginners
Published: 2019-08-25 21:06:59

We've all been asked at some point by a team member or our manager, "Hey how long is this work going to take, can you give an estimate on it?". 

Scoping is hard and not always as intuitive as one might think. Below are some ideas for scoping in a safe and practical way. 

#### Fully understand the work AND the impact it could have. ####

When scoping, it's important to consider applications outside of the ones being modified. If you're updating the contract of a return payload for a service, does that break other services using it? Is there a data store needing to be modified to support this new value as well? Adding something to the contract might not seem so easy now.

Ask as many questions as you can up front to get a clear picture. Dig into the code, does it seem clean enough to get in there and make the change easily? Make sure you understand the ins and outs of the system being modified before putting a number on it. 

#### Don't be Optimistic ####

I think Fred Brooks summed it up best in his book, [The Mythical Man Month](https://en.wikipedia.org/wiki/The_Mythical_Man-Month), *All programmers are optimists. Perhaps this modern sorcery especially attracts those who believe in happy endings and fairy god-mothers.*

Optimism can be dangerous, we might start out thinking that the work in front of us is a piece of cake, only to be humbled later by **unforeseen consequences**.

![Just making the change](https://media.giphy.com/media/eT6uDmyuWtlpC/giphy.gif) 

It's important to understand how to strike a balance between optimism and realism. As a rule, some amount of padding should be built into the scope. It's difficult to pin down how much extra will be needed needed, but depending on the complexity of the change I like to double whatever I initially came up with and then shave off some amount of time appropriate to the change. 

It's better to over scope and delivery early than to under scope and deliver late. 


#### Consider Process ####

Take for example, enterprise development. Things can be siloed and segmented to a point where even talking to someone on another team might require a meeting (I sincerely hope it's not like that for you, dear reader). 

![When you find out you need several meeting to talk to team members](https://media.giphy.com/media/n4aziifHh5BrSCMZwz/giphy.gif)

If the change is reliant on a modification to a data store, do you have to have someone make that change on your behalf? What does their schedule look like for being able to get that work done? 

Time can get chipped away in places you might not expect. So it's worth considering if you know there's going to be some process to follow ahead of you.

---

In the end, scoping, no matter how you slice it, can be tricky. There's almost never a magic number and it's probably never going to be pinpoint accurate. But we can scope safely and save ourselves some headache by thinking around the problem and being pragmatic in our estimate.
Figma Plugin API discovery - Part 1
Tags: figma, plugin, api, tutorial
Published: 2019-08-25 20:49:51

---
title: Figma Plugin API discovery - Part 1
published: true
description: Object Selection
tags: Figma, plugin, api, tutorial
---

Figma announced the availability of a new Plugin API.

Here's my notes for [figma](https://www.figma.com) Plugin API discovery - Part 1 (you can try even without Figma account) :

[▶ Figma Plugin API Discovery@Go/Grafcet.Online](https://www.figma.com/proto/yHQ7r7LDf4LGzqHb6DoZKO/Figma-Plugin-API-Discovery%40Go%2FGrafcet.Online?node-id=1%3A30&scaling=min-zoom)

![Grafcet.Online](https://i.imgur.com/sSFqeCj.png)

[Figma Plugin API discovery - Part 2 - DEV Community 👩‍💻👨‍💻](https://dev.to/lepinekong/figma-plugin-api-discovery-part-2-82j)
Auto Deployments With Gatsby + Now + GitHub
Tags: gatsby, github, now
Published: 2019-08-25 20:04:45

My blog site is spinning on the Gatsby framework, and with each new post, I was deploying the latest build to Zeit Now platform. It got tiresome to do the same procedures: change, build, deploy, alias my domain to the new deployment address. Time to automate the processes. The end goal is to send a new post in  '.md' file to GitHub, grab a beer and let the machine do the rest.

By the way, if you are no familiar with Zeit, their Now deployment platform is incredible, I like it very much. It is easy to start using it, documentation is well written, and it's free up to 100GB bandwidth. Also, they support domain aliasing; if you own a domain, add Zeit Now DNS address to your domain settings and hook your deployment address with your domain. And did I mention that it's free?

I will assume that by now you will have a Zeit account and Now CLI installed in your terminal.

### Connect Now With GitHub
To connect Now with GitHub, head to the Zeit account settings and install Now app into GitHub.

![Install Now app into GitHub](https://thepracticaldev.s3.amazonaws.com/i/0a4nkj2vqnsiu61i17ro.png)

### Define Build Script

For deployment to Now, a script must be defined in the `package.json`:

```json
{
  "scripts": {
    "build": "gatsby build",
    "now-build": "npm run build"
  }
}
```

And to build and deploy the project, it must contain `now.json` settings file with the instructions on how and where to build it:
```json
{
  "builds": [{
      "src": "package.json",
      "use": "@now/static-build",
      "config": { "distDir": "public" }
    }]
}
```

### Add auto domain alias (optional)
One of the cool features for the Zeit Now is custom domain name aliasing to the builds. You can set it up in a couple of different ways:
- In the `now.json` add the following:
```json
{
  "alias": "spukas.lt"
}
```
After the build, Now will assign your custom domain to the build

- In the Zeit Dashboard, select the project and select Domain tab (note, that at least one build of the project must be in the dashboard). In the Domain dashboard, you will be presented with the option to add your custom domains:

![Zeit Now Domain dashboard](https://thepracticaldev.s3.amazonaws.com/i/0a4nkj2vqnsiu61i17ro.png)

### Enjoy your builds

That's it. Now make changes in your project, commit and push them. GitHub will build a project, Now will deploy it into their platform and set an alias for your custom domains.
Life's great again.
This space available for rent
Tags: discuss, healthydebate
Published: 2019-08-25 20:39:23

---
title: This space available for rent
published: true
description: Turning open source into ad- or nag-ware for developers. What's your take on this.
tags: discuss, healthydebate 
cover_image: https://thepracticaldev.s3.amazonaws.com/i/fnjzej8ms58edcptul4z.jpg
---

Last week the maintainer of a JavaScript package [decided to monetize installation](https://github.com/standard/standard/issues/1381) of its package through NPM by showing ads after the install.

The response to this was surprisingly quite mixed. I did not expect so many people supporting this idea. Most of the supporters justified this as a valid means to earn money of maintaining the open source project.

The above incident was not the first case. A few months ago an other developer decided to [beg for a job in a similar way](https://github.com/zloirock/core-js/issues/548). And [there](https://github.com/cssinjs/jss/issues/881) [are](https://github.com/remy/nodemon/issues/1189) [some](https://github.com/styled-components/styled-components/issues/1590) [more](https://github.com/pouchdb/pouchdb/issues/7392).

I was rather supersized that NPM allows arbitrary code execution during package installation. Seems like a major security issue, which can clearly also be abused in other ways.

So what is your take on this? Is your console output available for others to rent out?
Have you tried ML.NET?
Tags: machinelearning, dotnet, webdev, csharp
Published: 2019-08-25 20:37:04

[ML.NET](https://dotnet.microsoft.com/apps/machinelearning-ai/ml-dotnet?WT.mc_id=devto-blog-shboyer) is an open source and cross-platform machine learning framework made for .NET developers.

* [ML.NET on dot.net](https://dotnet.microsoft.com/apps/machinelearning-ai/ml-dotnet?WT.mc_id=devto-blog-shboyer)
* [ML.NET Tutorial - Get started in 10 minutes](https://dotnet.microsoft.com/learn/ml-dotnet/get-started-tutorial/intro?WT.mc_id=devto-blog-shboyer)

Using [ML.NET](https://dotnet.microsoft.com/apps/machinelearning-ai/ml-dotnet?WT.mc_id=devto-blog-shboyer) you can easily build custom machine learning models for scenarios like sentiment analysis, price prediction, sales forecasting, recommendation, image classification, and more.

[ML.NET 1.0 was released at //Build 2019](https://devblogs.microsoft.com/dotnet/announcing-ml-net-1-0/?WT.mc_id=devto-blog-shboyer), and since then the team has been working hard on adding more features and capabilities.

Through the survey below, we would love to get feedback on how we can make your journey to infuse Machine Learning in your apps easier with .NET.

Help shape and improve ML.NET for your needs by taking the short survey below!

[Take the survey!](https://www.research.net/r/FPGS3FG)

_Originally posted by [Bri Achtman](https://devblogs.microsoft.com/dotnet/author/brachtmamicrosoft-com/) at [Hey .NET! Have you tried ML.NET?
](https://devblogs.microsoft.com/dotnet/hey-net-have-you-tried-ml-net/?WT.mc_id=devto-blog-shboyer)_
ReactJS and NodeJS projects. 
Published: 2019-08-25 20:28:13

Hi, I'm Full stack PHP web developer. I'm new to ReactJS, NodeJS, EspressJS and MongoDB. I've also developed few projects based on these technologies.

https://github.com/tayyabaziz/Resume-ReactJS (Live at https://tayyabaziz.com/)

https://github.com/tayyabaziz/MeanWord-Service

https://github.com/tayyabaziz/TravelerBook