Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Francesco Menghi
Francesco Menghi

Posted on

     

Hacktoberfest #1

Hacktoberfest is here! I hope to make some good contributions and I will be sharing my experience on this blog as I move along.

After spending way too much time looking for a "Good First Issue", I found one that seemed interesting for my first contribution of the month.

The project I found is a tool that creates beautiful Github user stats to add to your profile'sREADME. The project is calledgithub-readme-streak-stats and it's written mostly in PHP.

The issue

The tool not only allows you to output the Github stats as an image, but also as JSON. Theissue was that when an error occurred and the type was specified as JSON, the error output would still be an image instead of JSON.

The fix

ThePull Request I submitted included a fix for this problem. Here is what I added to the catch section of the code:

if($requestedType==="json"){// set content type to JSONheader('Content-Type: application/json');// echo JSON error messageechojson_encode(array("error"=>$error->getMessage()));exit;}
Enter fullscreen modeExit fullscreen mode

There was also another section where I added similar code to output a JSON error message. It took me some googling and some help from the project maintainer, since it was my first time working with PHP, but I am happy that my code worked and was merged!

Thoughts

What I really liked about this project was its documentation. They provided really easy and detailed instructions to get everything up and running. The only problem I had was related to a dependency called imagick. Installing it via Homebrew (macOS package manager) did not work so I was really happy when I found thisguide that helped me install it from source (Looks like the problem was due to the fact that I am using an M1 Mac).

This was a great start to Hacktoberfest and I'm surely looking forward to getting involved in other neat projects.

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

  • Location
    Toronto, Canada
  • Joined

More fromFrancesco Menghi

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp