teleren/devto huggingface dataset:
npx vs npm - THE npx ADVANTAGE
Tags: npm, node, productivity
Published: 2019-11-02 01:41:20

If you have ever used  [**node**](https://nodejs.org), you must have used *npm*. **npm** is a dependency/package manager you get out of the box when you install  [node](https://nodejs.org).

> *npm* is two things really, first; *it is an online repository for the publishing of open-source Node.js projects*; second, *it is a command-line utility for interacting with the said repository that aids in package installation, version management, and dependency management.* 

Since version  [npm@5.2.0 - See Release Notes](https://github.com/npm/npm/releases/tag/v5.2.0), **_npx_** is pre-bundled with **npm**. 

Just like **npm**, **_npx_** is a CLI tool but with special use cases. **npx** is meant to make it easy to use CLI tools and other executables hosted on the **npm** registry. 

## The npx Advantage? (Awesome Use Cases)

> Most globally installed packages in node are executables.

Instead of globally installing node executable packages that you will likely use less often, you can save yourself disk space and simply run them with *npx* when you need it. This means you can use any node executable package on **npm** registry with having to install it.
For example, I don't have to install *create-react-app* globally on my machine and no worries about updates likewise because anytime I run `npx create-react-app`, *npx* will always look up the *npm* registry and run the *create-react-app* with its latest version.

Installing npm packages globally most times requires ***sudo*** (administrative user right). With ***npx*** you can simply run a node executable anywhere without *sudo*.

You don't have to install a CLI tool from npm registry when you only want to give it a try.

> `npx <package/command>`

You can also use *npx* to execute your scripts without adding $PATH variables. 

> `npx ./my-script.js`

Interestingly, you can combine *npx* superpowers with  [*node*](https://www.npmjs.com/package/node)  package executable on npm registry which installs a node binary into your project (so you can have a local version of node that is different than your system's, and manage node like a normal dependency) just like ***nvm***.
With this combination, you can run commands with different Node.js versions.

> `npx node@6 <package/command>`

## Do you have npm?

Running this should return a path to the `npx` bin.

```$ which npx```

 If nothing is returned, it means you don't have a version of **npm** greater than **npm@5.2.0** running on your machine. The best bet is to upgrade your **npm**.

```npm install -g npm@latest```

### Useful Links:

- [Install Node.js](https://nodejs.org).
-  [See npm@5.2.0 Release Notes](https://github.com/npm/npm/releases/tag/v5.2.0)
- [Install npm](https://www.npmjs.com/package/npm?activeTab=versions)
- [Install node via nvm](https://github.com/nvm-sh/nvm) *My Opinion: The best way to install node*.

*Start using npx today*
Why Choose Actionhero
Tags: node, actionherojs, serverless, javascript
Published: 2019-11-02 00:03:20

##### or: Actionhero is the Node.js server for when your project grows up

It’s been over 7 years since I started on [Actionhero](https://www.actionherojs.com/), a Node.js server, and I’m very proud of how far we’ve come. We’ve got over [2,000 stars on GitHub](https://github.com/actionhero/actionhero) and an [active Slack community](https://slack.actionherojs.com/). We are used by many large companies in production, and are often cited by many publications as one of the better Node.JS frameworks. We are even approved by the US Department of Veteran’s Affairs for use in critical health-care systems.

Until now, I’ve taken a very soft stance on “why” Actionhero might be better than any other server framework/tool for your project, as every project is different. Maybe all of your project’s goals really would be met using only Express, and all you need is a JSON-speaking REST API server. That said, every project I’ve worked on always needed… more.

Along with the other Actionhero core-contributors, I’ve decided to publish this list of why you might choose to use Actionhero in a mature, enterprise environment.


## Actionhero understands that modern applications speak more than HTTP.

Of course Actionhero features a robust RESTful router and HTTP server. But that is not enough any more is it? You probably also want websocket support, right? You also want to share session across HTTP and WS connections, and you want to be able to reuse your code across both. The Actions in ActionHero are agnostic of the communications protocol your clients are speaking, and you can reuse them. Support for all of this is included, right out-of-the-box.

## Actionhero can coordinate with its peers when deployed.

Actionhero is “Cluster Aware”. This means that ActionHero is built from the ground-up to run in parallel across multiple machines at once. Nodes can speak to each other both passively (via a shared cache and job-queues; included) and actively with direct RPC communication.
Actionhero knows that background tasks are always required.
Sending your client a “welcome” email doesn’t belong in your web thread. Neither does processing anything else in the background. Actionhero treats background jobs as first class citizens, and any part of your API can enqueue them. Actionhero runs job workers in the proper Node.js way: event-based and many at a time.

## Actionhero provides all the help you need, then gets out of the way.

Actionhero proposes a standard project layout, including testing and initializers. Actionhero has a REPL and generators to get you up-and-running quickly. Actionhero supports localization and test-driven development. After that… you can do anything you want!

## Mature Operations for a Mature business.

Actionhero supports 0-downtime deployments, process signaling, and more. You can be sure that your DevOps team will find running Actionhero pleasant and clear.
Git - Delete Branches
Tags: git, vsc, beginners, fundamental
Published: 2020-02-05 10:38:14

---
title: Git - Delete Branches
published: true
date: 2019-11-02 00:00:00 UTC
tags: git, vsc, beginner, fundamental
canonical_url: https://tech.serhatteker.com/post/2019-11/git-delete-branches/
---


Before deleting any branch if you want to know your branches just run:

```sh
$ git branch -a
```

The output will be like:

```sh
*master
 feature
 remote/origin/master
 remote/origin/feature
```

Now;

## Delete Local Branch

```sh
$ git branch -d <branch_name>
```

`-d` flag is for "delete" as you may assume.  In addition to that, the `-d` flag
only deletes the branch if it has already been fully merged in its upstream
branch. You can also use `-D`, which is for `--delete --force`, which deletes
the branch "irrespective of its merged status." Source: [git-scm](https://git-scm.com/docs/git-branch)

## Delete Remote Branch

```sh
# New version (Git 1.7.0 or newer)
$ git push -d <remote_name> <branch_name>

# Git versions older than 1.7.0
$ git push <remote_name>  :<branch_name>
```

All done!
React Core Principles Written by a Self Taught Beginner 
Tags: react, beginners, guide
Published: 2019-11-01 22:59:27

[React.js Core Principles](https://github.com/Noahsok/React-JS-core-principles)

# Self Taught Beginner / Some Context

This is my first post and honestly I am not sure how much context I should give you all.

I hope you all will like this post and project. But first:

I am a visual artist and I was a glass blower for 10 years. 3-4 years ago I decided to change careers and learn a hard skill. I wanted to learn to program because I wanted to use a side of my brain that I was trained not to use. 

I started cold turkey! I never built a website, a blog or any kind of web based platform. I did know how to use a computer and I (thought) I knew how to use google/search engines.

I ended up finding meetups and learning from a few python developers. I struggled for the last three years to understand basics and core principles and yet I have freelanced a bit and I have built some things. The most important thing about all of this is that I learned how to learn, I learned how to google and read the docs(RTD). 

Recently I have realized that my artistic background is a strength. the combination of the skills I have learned the last three years with my creative thinking and visual strengths can only be a positive. So, I started learning UI/UX. I started learning React.js, I need to learn the core principles. 

# Core Principle for React.js

The best way for me to learn is by taking notes and building simple programs(from tutorials). 

I started a github repo that is filled with my notes and CodePen tutorials/components. This is a work in Progress (WIP) everything in this repo is taken from known sources and as my knowledge grows hopefully the repo will grow too.

I hope this is useful for others as building this repo has been for me.

[React.js Core Principles](https://github.com/Noahsok/React-JS-core-principles)
Looking for a Vue open-source project
Tags: vue, javascript, opensource
Published: 2019-11-01 22:58:09

I'm principally a senior Java dev but I would learn to Vue.js. 

I think that a good way to learn a new framework or programming language is to contribute to an open-source project and follow devs more expert than you. 

So can you suggest me a beginner-friendly project where I can practice on Vue.js?
"You're almost there!" My first (successful) Hacktoberfest
Tags: hacktoberfest
Published: 2019-11-01 22:47:07

Yey, another Hacktoberfest post. 🥳 


##What is Hacktoberfest?##
_Hacktoberfest is a month-long celebration of open source software run by DigitalOcean and DEV. (...) 
To participate, four pull requests must be submitted to public GitHub repositories.
You can sign up anytime between October 1 and October 31.<sup>[[1]](https://hacktoberfest.digitalocean.com/faq#general)</sup>_

##Hacktoberfest & me##
I'm pretty active in twitter, and some of my friends posted every year about a thing called *hacktoberfest*. Two years ago I tried looking into it: 
>Free shirt? sign me in! 
>Contributing in open source? uhhh... 

I had experience with GitHub, but not so much with contributing in other people's repositories. I was not ready. 

Last year I tried again and went looking for the *hacktoberfest* tag, after skipping a lot of big projects (or at least too big for my confidence level) I managed one PR. Very disappointing, but I had to start somewhere.

This year I was ready, I had been checking out [telegram's bot for first issues](https://t.me/firstissues) for some time already, so I knew in which kind of projects I wanted to contribute.
Even though I ended up more busy than I would like with my job, I did submit the four necessary PR. I can't say I'm not proud about it, even though they were in quite simple projects. 🎉🎉 

##And now what?##
It would be great to write that I will now start contributing to open source on a weekly basis, but that's not what's going to happen. 
I yet need the confidence -and time- to contribute in bigger projects, but I can say that I learnt a lot during this month -although I still have some questions: *what I'm supposed to do when they ask to fix something in a file, but the rest of the file is also full of errors? Do I fix them? Do I create an issue?*-.

I might not be ready to contribute in everything I'd like, but I'm keeping an eye on some interesting projects and I guess the anxiety of contributing will decrease with each new PR. 

And now, until next year! 👩‍💻
Zeal 11/1/2019 - Learning Lerna with Matti
Published: 2019-11-01 22:41:49

##### Checkout the stream @ [https://www.twitch.tv/codingzeal](https://www.twitch.tv/codingzeal)

What the VOD of the whole stream to follow along:
[https://www.twitch.tv/videos/502681554](https://www.twitch.tv/videos/502681554)

# Today Objectives

- [x]  Learn about Lerna
- [x]  Learn about mono-repos

# Notes

- Mono-repos: Some reason why you might one to use them.
    - One place to test and manage packages
    - One place to file and manage issues
- If you want to customize your `create-react-app` webpack con
    - [https://www.npmjs.com/package/@craco/craco](https://www.npmjs.com/package/@craco/craco)
- `esm` - YOU DONT HAVE TO USE BABEL WITH THIS!!! [https://www.npmjs.com/package/esm](https://www.npmjs.com/package/esm)
The brilliantly simple, babel-less, bundle-less ECMAScript module loader.
- Level up your command line with more information: [https://starship.rs](https://starship.rs/)
- Lerna
    - Help manage multiple package in your mono-repo
    - If you use Yarn workspaces with lerna it will host all dependencies to top level for you. Reduces a lot of node_modules to install
        - Just have to tweak lerna.json and package.json to make the dream happen
    - create-react-app for yarn workspaces, if doesnt work out of the box
        - Library is what you need @react-workspace/react-scripts
        - [https://www.npmjs.com/package/@react-workspaces/react-scripts](https://www.npmjs.com/package/@react-workspaces/react-scripts)
    - Something to look over about using lerna with Rails and React front-end, maybe good idea?
        - [https://smashingboxes.com/blog/rails-and-react-monorepo-speed-sustainability/](https://smashingboxes.com/blog/rails-and-react-monorepo-speed-sustainability/)
    - Commands: [https://github.com/lerna/lerna/tree/master/commands](https://github.com/lerna/lerna/tree/master/commands)
        - npx lerna init - to generate you project
        - lerna create common - scaffolds out package, like npm init
        - lerna import  - Import existing packages into lerna for you
        - lerna exec — command_to_run - Runs a shell command in all packages
        - lerna add package_name —scope={other_packge_name} - Add a package dependency and link to other packages in lerna
        - lerna bootstrap - like yarn/npm install
            - lerna bootstrap —hosit - "Hoists" up common dependencies  to top level node_modules
        - lerna diff - Like git diff between release version
        - lerna ls - Show public packages for your repos
        - lerna add package_name - Installs a package to all projects
            - lerna add —scope={packages_to_instal_to, another_package}
        - lerna clean - Automatically delete node_modules in all packages
        - lerna run command_name  - Runs a package command in all your packages

# Shoutouts and Thanks

- Matti for walking us through lerna and monorepos AND having some great examples to work through

# Future action items

- [ ]  Try out lerna on my own projects!!!!
#codevember — 1 — Contrast
Tags: codepen, codevember
Published: 2019-11-01 22:23:02

---
title: #codevember — 1 — Contrast 
published: true
tags: codepen, codevember
---

<h1>codevember 2019 day 1</h1>

{% codepen https://codepen.io/trinketmage/pen/RwwxGZb %}
TIL: Lesser-Known NPM Aliases
Tags: npm, todayilearned
Published: 2019-11-01 22:09:35

Anyone who is familiar with the [NPM](https://www.npmjs.com/) CLI probably knows some shortcuts to the most popular commands. We can use `npm i` instead of `npm install` or `npm run [cmd]` instead of `npm run-script [cmd]`. But did you know that there are aliases not included in the [NPM docs](https://docs.npmjs.com/cli-documentation/)? Try these out.

### Install

```bash
# yeah...meant to spell it that way
npm isntall
```

### Test

```bash
npm tes
```

### Whoami

```bash
npm whoam
```

### Publish

```bash
# --dry-run just in case you copy/paste
# into a public repo
npm pub --dry-run
```

These aren't all very practical, but it seems like NPM is looking out for those of us who are liberal with spelling. Know of any other lesser-known NPM aliases? Let me know!
Reviewing popular NPM packages
Tags: discuss, npm, github, review
Published: 2019-11-01 21:41:41

---
title: Reviewing popular NPM packages
published: true
description: Would you like to review with me popular open source packages?
tags: discuss, npm, github, review
cover_image: https://thepracticaldev.s3.amazonaws.com/i/rq50lkl0ctru58264r72.png
---

# Reviewing popular open source packages

Do you know any websites, that review popular open source packages?

If not, would you like to join me doing it?

## My proposition of review template:

### Informative part
1) The problem, that the npm package solves
2) Abstract description of techniques used to solve the problem
3) Alternative approaches, that could be possibly taken

### Results part
1) TESTS - Test coverage for the logic.
2) CLEAN - Size of the functions, naming conventions, files structure, separation of concerns.
3) CRAFT - Single responsibility, Open-Closed, YAGNI, DRY.

I think with the amount of NPM packages we use in daily basis, our power would improve significantly if we could better understand them and incentive authors to keep the highest quality.

Let me know your thoughts.
TIL: Adding an action/workflow status badge to your GitHub repository
Tags: github, badge, action, todayilearned
Published: 2019-11-01 21:26:00

---
title: TIL: Adding an action/workflow status badge to your GitHub repository
published: true
description: A little hint on GitHub badge URLs
tags: github, badge, action, til
---
If you want to show the GitHub Actions badge on your repository, be aware that the URL has to reflect the name of a given action.

Do note [GitHub actions are still in beta](https://github.com/features/actions).

Like for example this badge for one of my repositories:

![GitHub Workflow build status badge](https://github.com/jonasbn/til/workflows/Markdownlint%20Workflow/badge.svg)

1. The URL points to GitHub: `https://github.com`
2. My account: `jonasbn`
3. The relevant (this) repository: `til`
4. The workflows directory: `workflows` and this is the `workflows` directory located in the directory `.github`
5. Now the most _tricky_ part - the `name` fields from the `main.yml` file from the above directory (`github/workflows/`):

```yml
name: Markdownlint Workflow
on: push

jobs:
  build:
    name: Markdownlint
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - uses: ./github-action-markdownlint
```

This value:

`name: Markdownlint Workflow`

Okay, but since the specified name contains spaces, the have to be explicitly described using [URI-encoding][uri_encoding] (or percent-encoding), meaning space is encoded `%20`

6. Last but not least the hard-coded value: `badge.svg`

So the complete URL for the badge displayes look as follows:

`https://github.com/jonasbn/til/workflows/Markdownlint%20Workflow/badge.svg`

Do yourself the favor of testing the URL before making commits containing it, it took me several attempts to get right.

Thanks to the nice supporter from GitHub who helped me out.

## References

- [Wikipedia: URI-encoding][uri_encoding]
- [GitHub: "Setting up continuous integration using GitHub Actions"][github_actions]
- [GitHub: "Adding a workflow status badge to your repository"][github_badges]

[uri_encoding]: https://en.wikipedia.org/wiki/Percent-encoding
[github_actions]: https://help.github.com/en/github/automating-your-workflow-with-github-actions/setting-up-continuous-integration-using-github-actions
[github_badges]: https://help.github.com/en/github/automating-your-workflow-with-github-actions/configuring-a-workflow#adding-a-workflow-status-badge-to-your-repository

[This TIL](http://jonasbn.github.io/til/github/action_badges.html) was lifted from [my TIL collection](http://jonasbn.github.io/til/)
Solved: 2 Salesforce ETL Errors
Tags: salesforce, database, errors, etl
Published: 2019-11-01 21:05:15

I'm blogging about 2 Salesforce errors I ran into today so that your Google results will, hopefully, be a little bit more helpful when you, too, see them.

I was trying to design a Jitterbit ETL process loading data into Salesforce.

1. I got stuck on a "**`bad value for restricted picklist field`**" error when trying to load data into a picklist field.
	* Turns out picklist values, like fields, have both display names and "API names."
2. I also ran into "**`id value of incorrect type`**" loading what I _thought_ was an 18-digit record ID into a lookup field
	* Turns out "`{{XYZZY}}`" is not the same as "`XYZZY`" to a computer.  Fancy that.

---

## Bad Picklist Value

For Visualforce purposes, our admins had set the values of a picklist to read "`Yes, I am`" and "`No, I am not`" in a field responsible for capturing responses to a question on an application form we present to the general public.

![Screenshot](https://katiekodes.com/images/screenshot-picklist-bad-value.png)

It makes for a slight silly feeling as a staff member doing data entry on Salesforce record detail pages, but it's not a usability show-stopper, and I can definitely see how it helps make things display nicely in our portal without too many workarounds.

The thing is ... I kept trying to do this Jitterbit field-mapping transformation from a data source with "`Y`" and "`N`" values, because that's what the picklist drop-downs said and I never thought to question them:

```
<trans>
Case(
	SOURCE_FIELD=="Y","Yes, I am"
	, SOURCE_FIELD=="N","No, I am not"
	, true,SOURCE_FIELD
);
</trans>
```

In the end, I needed to data-load against the **API names** of the picklist values, "`Yes`" and "`No`":

```
<trans>
Case(
	SOURCE_FIELD=="Y","Yes"
	, SOURCE_FIELD=="N","No"
	, true,SOURCE_FIELD
);
</trans>
```

---

## Lookup ID Type Error

In other "oops" news, when I tried to do a `SFCacheLookup` against the following SOQL and data-load it into a lookup field just like this:

```
<trans>
SFLookupAll($myOrg, "SELECT Id FROM Validation_Table__c WHERE Friendly_Name__c = 'The Friendly Name'");
</trans>
```

I received this error:

```
MY_LOOKUP_FIELD_LABEL_HERE: id value of incorrect type: {{y8E010101010101010}}.
```

* **Q:**  Can anybody spot why?
* **A:**  It turns out that making a typo between `SFLookupCache` and `SFLookupAll` _**does**_ matter.  😜
	* `SFLookupAll()` was, of course, returning some sort of collection (list/dict/etc.) variable, which meant that when Salesforce got it as a piece of text, the text was no longer "`y8E010101010101010`" but "`{{y8E010101010101010}}`."
	* `SFLookupCache()` is what I meant to type, and is the operation that returns a single value.

Check for stupid mistakes if you get this error when designing a data-load ETL job and swear you "didn't do anything wrong."

_(I knew that `y8E010101010101010` had to be the correct record ID because if I logged into the Salesforce web interface and edited the field by hand, looking up the record with a search, that was exactly the record Salesforce populated the field with.)_
My first PR
Tags: hacktoberfest, opensource, github, discuss
Published: 2019-11-01 20:01:21

This is my first time i participate in Hacktober fest. This is a very aaswme journey of one month where i learn too much about open source and how to make PR and why to contribute to opensource.
  Luckly, I got selected for T-shirt as well as Stickers from the hacktober organiser.

I am very Excited for the T-shirt
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/ghd0x04sxxwwuxw7guxh.png)

=>> Contribute to open source