teleren/devto huggingface dataset:
Automatically update git major tags on GitHub marketplace release
Tags: actionshackathon21, github, actions
Published: 2021-12-07 08:08:46

### Motivation

Having previously dockerized our semantic release configuration in [@open-sauced/semantic-release-conventional-config](https://github.com/open-sauced/semantic-release-conventional-config), a manual step was needed to publish the action in the GitHub marketplace.

This meant that forcing a major tag update with [@semantic-release/exec](https://github.com/semantic-release/exec) as part of the release process was possible, but would result in the major tag (for example v3) linking to a valid repository commit SHA that is not actually released in the marketplace.

Sensibly solving these issues required:
- keeping the semantic release configuration intact
- testing the action container in another repository
- having a maintainer manually edit and save the release 
- letting the `marketplace.yml` workflow update major tags in the curated release context

It may sound tedious but in practice, all a maintainer has to do to update the marketplace tags is edit a published release and press the save button. That's exactly 2 clicks from the repository front page and the simplest way to have [acceptance testing](https://en.wikipedia.org/wiki/Acceptance_testing).

### My Workflow

```yaml
name: "Action major version tag"

on:
  release:
    types:
      - published
      - edited

jobs:
  latest:
    name: Update action tags
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          ref: ${{ github.ref }}

      - name: "🚀 publish action"
        uses: Actions-R-Us/actions-tagger@v2
        with:
          publish_latest_tag: false
          prefer_branch_releases: false
```

The full workflow is available here: [.github/workflows/marketplace.yml](https://github.com/open-sauced/semantic-release-conventional-config/blob/main/.github/workflows/marketplace.yml)

### Submission Category: Maintainer Must-Haves

### Yaml File or Link to Code

Live repository using this workflow:
{% github open-sauced/semantic-release-conventional-config %}

### Additional Resources / Info

Here are all the open source actions we are using to power this release workflow:
- [Actions-R-Us/actions-tagger@v2](https://github.com/Actions-R-Us/actions-tagger) - updates major tag on release

Be sure to include the DEV usernames of your collaborators:
{% user mtfoley %}
How to lint PRs and welcome contributors using GitHub Actions
Tags: actionshackathon21, github, opensource
Published: 2021-12-07 08:07:30

### Motivation

Expanding the [@open-sauced ecosystem](https://github.com/open-sauced), it became tedious to apply all the necessary tooling available in [open-sauced/open-sauced](https://github.com/open-sauced/open-sauced) to newly created repositories and synchronising existing ones with minor updates.

Having [github actions reusable workflows](https://github.blog/2021-11-29-github-actions-reusable-workflows-is-generally-available/), we figured it would make a lot of sense to centralise our workflows and referencing them in other repositories.

The process was very simple and we want to showcase how to apply a similar process for your own organisation.

### My Workflow
[Note]: # (Please make sure the project links to the appropriate GitHub Actions repository, and includes [an open source license](https://choosealicense.com/) and README.)

```yaml
name: "Compliance"

on:
  pull_request_target:
    types:
      - opened
      - edited
      - synchronize

permissions:
  pull-requests: write

jobs:
  compliance:
    uses: open-sauced/open-sauced/.github/workflows/compliance.yml@main
```

The full workflow is available here: [.github/workflows/compliance.yml](https://github.com/open-sauced/docs.opensauced.pizza/blob/main/.github/workflows/compliance.yml)

### Submission Category: Maintainer Must-Haves

[Note]: # (Maintainer Must-Haves, DIY Deployments, Interesting IoT, Phone Friendly, or Wacky Wildcards)


### Yaml File or Link to Code

[Note]: # (Our markdown editor supports pretty embeds. Try this syntax: `{% github link_to_your_repo %}` to share a GitHub repository)

Live repository using this workflow:

{% github open-sauced/conventional-commit %}

Yaml file link: 
[@open-sauced/open-sauced/.github/workflows/compliance.yml](https://github.com/open-sauced/open-sauced/blob/main/.github/workflows/compliance.yml)

### Additional Resources / Info

Here are all the open source actions we are using to power this compliance workflow:

- [actions/first-interaction@v1](https://github.com/actions/first-interaction) - welcomes first time contributors and invites them to [@open-sauced discord](https://discord.gg/U2peSNf23P)
- [amannn/action-semantic-pull-request@v3.4.0](https://github.com/amannn/action-semantic-pull-request) - ensures pull request title matches [conventional commits specification](https://www.conventionalcommits.org/en/v1.0.0/)
- [mtfoley/pr-compliance-action@v0.2.1](https://github.com/mtfoley/pr-compliance-action) - check PR for compliance on title, linked issues, and files changed 

Be sure to include the DEV usernames of your collaborators:
{% user mtfoley %}

[Reminder]: # (Submissions are due on December 8th, 2021 (11:59 PM PT or 2 AM ET/6 AM UTC on December 9th.)
Metaverse Hackathon is calling for amazing DEVs and Degens!
Tags: blockchain, hackathon
Published: 2021-12-07 08:00:34

We are organizing a worldwide online Metaverse/Game/NFT related hackathon with TOP Ventures Capital and Tier ONE public chain organizations right now. Our partners are Dapper Labs, Republic, Binance Labs, Huobi Venture, DHVC, Delphi Digital, LD Capital, IOSG, Solana, Avalanche, Polygon, etc. 

_**Details and application entrance: (https://metaversealliance.com/)**_

Sincerely invite all developers who are interested in joining our BIG PARTY!

We provide the most experienced advice about blockchain and metaverse, the connections and chances to talk with all of these TOP ventures and firms, also, up to $50M in prize and seed funding if we see any potentials of your submissions. 

Hackathon runs through Dec 1, 2021 till Jan 15, 2022, and has 5 major topics. You could apply in person, or submit your project as a team, more detailed information please find here (https://medium.com/@MetaverseAlliance/metathon-is-calling-for-amazing-devs-and-degens-c1985f87a827).   

**_Details and application entrance: (https://metaversealliance.com/)_**

Twitter: [https://twitter.com/MetaAlliance_?s=20]
5 tips to clear CKAD certification 
Tags: kubernetes, career, cloud, devops
Published: 2021-12-07 07:54:57

I have been using kubernetes for more than 3 years now and I recently completed my CKAD certification. It was a fun and learning experience. 
So I thought to share some tips of how I cleared this certification in a video: 
Here it is- https://youtu.be/fchl6ltsITs
Kick-Start Automation Testing With Katalon Recorder
Tags: browserautomteston, testing, automationtesting, katalonrecoder
Published: 2021-12-07 07:53:06

Software testing was initially a manual activity, however, due to the importance of speedy delivery, the transition to automation testing is predictable.

Suppose you are a manual tester (or developer) seeking an automation solution to speed up your project. There’s no surprise that your first instinct would be to find tools that are easy to get started with and require the slightest effort to be integrated into workflows.

On the flip side, sustainability counts. You need a stepping stone to kick-start automation with ease, but it should be sustainable enough to pave the way for your dynamic growth in the future.

This is the dilemma automation testing beginners face: How to find an automation solution that is easy to kick-start and can accommodate future needs.

[Continue reading](https://www.katalon.com/resources-center/blog/browser-automation/)
Advanced TypeScript With Code Challenges: Template Literal Types
Tags: javascript, typescript, tutorial, programming
Published: 2021-12-07 07:48:35

![Small Elephant stating Javascript, big elephant stating Typescript](https://miro.medium.com/max/2000/1*jUBpz0DE_5DSUvDOk_3ZJg.png)

Template literal types allow us to build more flexible types. As its name suggests, they have the same syntax as template literal strings in JavaScript but are used in type positions.

{% medium https://javascript.plainenglish.io/advanced-typescript-with-code-challenges-template-literal-types-479f56496daa %}
Add issue labels using Github-Actions
Published: 2021-12-07 07:39:00


For the DEV Github Actions Hackathon 2021, I wrote a workflow to Add documentation label to each new issue on your repo!

### My Workflow

Here's the workflow -
```
name: GitHub Actions Doc Issue
on:
  issues:
    types:
      - reopened
      - opened
jobs:
  label_issues:
    runs-on: ubuntu-latest
    permissions:
      issues: write
    steps:
      - name: Label Urgent
        uses: andymckay/labeler@5c59dabdfd4dd5bd9c6e6d255b01b9d764af4414
        with:
            bodyContains: 'documentation'
            add-labels: "documentation"

            repo-token: ${{ secrets.GITHUB_TOKEN }}
```
### Yaml File or Link to Code-  
 Check out Github Repository [here](https://github.com/FidalMathew/Javascript_doc_actions)

### Submission Category: 
Wacky Wildcards


### Additional Resources/Info

I made this workflow which will provide "documentation" issue label to any new issue that is produced in the repository.
The main purpose of this reduce the time for labeling issues for maintainers. It is also helpful to people who want to contribute to open source and documentation related issues are a great way to start your journey.

I wasn't familiar with Github-Actions and how powerful it is, I tried out different things using Github-Actions and there's a lot more that I need to explore and learn.
It was a great learning experience and I will definitely use Github-Actions to ease my development workflow and try to build
some in the near future.

Thank you dev.to for this opportunity!
JSON Modules in JavaScript | Load JSON file easily without Fetch API
Tags: javascript, json, webdev, programming
Published: 2021-12-07 07:31:19

<b>JSON Modules</b> in JavaScript.

It's often convenient to keep an application's configuration inside of a <b>JSON</b> file and store at client end. 

You might want to import a JSON file directly into an ES module. 
I have explained about importing json file using <b>JSON Modules</b> in JavaScript and also explained how to load JSON content dynamically using await and async.

{%youtube D99wGBYn2vE%}
Advent of PBT 2021 - Day 7
Tags: challenge, testing, webdev, javascript
Published: 2021-12-07 07:28:05

---
title: Advent of PBT 2021 - Day 7
published: true
description: Advent of Property Based Testing - Day 7
tags: challenge,testing,webdev,javascript
//cover_image: https://direct_url_to_image.jpg
---

> _Advent of PBT 2021 — Learn how to use property based testing and [fast-check](https://github.com/dubzzz/fast-check) through examples_

Our algorithm today is: **fibonacci**.
It comes with the following documentation and prototype:
```ts
/**
 * Compute fibonacci of n
 *
 * @param n - Index within fibonacci sequence
 *
 * @returns
 * The value of F(n) where F is the fibonacci sequence.
 * F(n) = F(n-1) + F(n-2), with F(0) = 0n and F(1) = 1n.
 */
declare function fibonacci(n: number): bigint;
```

We already wrote some examples based tests for it:
```ts
it("should return 0n for fibonacci(0)", () => {
  expect(fibonacci(0)).toBe(0n);
});

it("should return 1n for fibonacci(1)", () => {
  expect(fibonacci(1)).toBe(1n);
});

it("should return 1n for fibonacci(2)", () => {
  expect(fibonacci(1)).toBe(1n);
});

it("should return 5n for fibonacci(5)", () => {
  expect(fibonacci(5)).toBe(5n);
});

it("should return 55n for fibonacci(10)", () => {
  expect(fibonacci(10)).toBe(55n);
});
```

More details about Fibonacci's numbers on https://en.wikipedia.org/wiki/Fibonacci_number.

How would you cover it with Property Based Tests?

In order to ease your task we provide you with an already setup CodeSandbox, with examples based tests already written and a possible implementation of the algorithm: https://codesandbox.io/s/advent-of-pbt-day-7-er12e?file=/src/index.spec.ts&previewwindow=tests

You wanna see the solution? Here is the set of properties I came with to cover today's algorithm: https://dev.to/dubzzz/advent-of-pbt-2021-day-7-solution-4lf3

---

[Back to "Advent of PBT 2021"](https://dev.to/dubzzz/advent-of-pbt-2021-13ee) to see topics covered during the other days and their solutions.

More about this serie on [@ndubien](https://twitter.com/ndubien) or with the hashtag [#AdventOfPBT](https://twitter.com/search?q=%23AdventOfPBT).
How to fix local storage issue in vue_form_generator
Published: 2021-12-07 07:27:16

I am using local storage in vue form generator where I am storing the user entered value temporary in a browser. So after submitting the form local storage value will vanish completely.
    But in my case I have some issues Like in our site we have two different user One is business user and other is personal user So the issue is If we are storing the local storage value in business login user and if we logout from the session and we will login with different user as personal user Then the same value is displaying in other logged in user. So how to prevent this in vfg.
    Here is my code which I have implemented.

```
if (localStorage.getItem('model') !== null)
            this.model=JSON.parse(localStorage.getItem('model'));
  },
``` 

```
localStorage.setItem('model', JSON.stringify(this.model));
```

Using vfg model I am saving the value in local storage. So please if anyone Have an Idea please help me
Advent of Code 2021 - Day 6
Published: 2021-12-07 07:08:06

---
title: Advent of Code 2021 - Day 6
published: true
description: In this video series, I try to challenge myself with the Advent of Code trials. Each solution will be published to Github, and I hope you will learn something from my coding mistakes and perhaps send some code my way on how you have done these challenges. I know by reading code, so this is such an exciting thing for me.
tags:
cover_image: https://i.ytimg.com/vi/Zx_G9TVcR_Q/maxresdefault.jpg
---

{% youtube Zx_G9TVcR_Q %}

In this video series, I try to challenge myself with the Advent of Code trials. Each solution will be published to Github, and I hope you will learn something from my coding mistakes and perhaps send some code my way on how you have done these challenges. I know by reading code, so this is such an exciting thing for me.
How to get current time zone in JavaScript
Tags: javascript
Published: 2021-12-07 07:07:57

To get the current browser's time zone, you can use the `getTimezoneOffset()` method from the JavaScript Date object.

The `getTimezoneOffset()` returns the time difference, in minutes, between UTC time and local time. The returned value is positive if the local time zone is behind UTC and negative if the local time zone is ahead of UTC.

For example, if your time zone is UTC+5:45, the `getTimezoneOffset()` method will return -345 minutes:

```

const date = new Date();
const offset = date.getTimezoneOffset();
console.log(offset);    // -345
```
The `getTimezoneOffset()` works in all modern browsers, Internet Explorer 5 and higher.
Support pattern matching in JavaScript
Published: 2021-12-07 07:06:19

Pattern matching is a standard feature of modern programming languages
[babel-plugin-proposal-pattern-matching]

> 
(https://github.com/iptop/babel-plugin-proposal-pattern-matching)
the plugin supports the use of this feature in JavaScript

## Installation

With npm:
```sh
npm install --save-dev babel-plugin-proposal-pattern-matching
```

## Setup

### .babelrc

```json
{
  "plugins": ["babel-plugin-proposal-pattern-matching"]
}
```

## Example

### easy
```js
import match from 'babel-plugin-proposal-pattern-matching/match'
const fib = n=>match(n)(
        (v=1)=>1,
        (v=2)=>1,
        _=>fib(_-1)+fib(_-2)
)

console.log(fib(10))
// -> 55
```

### fnmatch
```js
import match from 'babel-plugin-proposal-pattern-matching/match'
const fib = fnmatch(
  (v = 1) => 1,
  (v = 2) => 1,
  _ => fib(_ - 1) + fib(_ - 2)
)

console.log(fib(10))

// -> 55

const arr = [1, 2, 3]

console.log(
  arr.map(
    fnmatch(
      (v = 1) => 'one',
      (v = 2) => 'two',
      (v = 3) => 'three'
    )
  )
)

// -> [ 'one', 'two', 'three' ]

```

### type
```js
import { match , T} from 'babel-plugin-proposal-pattern-matching/match'

const getType = item => match(item)(
  (v = T.number) => 'number',
  (v = T.string) => 'string',
  (v = T.nullish) => 'nullish',
  _ => `${_} undefined type`
)

console.log(getType('a'))
// -> string

console.log(getType(1))
// -> number

console.log(getType(undefined))
// -> nullish

console.log(getType(null))
// -> nullish


```

### instanceOf
```js
import { match, instanceOf } from 'babel-plugin-proposal-pattern-matching/match'

const getType = val => match(val)(
  (v=instanceOf(RegExp))=>'RegExp',
  (v=instanceOf(Array))=>'Array',
  (v=instanceOf(Object))=>'Object',
)

console.log(getType(/111/))
// -> RegExp
console.log(getType([1,2,3]))
// -> Array
console.log(getType({a:1}))
// -> Object
```

### deconstruction
```js
import { match } from 'babel-plugin-proposal-pattern-matching/match'
const sum = x => match(x)(
  ([x, ...xs]) => x + sum(xs),
  ([]) => 0
)

console.log(sum([1, 2, 3]))
// -> 6


for (let i = 1; i <= 15; i++) {
  console.log(
    match({a: i % 3, b: i % 5})(
      ({a = 0, b = 0}) => 'FizzBuzz',
      ({a = 0, b}) => 'Fizz',
      ({a, b = 0}) => 'Buzz',
      _ => i
    )
  )
}
// ->
// 1
// 2
// Fizz
// 4
// Buzz
// Fizz
// 7
// 8
// Fizz
// Buzz
// 11
// Fizz
// 13
// 14
// FizzBuzz

```

### not
```js
import { match, not, or, T } from 'babel-plugin-proposal-pattern-matching/match'

const toNumber = n => match(n)(
  (v = not(T.boolean)) => v,
  (v = true) => 1,
  (v = false) => 0
)

console.log(
  [true, false, 0, 1, 2, 3].map(toNumber)
)
// -> [ 1, 0, 0, 1, 2, 3 ]
```

### or
```js
import { match, or } from 'babel-plugin-proposal-pattern-matching/match'
const fib = n => match(n)(
  (v = or(1, 2)) => 1,
  _ => fib(_ - 1) + fib(_ - 2)
)

console.log(fib(10))
// -> 55
```

### and
```js
import { match, and, not } from 'babel-plugin-proposal-pattern-matching/match'
const fib = n => match(n)(
  (_ = and(not(1), not(2))) => fib(_ - 1) + fib(_ - 2),
  _ => 1
)

console.log(fib(10))
// -> 55
```

## LICENSE

MIT
.NET core APP for Ubuntu 
Published: 2021-12-07 07:02:31



Hi , I am working on one console project which is written on c# .NET core /(NET 5) and i am using below code for windows to load a library.

`[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]

private static extern IntPtr LoadLibrary(String libraryName);

 [DllImport("kernel32.dll", CharSet = CharSet.Ansi)]
        private static extern IntPtr GetProcAddress(IntPtr libraryHandle, String procedureName);`

what will be the alternative for Ubuntu ? 
since Kernel32.dll is win specific - when i publish this code in VS2019 and tried running the APP in Ubuntu machine i got an error as

"Unhandled exception. System.DllNotFoundException: Unable to load shared library 'kernel32.dll'".

Please let me know your inputs to make it work on Ubuntu/Linux machines.
Notes on default ES behavior
Tags: javascript, beginners, programming, notes
Published: 2021-12-07 06:48:26

```
const n = null

console.log(n?.something) // undefined

const o = {}

console.log(o?.something) // undefined

function test(d = 0) {
    console.log({ d })
}

test(o?.something) // { d : 0 }
test(n?.something) // { d : 0 }
```
Beginners MongoDB Cheat-Sheet
Tags: mongodb, javascript, mern, beginners
Published: 2021-12-07 06:27:41

## What is MongoDB ? 
MongoDB is a `document-oriented NoSQL` database used for high valume data storage instead of using table and rows as in the traditional relational databses, MongoDB makes use of collections and documents

Then Question arises What is `documents` and `Collections` ?

<u>Documents </u>: Consist of `key-value pairs` which are the basic unit of the data in MongoDB.

<u>Collections</u> : Contain `sets of documents` and functions which is the equivalent of relational database tables 

--------------------------------------------------------

1.Enlist available databases
```jsx
→ Show db 
```
2 . To Create a new DB

```jsx
→ use db-name
```

3 . See your current working directry 

```jsx
→  db
```
4 . Delete Database

```
db.mydb.drop()
```

5 . Create User 

```jsx
-> db.createUser({
	user:'admin',
	pws:'root',
	roles:["readWrite", "dbAdmin"]	
})
```

6 . Creating Collections

```jsx
-> db.createCollection('customers');
```

7 . Showing Collections

```jsx
-> show collections
```

8 . Inserting values into collections

```jsx
-> db.customers.insert({first_name:"shubham", last_name:"Athawane"});
```

9 . View Collection Records 

```jsx
-> db.customers.find();
//And
-> db.customers.find().pretty();
//Note: pretty() will show you result in json formate
```


10 . Add new Document in Collections

```jsx
->  db.customers.insert([{"first_name":"Virat", "last_name":"Kohli"},
 {"first_name":"Taylor", "last_name":"Swift"}])
// And -> $set, $inc, $unset
-> db.customers.update({first_name:"Glen"}, {$set:{age:45}})
```

11 . Rename Document 

```jsx
-> db.customers.update({first_name:"Virat"}, {$rename:{"age":"old"}})
```

12 . Remove document 

```jsx
-> db.customers.remove({first_name:"Joe"})
```

13 . find the matching

```jsx
-> db.customers.findOne({first_name:"Joe"}) 
```

14 . Count Rows

```jsx
-> db.customers.count()

```

15 . This is Less than/Greater than/ Less than or Eq/Greater than or Eq operators 

```jsx
db.customers.find({age: {$lt: 90}})
db.customers.find({age: {$lte: 90}})
db.customers.find({age: {$gt: 90}})
db.customers.find({age: {$gte: 90}})
```
To use yarn at VS-code on Windows 11
Tags: vscode, beginners, webdev
Published: 2021-12-07 06:19:59

1. install yarn on windows 11.
    https://www.liquidweb.com/kb/how-to-install-yarn-on-windows/

    Download the Yarn .msi installer 
    and installed it on windows 11.

2. Yarn commands for VSCode
    https://www.npmjs.com/package/vscode-yarn
   install vs-code extension.

Happy coding!