teleren/devto huggingface dataset:
How Has Your Company Adjusted to COVID-19?
Tags: discuss
Published: 2020-06-12 22:36:03

All around the world COVID-19 has really had to make companies adjust to how the day to day work happened. In a tech industry most of us had the ability to work remotely effectively. A lot of companies did not have remote work before and really valued the in person interaction that came with being in an office. 

How has your company adjusted to this? With some places reopening has your company come up with a plan for that reopening? Are they now pivoting with what work looks like in the future? I'd love to hear what different places are doing.
Web Monetization API, What you need to know. Short and concise.
Tags: webmonetization, javascript, api, webdev
Published: 2020-06-12 22:32:54

__Web monetization__ in layman terms is making money from traffic to your websites, as easy as that. Most websites do this through:

*Pay Per Click PPC*- get paid when an ad is clicked by site visitors
*Cost Per Impression CPI*- get paid when an ad is displayed and viewed by site visitors.

So basically the existing ways of making money from your website involved putting ads on your website, and truthfully ads atimes are very annoying, your privacy is invaded, user experience is diminished for example why will an ad cover the content of a web page you are reading, it's so annoying.

A new standard of making money on the web is being advocated, it is called the Web Monetization API. Web monetization API seeks to solve the problems of present monetization schemes, that is no ads, no invasion of privacy, the user enjoys the website, and the website owner still earns.
From [webmonetization.com](webmonetization.org), web monetization API is a JavaScript Browser API which allows the creation of a payment stream from the user agent to the website, the payment occurs in real time. Just by adding a line of code to your website or specifying a streaming channel to earn.

How it works:
1. The website or website owner needs a wallet to receive payments.
2. User/ Website visitor needs a wallet to send payments.
3. The browser initiates payment in the background.

Chrome and Firefox browser support it as an extension.
Puma browser supports it totally.

So a future without annoying ads and privacy thieves may be possible. Keep this in mind.

Check out the following for more gist:
[webmonetization.org](webmonetization.org)
[coil.com](coil.com)

This post first appeared on [ugoayo.pythonanywhere.com](ugoayo.pythonanywhere.com)
Sessions and Cookies and (local)Storage, Oh My!
Tags: javascript, localstorage, sessions, cookies
Published: 2020-06-12 22:29:02

Cookies, Sessions, and LocalStorage are all methods of storing data client-side, and specifically on the user's browser. Why do we have so many different versions? Do I need to know them all?? They are all super similar, but do have key differences that make them useful for different purposes. It's important that you understand the benefits and limitations of each so that you can choose which is most appropriate to use for any given application.

Cookies are a much older concept than either Sessions or LocalStorage, and are also much more limited in size. This is because the entirety of a cookie is actually passed back to the server with each request. You can see why you need to keep them small!

LocalStorage and Sessions are much closer to each other than either is to Cookies. They use similar setting and access methods, and can store similar sizes of information. In fact, there's really just one big thing that distinguishes them from each other: Sessions data is isolated to the current tab or window. As soon as you close that tab or window, the information goes away. This is why it's referred to as "Sessions." LocalStorage data, on the other hand, will persist across multiple windows and tabs of the same browser (as will cookies).

We saw above that Session data persists so long as you have that "session" open. LocalStorage will persist indefinitely, until the user or the program deletes it. Cookies have an expiration set by the code. They can be set to expire anywhere from just a few seconds or minutes down the line to a date so far in the future that it is essentially indefinite (such as the year 9999). 

