teleren/devto huggingface dataset:
Contributing to Others repo
Tags: opensource, node, javascript, pullrequest
Published: 2021-09-25 03:24:24

Over the week, I had an amazing opportunity to work with my classmate and both of us helped each other in adding new feature to each others Static Site Generator tool. I partnered with [Kunwarvir Dhillion](https://github.com/dhillonks) and he contributed to my project [commandline-ssg](https://github.com/ritikbheda/commandline-ssg) and I contributed to his project of [cli-ssg](https://github.com/dhillonks/cli-ssg).
## Creating a Pull Request
I started by cloning the project and creating [issue](https://github.com/dhillonks/cli-ssg/issues/9) for to add the feature of converting md files into html files. Then I read the code and understand the program flow, analysed the coding style of the repo owner. I then worked on the coding part to add those features and was successfully able to add features of heading, paragraph, bold, italics and links and then created a [PR](https://github.com/dhillonks/cli-ssg/pull/10). The repo owner then reviewed and found suggested my a few more changes like using strong tag instead of b tag to make the html text bold. I worked on those requested changes and soon [committed](https://github.com/dhillonks/cli-ssg/pull/10/commits/78c4a5f2e28e916871b1777640cb60d836cd87eb) the code that worked with respect to the requested features. Later I created a [PR](https://github.com/dhillonks/cli-ssg/pull/11) for README.md file which I updated the file to go parallel with the current features of the tool. I learned many skills in this lab/week some of them are how to create pull request, merge code and use JavaScript ReGex. I also learned how to analysed someone else’s code and how to follow their working and thinking style. 
## Merging the Pull Request
My partner also worked on my repo and added the feature to convert md files to html. He considered heading, paragraph and bold to be important ones and added only these 3 features. I believe he matched very nicely with my coding style. Thanks to him. The whole process went very smooth and good. The issue and PR links for that can be found as under: 
issue: [https://github.com/ritikbheda/commandline-ssg/issues/8](https://github.com/ritikbheda/commandline-ssg/issues/8) 
PR: [https://github.com/ritikbheda/commandline-ssg/pull/9](https://github.com/ritikbheda/commandline-ssg/pull/9)
First pull request 
Tags: opensource, csharp
Published: 2021-09-25 03:22:51


This week, I created my very first pull request to my classmate's project and also received the first contribution to my Shinny-ssg application. 
# Creating a Pull request
The project I chose to work on is [OSD600-SSG](https://github.com/nguyenhung15913/OSD600-SSG), written by Hung. I am interested in this project because it is written in JS and I would love to learn more about it. I contributed to the project by adding the new feature to accept markdown file. The first challenge I had was adding new code without breaking his old code. His coding style is different from mine so it took some time to learn the logic flow of the code. Luckily, Hung was really nice and he even encouraged me to change his code. The second challenge I had was working with regular expression. I needed to transfer the emphasis sentence in markdown file to html bold text. In a markdown file, to bold the middle of a word for emphasis, you need to add two asterisks without spaces around the letters. I added an extra space to my finding pattern and it was hard to find this bug. In the end, I successfully added the new feature to the project. After testing it on my local computer, I created a pull request and got accepted by Hung. 
[My PR](https://github.com/nguyenhung15913/OSD600-SSG/pull/11)
# Receiving a pull request
I had the pleasure of receiving the contribution from Andrew to add markdown processing feature to my application. He made the change to the code very quickly and it was exactly what I would do if I were the one to implement it. I especially liked the way he used LinQ in createSubfolder function. It was brilliant and now I know one more way to work with file. 
[Andrew's PR](https://github.com/hphan9/shinny-ssg/pull/7)
# Take-away
I think the most important thing to make a successful pull request is following patterns in the existing code. It will help save the reviewer's time to understand, debug and make recommendation.
Kubernetes Learning Challenge
Tags: kubernetes, devops
Published: 2021-09-25 02:53:07

Take this challenge and learn step by step, 
Docker, Container, Kubernetes, AKS, GitHub, Helm etc.

[https://bit.ly/aks-challenge](https://bit.ly/aks-challenge)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x11bm5baqfnvrglcn4cv.png)
Working on other's project
Tags: csharp, dotnet, github
Published: 2021-09-25 02:47:30

The second lab of the course was to work on other people's project to add a feature for processing markdown. The point of the lab was communicate and collaborate.

I had a miscommunication which I did not publicly posted that I got a partner, and because there were no issue created on my repo, two students had to work on my repo as well. I learned the importance of communication and publication in open source development. Luckily there were no merge conflict, but if they worked on the same feature, I would have a big merge conflict.
https://github.com/irenejoeunpark/ssgApplication/pull/13
You will be able to see the changes for *strong* feature on md on this one.
https://github.com/irenejoeunpark/ssgApplication/pull/10
And you'll find the heading feature from this PR.

My project was written in Java, and my partner's project was written in C# with ASP.NET core. I had zero experience on C#, so I had to study the syntax and some functions in the library. Since the code was neat and clear on the functions, I was able to follow Diana's coding style and successfully added header feature for markdown. My code was to convert "#" to h1 heading in html. After few tests Diana accepted my Pull Request and the feature is added to her project. 
https://github.com/dbelokon/glazed-donut/pull/7
toString Hack Obfuscated
Tags: javascript, strings, hacks
Published: 2021-09-25 01:45:29

```js
x=''+self 
j=''
'd1d7a1712345691a7512d427b1da7d9ab7519a4b721a961721d694'
.split``
.map(_=>j+=`x[0x${_}]+`)
console.log(eval(j+'""'))
```

;)

_See more stuff like this over @ [Snippet Zone](https://snippet.zone/)_
dependencies? devDependencies? 🤔
Tags: npm, beginners, webdev
Published: 2021-09-25 01:11:37

## How to differentiate them

The basic criteria is whether a package is only needed for development or not. 
- `dependencies`: Packages required to execute the application
- `devDependencies`: Packages required for development/testing

## Examples

dependencies
- react, react-dom
- next

devDependencies
- eslint
- husky
- prettier
- typescript
- jest

## What's good about differentiating them

- A developer can easily distinguish what packages needed for development or production
- When production build, faster installation time, less disk usage
=> `$ npm install --production`

## Commands

### Add a package to dependencies

npm
`$ npm install <package-name>`
Short: `$ npm i <package-name>`

yarn
`$ yarn add <package-name>`.

### Add a package to devDependencies

npm
`$ npm install <package-name> --save-dev`
Short: `$ npm i <package-name> -D`

yarn
`$ yarn add <package-name> --dev`
Short: `$ yarn add <package-name> -D`

## Reference

EN
- [Specifying dependencies and devDependencies in a package.json file | npm Docs](https://docs.npmjs.com/specifying-dependencies-and-devdependencies-in-a-package-json-file)

JP
- [【いまさらですが】package.jsonのdependenciesとdevDependencies - Qiita](https://qiita.com/chihiro/items/ca1529f9b3d016af53ec?utm_source=pocket_mylist)
- [【package.json】dependenciesとdevDependenciesの違いとnpmとyarnのコマンド解説 | モグモグ](https://mo-gu-mo-gu.com/about-dependencies-devdependencies/)
- [【package.json】dependencies, devDependencies の使い分けを考える - Qiita](https://qiita.com/karur4n/items/3d9d28f6f21c3533020d)
Move you angular cli app to Nx
Tags: angular, showdev, webdev
Published: 2021-09-25 00:48:25

Help me improve these updates by giving suggestions.
Github Repo - https://github.com/ajitsinghkaler/devto-clone

Deployed on Firebase - https://dev-toclone.firebaseapp.com/

Last week I was sick so there was no updates last week.

This week I mostly focused on my moving my clone to Nx monorepo. While converting it here are some of my findings on how to convert an Angular cli app to Nx monorepo

To convert an angular cli app to nx follow the steps below:-

* Run the automatic nx generator in you app whoch will convert the angular cli project to an nx workspace
```bash
ng add @nrwl/workspace --preserveAngularCLILayout
```

* After that remember project should never be imported into the library. Environments, common models, common components, common services move to an entirely different lib.

Example of moving 
1. Environments to a library can be found [here](https://github.com/ajitsinghkaler/devto-clone/tree/main/libs/environments)

1. Components to a library can be found [here](https://github.com/ajitsinghkaler/devto-clone/tree/main/libs/global-components)

1. Global Services to a library [here](https://github.com/ajitsinghkaler/devto-clone/tree/main/libs/global-services)

1. Global Styles here [here](https://github.com/ajitsinghkaler/devto-clone/tree/main/libs/styles)

* To move them to a library generate anew library by `nx g lib <lib-name>` after that move everything to lib and export everything via the index.ts file.

*  To import the dependencies the paths are added to the tsconfig.base.json from there you can check what shorthand property to use for what imports.

* When you are done with all this you can now divide your modules into smaller libs like a module into its ui, data-access etc.

* Dividing the libs is on you its just like the angular module system you can make any module as big as possible and and small as possible.

* Just remember don't create circular dependencies.

I also moved most of my components to single file components as it was easier to read and most of my components don't need to be multiple file.

Form next time I'll start adding unit tests and integration tests, e2e tests after that this project will be done.

Commits

1. [feat: migrate to nx](https://github.com/ajitsinghkaler/devto-clone/commit/cbf7a957f1db53c64bddf8828a7f26b3cdf7854b)

1. [fix: add global services and global components lib](https://github.com/ajitsinghkaler/devto-clone/commit/a4265775140d259f742e76af8a108a310cf467d1) 

1. [feat: move all pages to nx libs](https://github.com/ajitsinghkaler/devto-clone/commit/bfcf05110000851428dd2d80416353bec1b53302)

1. [feat: move global styles to a library](https://github.com/ajitsinghkaler/devto-clone/commit/8a2169d16487cf01c9d13d7ddd1a03f825db5b0e)

1. [feat: convert into single file components](https://github.com/ajitsinghkaler/devto-clone/commit/ef75badcffbe0c1b128f245345aac4438ca83991)

Let me know if you ant to see any new experiments in the repo.
The World Of PR's
Tags: opensource, python
Published: 2021-09-25 00:42:49

## Background
If you've been following my blog then you know that I have created an extremely simple static site generator in Rust. That blog can be found [here](https://dev.to/antoniobennett/rust-static-site-generator-rssg-release-0-1-0-3o9e) for more info. This week we were tasked with filing a PR on a fellow student's repo to add markdown file support and basic parsing.

https://github.com/roman-rezinkin/RomanStaticSG

## Steps Taken
To get started on making the pull request I first filed an issue detailing what I would be working on. 
https://github.com/roman-rezinkin/RomanStaticSG/issues/12

The first step I made was actually filing a new issue...I found that the previous logic would not work because all files in the current dir with the same file ending would be added to dist. 
E.g  `python romanssg.py -i=example` <- All files that are the same filetypes as example would be added to the dist folder. This is because the previous logic found all files that was the same filetype the directory and added them to files to be processed. 
https://github.com/roman-rezinkin/RomanStaticSG/issues/13

```python
for i in os.listdir("."):
    if fnmatch.fnmatch(i, "*.txt"):
    arrayOfFiles.append(i)
```

Changed to

```python
filename = curr_value # <-- input
arrayOfFiles.append(filename)
```

Next I moved on to adding markdown support. All I had to do was replace header level 1 tags with h1 tags and append the line to the file

```python
if x.startswith("# "):
    x = x.replace("# ", "<h1>")
    newFile.write("\t" + x + "</h1>\n")
```

Small changes were made to the README as well to indicate that markdown file support was introduced with header level 1 parsing. This was all done with the below PR

https://github.com/roman-rezinkin/RomanStaticSG/pull/14

## Overall Experience

The overall experience was fun. It was interesting seeing the workflow of forking, modifying and submitting PR's and also having them reviewed. Next time I hope to start working on PR's earlier because having a short time frame introduces the opportunity to make mistakes or miss test cases....which I probably have...

Thanks for reading! :)
Data Structures And Algorithms For Not So 'Algorithmic' Languages 2: Merge Sorted Array(Easy)
Published: 2021-09-25 00:26:08

Hello everyone and I'm glad you are here. In our last post we did a basic intro to what algorithms are and what we aim to achieve with this thread. Today we will be looking at our first algorithm and that is the merge sorted algorithm.
In this algorithm you're given two integer arrays nums1 and nums2, sorted in non-decreasing order, and two integers m and n, representing the number of elements in nums1 and nums2 respectively.

Merge nums1 and nums2 into a single array sorted in non-decreasing order.

The final sorted array should not be returned by the function, but instead be stored inside the array nums1. To accommodate this, nums1 has a length of m + n, where the first m elements denote the elements that should be merged, and the last n elements are set to 0 and should be ignored. nums2 has a length of n. 

Basically you are to fill the first array up in non descending order with the values of nums1 and nums2. 

The easiest approach is to add the nums2 array value to the end of the array and use a sort function to sort them but that is an O(klogk) where k is the value of m + n. An optimal solution is to use the two pointer approach. Just add a pointer to the last element of nums1 and another to nums2 and compare the values. Add the higher value to the end of nums1 array and decrement the pointer of the array with the highest value. 

## here is the javascript code
````
    var merge = function(nums1, m, nums2, n) {
    p1 = m - 1; p2 = n - 1; i = m + n - 1;
    while(p2 >= 0) {
        if(p1 >= 0 && nums1[p1] > nums2[p2]) {
                nums1[i--] = nums1[p1--];
            } else {
                nums1[i--] = nums2[p2--];
            }
        }
    };
````

##And the php implementation
````
     function merge(&$nums1, $m, $nums2, $n) {
        $p1 = $m - 1; $p2 = $n - 1; $i = $m + $n - 1;
        while($p2 >= 0) {
            if($p1 >= 0 && $nums1[$p1] > $nums2[$p2]) {
                $nums1[$i--] = $nums1[$p1--];
            } else {
                $nums1[$i--] = $nums2[$p2--];
            }
        }
    }
````

So in our next post we will look at a medium difficulty question. If you got any questions or contributions hit me up in the comments. Happy coding!
How to add types to object properties using an interface in TypeScript?
Tags: typescript
Published: 2021-09-25 00:00:00

---
  title: How to add types to object properties using an interface in TypeScript?
  published: true
  tags: TypeScript
  date: Sat Sep 25 2021 05:30:00 GMT+0530 (India Standard Time)
  canonical_url: https://melvingeorge.me/blog/add-types-to-object-properties-using-interface-typescript
  cover_image: https://melvingeorge.me/_next/static/images/main-4b03d551e429f413cd436e1969c50b18.jpg
  ---
  [Originally posted here!](https://melvingeorge.me/blog/add-types-to-object-properties-using-interface-typescript)
  
To add types to the object properties using the `interface` declaration, we can start by first writing the keyword `interface` followed by the name you want to give to the interface and then the `{}` symbol (open and closed curly brackets).

Inside the brackets, we can type out the name of the property followed by the `:` symbol (colon) and then the type you want to assign to the property and finally to end the property type declaration we can use either the `;` symbol (semi-colon) or the `,` symbol (comma).

### TL;DR

```ts
// Person interface
interface Person {
  name: string;
  age: number;
}

// a simple object with properties
// with interface Person added
let person: Person = {
  name: "John Doe",
  age: 23,
};
```

To understand it a little better, let's say we have an object called `person` with properties called `name` and `age` with values of `John Doe` and `23` respectively like this,

```ts
// a simple object with properties
let person = {
  name: "John Doe",
  age: 23,
};
```

This is fine. But what if we want to have much more strictness over the types each property should hold. To do that, let's use the `interface` declaration in TypeScript.

First, let's declare an `interface` called `Person` (NOTE: don't get confused between the object `person` and interface `Person`) and add types for each of the properties the `person` object is going to hold.

In our case, the `name` property should have a value of `string` type and the `age` property should have a value of `number` type.

It can be done like this,

```ts
// Person interface
interface Person {
  name: string;
  age: number;
}

// a simple object with properties
let person = {
  name: "John Doe",
  age: 23,
};
```

Now, let's add interface `Person` to the `person` object. An `interface` is added to object after variable name followed by `:` symbol (colon).

It can be done like this,

```ts
// Person interface
interface Person {
  name: string;
  age: number;
}

// a simple object with properties
// with interface Person added
let person: Person = {
  name: "John Doe",
  age: 23,
};
```

Now we have a more strict and typed `person` object which is exactly what we need. Yay 🎉!

See the above code live in [codesandbox](https://codesandbox.io/s/add-types-to-object-properties-using-interface-in-typescript-cpvhx?file=/src/index.ts).

That's all 😃!

### Feel free to share if you found this useful 😃.

---
DevOps Careers Q&A Replay
Tags: devops, qna
Published: 2021-09-26 08:47:48

---
title: DevOps Careers Q&A Replay
published: true
date: 2021-09-25 00:00:00 UTC
tags: devops,qna
canonical_url: https://jhall.io/archive/2021/09/25/devops-careers-qa-replay/
---

On Thursday I did a live Q&A session on the topic of DevOps Careers, and now you can [watch the replay](https://www.crowdcast.io/e/tiny-devops-qa-focus-on). We had a small crowd, but that made for some intimite conversation. Even so, we had some some great questions:

- What are red flags in job ads about DevOps?
- How can I best prepare for an interview?
- What can I do to prepare for a DevOps director level role?
- How do we cope with the expectation that we need to be learning new technologies all the time?

And at the end, we had some bonus chat about DevOps freelancing, and differences between the U.S. freelance market and the European freelance market.

[![](https://jhall.io/archive/images/replay-button.png)](https://www.crowdcast.io/e/tiny-devops-qa-focus-on)

* * *
_If you enjoyed this message, [subscribe](https://jhall.io/daily) to <u>The Daily Commit</u> to get future messages to your inbox._
Initial Pull Requests
Tags: opensource, osd600, github
Published: 2021-09-24 23:57:34


This week, I continued working with Git and Github to learn the basics of pull requests, code reviews and more. I collaborated with [Tue Nguyen](https://github.com/TueNguyen2911) to add functionality to his Static Site Generator: [tue-1st-ssg](https://github.com/TueNguyen2911/tue-1st-ssg).

### Making a contribution
I added support for **Markdown** files and sent a [pull request](https://github.com/TueNguyen2911/tue-1st-ssg/pull/11) for him to review. Luckily he liked my code and merged it into his repository.

After chatting with Tue on Slack, he suggested that I could still make improvements in the code I wrote, such as removing unnecessary "if statements". For example, for getting **bold** text into the tags `<b></b>` I wrote:
```js
if(param.match(/\*\*([^\*]+)\*\*/)) {
  param = param.replace(/\*\*([^\*]+)\*\*/g, "<b>$1</b>")
}
```
It's one of those mistakes that are more apparent for someone reviewing the code than for the person spending hours fighting with Regex on [regex101.com](http://regex101.com) (aka me!)

I quickly made the changes he suggested, after which I sent another [pull request](https://github.com/TueNguyen2911/tue-1st-ssg/pull/13).

### Receiving a PR

While I was working on Tue's project, he was busy adding Markdown features on my [static-dodo](https://github.com/menghif/static-dodo) project. He sent me a [pull request](https://github.com/menghif/static-dodo/pull/12) and I got started reviewing it. I noticed that the program was working only with Markdown files inside a directory when that directory was selected as input like:
`./static-dodo -i ./directory`
but it did not work when a Markdown file was selected directly as input:
`./static-dodo -i ./directory/file.md`

I commented on the PR and the next day Tue had updated it and everything was ready to be merged. I am happy that my [static-dodo](https://github.com/menghif/static-dodo) project is slowly improving and that it has become a group effort. It was my first time receiving a Pull Request and it was a great learning experience to get more comfortable with the GitHub interface.


Doing this exercise made me appreciate the fact that writing code, especially in open source, will always be a work in progress, and that there will always be opportunities to improve and identify those sneaky bugs 🐛 along the way.
Falling in love with writing code
Tags: beginners, codenewbie, decodingcoding
Published: 2021-09-24 22:59:04

---
title: Falling in love with writing code
published: true
description: How DHH talking about Ruby got me wanting to fall in love with the craft of coding
tags: beginners, codenewbie, decodingcoding
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8zoz499y6hh449721v02.jpg
---

I was listening to the [Rework podcast](https://overcast.fm/+JpthjPWSI) by the folks at Basecamp, and something that @DHH (co-founder of Basecamp, and creator of Ruby on Rails) said made me sit up.

He talked about how he started on Ruby, from an initial curiosity, to deciding to spend a couple of weeks trying it out when he was first building out Basecamp, and then eventually feeling like wanting to write Ruby code when he wakes up, just because he enjoys the elegance of the language. 

In other words, he just described how he fell in love…with his craft like it was a person.

I was fascinated, in awe and to be completely honest, slightly envious. Even a tinge of jealousy.

Because I want that. I want to wake up everyday and feel like I want to keep doing this work, get better at my craft as an entrepreneur, programmer, maker, marketer, etc. I also want to enjoy coding the same way he does. The pure simplicity and clarity of that desire, that enjoyment…still eludes me. Right now for coding, I feel like I’m driving for the first time, clumsily bumping from one roadblock to another, and barely making it through to my destination. It’s hard to describe the experience as enjoyable. I’m only grateful to ‘survive’ and to launch something.

But hearing his love story with Ruby inspired me to want that for myself. To try to work towards that, somehow. I don’t know how, but hazarding a guess, I think it simply involves more coding, and trying to take joy in the little things, not just the end product.    

Just like dating, and slowly falling in love.

---

Follow my daily writings on [Lifelog](https://golifelog.com/goals/30), where I write about learning to code, goals, productivity, indie hacking and tech for good.