So to sum up:
![A table listing the expiration methods and accessibility across tabs for all three types of storage discussed.](https://dev-to-uploads.s3.amazonaws.com/i/y1w7kl3bjr2eu7ado24l.png)

Consider these differences when implementing any kind of browser storage. Cookies are great for password tokens when you want a user to be logged out after a period of inactivity, for instance, while localStorage is good when you want a user's password and username info to stay put, allowing them to be automatically logged in on every visit. Sessions are good if having multiple pages of the same content up might mess with the running of your program.

How to actually set and access all these methods are really quite simple, but not something I'm going to go over here. [This video](https://www.youtube.com/watch?v=GihQAC1I39Q) lays the high level basics out pretty clearly.

Hopefully this serves as a clear and concise resource for someone!

EDIT: Also worth noting are the varied security risks. It's not a good idea to use Local Storage for sensitive info such as user passwords, for instance, since it's vulnerable to xss attacks.
Is there a list of all DEV topic-specific accounts on Twitter?
Tags: meta
Published: 2020-06-12 21:16:53

The other day, I came across the [@Dev_Pods](https://twitter.com/Dev_Pods) account on Twitter. Then I remembered that there are similar accounts for [Javascript](https://twitter.com/TheJSDev) and [Ruby](https://twitter.com/the_ruby_dev).

Are there any other official, DEV topic-specific Twitter accounts?

Or, is there a list of all of DEV Twitter for us to follow?
gatsby-theme-web-monetization for the GftW Hackathon
Tags: gftwhackathon, gatsby, webmonetization
Published: 2020-06-12 21:16:22

{% github ekafyi/gatsby-theme-web-monetization %}

## What I built

I built [gatsby-theme-web-monetization](https://github.com/ekafyi/gatsby-theme-web-monetization), a Gatsby theme that makes it quicker and easier to implement web monetization on Gatsby sites. 

[Themes in Gatsby](https://www.gatsbyjs.org/docs/themes/) refer to a set of functionalities, components, etc in an installable package that can be combined with other themes and plugins. With the ever-growing Gatsby themes and plugins ecosystem, this theme helps users monetize a wide range of websites/apps.

The theme comes with ready-to-use examples that only requires changing one line of code—the user’s payment pointer.


### Submission Category: 
_Foundational Technology._ (While the theme itself is the former, the examples may come under the _Creative Catalysts_ category, though.)


## Demo

- Blog example
  - [Demo](http://gtwm-example-blog.netlify.app)
  - [Code / Starter](https://github.com/ekafyi/gatsby-starter-web-monetization-theme-blog)

- Photography portfolio site example
  - [Demo](http://gtwm-example-portfolio.netlify.app)
  - [Code / Starter](https://github.com/ekafyi/gatsby-starter-web-monetization-theme-portfolio)

All starter sites come with the instant deploy to Netlify button.


## Link to Code

https://github.com/ekafyi/gatsby-theme-web-monetization


## How I built it 

I already built and submitted [react-web-monetization-ui](https://github.com/ekafyi/react-web-monetization-ui) for this hackathon. Then I thought for React sites generated from Gatsby, adopting Web Monetization and communicating it to the site visitors could be made even simpler by leveraging Gatsby themes’ composable nature.

In this theme, I bundle these monetization-related packages so users don’t have to install and configure them one by one.

* [react-web-monetization-ui](https://github.com/ekafyi/react-web-monetization-ui) for the UI components
* [sharafian/react-web-monetization](https://github.com/sharafian/react-web-monetization) for the hook and components detecting monetization site
* [Daudr/gatsby-plugin-web-monetization](https://github.com/Daudr/gatsby-plugin-web-monetization) to add payment pointer metadata

With the breadth of existing Gatsby [starters](https://www.gatsbyjs.org/starters/?v=2) and [themes](https://www.gatsbyjs.org/plugins/?=gatsby-theme), users can add monetization features to various types of sites. In the [first example site](http://gtwm-example-blog.netlify.app), I make a monetized blog site without writing any code by combining this theme with Gatsby’s official themes. In [the second](https://gtwm-example-portfolio.netlify.app), I make a monetized portfolio site by importing and customizing the theme’s UI components. 

This theme does not (_yet!_) address more complex use cases such as revenue sharing, manually starting.stopping monetization, and securing data sent to monetized visitors. Instead, this theme seeks to be first step for Gatsby site creators of all levels to to get started with Web Monetization.
S1E1 Learn JMeter Series - Getting Started with JMeter 5.3
Tags: testing, performance, java, jmeter
Published: 2020-06-12 20:44:35

Welcome to Learn JMeter Series!

In this season one episode one, you will learn following:

* Download JMeter
* Download JMeter Plugins
* Getting Started with JMeter 5.3 

{% youtube 5PTX-uj8yy0 %}

✔ Buy me a tea 🍵 : https://www.buymeacoffee.com/qainsights
✔ [My Blog](https://qainsights.com)
✔ [My Udemy Course](https://www.udemy.com/course/performance-testing-using-truweb)
Rebuild your static site automatically with Contentful web hooks and Netlify
Tags: contentful, netlify, tutorial, webhooks
Published: 2020-06-12 20:03:36

I finally got [Contentful](https://api.netlify.com/build_hooks/5da887040cdf95770ff25e4f) to work. It took a bit of tweaking here and there,  as I am still new to React and GraphQL, I got there in the end though.

I was clicking through my site, making sure all the posts were working as intended. I had to re-publish a post as I was having issues with images in markdown files. But my site never started a build phase within Netlfiy after I re-published the post. Whaaaaaat?!!. Why wasn't this working?

After some Googling, it seemed I needed something called a webhook. I have seen the word webhook mentioned many times, but was never too sure what they did. So I also googled that:

> A webhook in web development is a method of augmenting or altering the behavior of a web page, or web application, with custom callbacks. 

Makes sense.  How could I get a webook to build my site in Netlify once I published or un-published a blog post? Luckily Contentful has some good docs...

### Update your environment variables within Netlify
![netlify-link-to-git.8f403b2067](//images.ctfassets.net/53u3hzg2egeu/7ybgDjEoaI8hzK0qRgwEym/36b8ae5868aa31c9a29252191c5355a5/netlify-link-to-git.8f403b2067.png)

For more information on how to configure a static site for continuous deployment, refer to the guide on the [Netlify documentation](https://www.netlify.com/docs/continuous-deployment/).

### Configuring a Netlify build hook
![netlify-build-hooks.601518971e](//images.ctfassets.net/53u3hzg2egeu/1RTHi69ot1LlOvmd2CChus/a7915e09d7e328c751aadc14792b1d2a/netlify-build-hooks.601518971e.png)

It's as simple as clicking **Add build hook**, giving it a memorable name, and choosing the branch you'd like to build. Netlify will then do some magic and create a HTTPS URL, which will then respond to a `POST` request by trigging your build and deploying it when you publish or unpublish new content.

Copy the url, which will look something like this: `https://api.netlify.com/build_hooks/<someString>` and then use Contentfuls [Netlify webhook template](https://app.contentful.com/deeplink?link=webhook-template&id=netlify-deploy-site) to configure the webook quickly. 

![webhook-template-netlify.6cd8664d25](//images.ctfassets.net/53u3hzg2egeu/63dLQEnKRCDJJjMHtgGFL4/7f4aecd1da8d86667280ec0464bb1d41/webhook-template-netlify.6cd8664d25.png)

Easy as that...this post was created in Contentful, which trigged my webhook, which built and deployed my site with this new post. 

Images: from Contentful
Making Git easier with aliases in the terminal
Tags: git, tutorial
Published: 2020-06-12 20:02:10


Using aliases allow you as a terminal user to save time, It will end up saving a lot of time during the day. Instead of `git status` I type `gs` the rest are below and are self-explanatory.

```
alias gs="git status"
alias gp="git pull"
alias gb="git branch"
alias ga="git add ."
alias gc="git commit -m $1"
alias gca="git commit -a -m $1"
alias gpo="git push origin $1"
```

You're able to also use arguments with $1, $2, etc. for more extendability, like in this example:

`alias gc="git commit -m $1"`

Now, all I have to type is gc “Commit message” and it’ll commit my changes with the provided message. 

All you have to do is find your most-used commands and try to make them shorter using an alias to make yourself more productive. For example below are some for Django and Gatsby workflows, you get the idea.

```
alias rs="python manage.py runserver" # starts django server
alias dmm="python manage.py makemigrations" # makes db migrations in django
alias dm="python manage.py migrate" # migrates db in django
```

```
alias gd="gatsby develop"
alias gb="gatsby build"
```
Node JS + TypeScript - Super Hero API
Tags: 100daysofcode, javascript, typescript, node
Published: 2020-06-12 19:47:31

---
title: Node JS + TypeScript - Super Hero API
published: true
description: A simple Typescript set up project in Nodejs which returns Random Super Hero details
tags: #100daysofCode,#javascript,#typescript,#nodejs
cover_image: https://miro.medium.com/max/900/1*dSqXPEWnNgUhEmCrjxRI4Q.png
---

So yesterday I get started with the basics of TypeScript. Today I wanted to Setup a Simple Node JS project with typescript.

So the project concept is very simple. I have a superhero.json file in the disk. Whenever we start the server it will load the file and store it as an array. When the user makes a request it will randomly pick one superhero and return it. 

It was pretty fun and interesting. Hereafter I think I should ts for all my node projects. 

You can find my Repo Link here
https://github.com/ganeshraja10/Latest-Tech-Learnings

```typescript
import express, { Request, Response, Application } from 'express';
import fs from 'fs';
const app: Application = express();

const data: string = fs.readFileSync('./data/super_hero.json').toString();

const SuperHeroData: any = JSON.parse(data);

app.get('/', function (req: Request, res: Response) {
  const randomSuperHero = SuperHeroData[Math.floor(Math.random() * SuperHeroData.length)];
  res.json(randomSuperHero);
});

app.listen(3000, function () {
  console.log('App is listening on port 3000!');
});
```
Elixir setup - being consistent with schema
Tags: elixir, setup, phoenix
Published: 2020-06-12 02:53:37

See Files on Github
[common.ex](https://github.com/ideaMarcos/portishead/blob/main/lib/domain/schema/common.ex)
[band.ex](https://github.com/ideaMarcos/portishead/blob/main/lib/domain/schema/band.ex)

It's typical to see [timestamps()](https://hexdocs.pm/ecto/Ecto.Schema.html#timestamps/1) in every schema file, but what if you want to have the same primary key, schema prefix, or subset of columns in all the schema files.

First create your own `using` macro to handle the use/import statements along with any [schema attributes](https://hexdocs.pm/ecto/Ecto.Schema.html#module-schema-attributes).
```elixir
  defmacro __using__(_) do
    quote do
      use Ecto.Schema
      import Ecto.Changeset
      import Portishead.Schema.Common

      @primary_key {:uuid, :binary_id, autogenerate: true}
      @schema_prefix "premarcos"
    end
  end
```

Then define a macro that contains the common fields across all your schemas. You can use `timestamps()` or define your own date fields instead like `created_at`.
```elixir
  defmacro common_fields do
    quote do
      # field :created_at, :utc_datetime_usec, autogenerate: {Ecto.Schema, DateTime.utc_now(), []}
      field :metadata, :string
      timestamps()
    end
  end
```

Finally, in your schema file, use the module that was just created and call the `common_fields` macro.
```elixir
defmodule Portishead.Schema.Band do
  use Portishead.Schema.Common

  schema "band" do
    common_fields()
  end
```

Also worth reading
- https://bernheisel.com/blog/ecto_changeset_tips/
Git Rebase Is Not The Devil
Tags: github, git, opensource
Published: 2020-06-12 19:09:17

Alerting the readers from before, this blog will share my personal experience and provide professional tips on **git rebase**, so if you want to advance yourself with the knowledge in the git, I recommend giving it a read.

First comes the experience now. I love the idea of open source and love indulging myself in contributing to the organizations on Github. Currently, I am an outreachy intern in Apache, and the past week, I worked on an issue that required learning of new concepts, and in the way, my mentor kept advising me to rebase my branch to avoid merge conflicts. But guess what, **rebase** scares the hell out of me only 'cause when I did try rebasing I lost all my commits for the issues and that freaked me out and I decided to just avoid it. Of course, I can't just give up so I tried it one more time carefully and voila, it happened perfectly and I understood the concept at last.

![Happiness](https://dev-to-uploads.s3.amazonaws.com/i/p4ubdiix8xo155k89ohy.gif)

Now the tips, half of you know what rebasing might be and still be afraid to use it. I am going to define it just for those who don't know it yet. So rebasing helps you to put the commits of one branch on top of another branch to avoid any merge conflicts, that's its major use. The image will give a straightforward explanation.

![Git Rebase](https://dev-to-uploads.s3.amazonaws.com/i/ly7del5gfgyk11gas5nl.png)

Beginning the journey to guide you, let's use a rebase for what it's mostly used. Creating the scenario, we have forked the example repo from Twelfth-Hour organization and we've got the feature branch for our example repo. After committing to it, it's no longer in par the master branch from the example repo on the Twelfth-Hour org, and from the image, we know what's the merge base i.e the intersecting commit for the two branches. Now giving you the step by step guide so that your feature is in par with the master branch of the main repo without losing your commits - 

1. `git checkout feature`
This is the branch that we need to add the new commits of the master to.

2. `git remote add example https://github.com/Twelfth-Hour/example.git` 
Here, we create a remote from the main repo that we have forked for this scenario.

3. `git fetch example`
This will fetch the entire codebase with all its branches from the example repo on Twelfth-Hour org.

4. `git rebase example/master` 
Now it will do its process to get your branch in par with the main branch. However, there could be conflicts so it might abort in middle, don't freak out, just resolve those conflicts and continue the process of rebasing. 

This might be the end of the blog but not the end to what rebase is capable of doing.
Post not displayed on search
Tags: help
Published: 2020-06-12 19:04:02

Recently I published 3 posts on dev.to. While searching on some keywords present in the title, none of the my posts are listed. For E.g below are three posts titles
- [COVID-19 EDA and Prediction using .Net Dataframe and ML.Net (C#) - Introduction](https://dev.to/praveenraghuvanshi1512/covid-19-eda-and-prediction-using-net-dataframe-and-ml-net-c-introduction-nlb)
- [COVID-19 EDA and Prediction using .Net Dataframe and ML.Net (C#) - Exploratory Data Analysis](https://dev.to/praveenraghuvanshi1512/covid-19-eda-and-prediction-using-net-dataframe-and-ml-net-c-exploratory-data-analysis-1jdd)
- [COVID-19 EDA and Prediction using .Net Dataframe and ML.Net (C#) - Prediction](https://dev.to/praveenraghuvanshi1512/covid-19-eda-and-prediction-using-net-dataframe-and-ml-net-c-prediction-4cf0) 

Now on searching with keyword such as 'COVID-19', none of the above are listed.

Is there anything I missed as its my first post. Not sure it has reached to broader audience. 

Anything I could do improve the search results.
Essential git commands
Tags: git, github, beginners, codenewbie
Published: 2020-06-12 18:55:21

<ol>
    <li> <h3> git init</h3> <p>this command initializes the repository.<br/><code>git init</code></p></li>
    <li> <h3> git add</h3> <p>this command adds file/files to the repository.<br/><code>git add file_name.ext</code><br/> or add all files in one go: <code> git add .</code>, <code>git add --all</code></p></li>
    <li> <h3> git commit</h3> <p>this command commits the changes to the repository with a message.<br/><code> git commit -m "message"</code></p></li>
    <li> <h3> git clone </h3> <p>this command clones a repository which is stored in a cloud (e.g: github) and creates a local copy.<br/> <code>git clone url_for_repository</code></li>
    <li> <h3> git push </h3> <p> this command pushes the local repository to the cloud(e.g: github).<br/><code> git push</code> , <code> git push -u remote_name branch_name</code></li>
    <li> <h3> git pull </h3> <p> this command pulls or gets an changes from the copy of cloud-stored repository. <code> git pull</code> </li>
    <li> <h3> git branch </h3> <p>this command creates/deletes a branch. <br/><i>Create: </i><code>git branch branch_name</code><br/><i>Delete: </i><code> git branch -d branch_name</code></p></li>
    <li> <h3> git rm</h3> <p> this command is used to delete file/files from git repository.<br/><code> git rm --cached file_name.ext</code> , <code> git rm --cached .</code></p></li>
    <li> <h3> git status</h3> <p> this command is used to show changes to the git repository(new files, modified files, deleted files).<br/> <code> git status</code></p></li>
    <li> <h3> git log </h3> <p> this command is used to show all commits.<br/> <code> git log</code></p></li>
    <li> <h3> git checkout </h3> <p> this command is used to switch between branches.<br/> <code> git switch branch_name</code></p></li>
    <li> <h3> git merge </h3> <p> this command is used to merge tow branches.<br/> <code> git merge target_branch source_branch </code></p></li>
</ol>