teleren/devto huggingface dataset:
Cheat-Sheets 📄 for must-know as Developer 🚀
Tags: webdev, programming, productivity, python
Published: 2023-02-01 00:14:13

## Introduction

- Cheat-sheets for developers are invaluable tools to have in your arsenal. 

- They provide quick and easy access to vital information that can help you solve problems quickly and efficiently, saving time and energy. 

- Cheat-sheets are especially useful when learning a new programming language or framework, as they allow developers to quickly reference the syntax of functions or commands without having to look them up every time. 

- The great thing about cheat-sheets is that they come in many different forms so there’s bound to be one out there that fits your needs perfectly. 

- From printable PDF documents with all the essential information laid out on one page, 
through browser extensions which offer searchable snippets of code from multiple sources at once - no matter what type of developer you are, chances are good you'll find something suitable for your needs! 

- Finally, it's worth noting how important it is not only just use cheat-sheets but also to take the time now and then to review their content thoroughly.

- This will ensure any knowledge gaps get filled before they become an issue down the line! 

- Keeping a few handy references close by can make all difference between getting stuck on a problem forever versus solving it right away happy coding everyone!


###### 7 MUST HAVE Cheatsheets for Developers - Want to be a pro?

🎥 {% youtube G_Ewv9Jq8xo%}


#### Bonus

###### 7 🔥 programming repos you'll wish you knew sooner 👩‍💻

🎥 {% youtube 6y8tCoaypg0%}


### Connect with Me 😊

#### 🔗 Links

[![linkedin](https://img.shields.io/badge/linkedin-0A66C2?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/mahmoud-el-kariouny-822719149/)

[![twitter](https://img.shields.io/badge/twitter-1DA1F2?style=for-the-badge&logo=twitter&logoColor=white)](https://twitter.com/Mahmoud42275)
Make a simple Command Bus in PHP
Published: 2023-02-01 00:03:01

### What is a Command Bus?
A command bus is a design pattern used to manage and execute commands in a PHP application. It acts as a central dispatch mechanism for sending and handling commands, making it easier to manage the flow of requests in a system.

In a command bus architecture, commands are objects that represent a specific request or action that needs to be performed. The command bus is responsible for receiving these commands and forwarding them to the appropriate handler for execution. The handler is a class that implements the logic for a specific type of command, and it returns the result of the command execution to the bus.

### Here's a simple example of a command bus in PHP:
```
<?php
interface CommandBus {
    public function handle(Command $command);
}

class SimpleCommandBus implements CommandBus {
    private $handlers = [];

    public function registerHandler(string $commandName, callable $handler) {
        $this->handlers[$commandName] = $handler;
    }

    public function handle(Command $command) {
        $handler = $this->handlers[get_class($command)];
        $handler($command);
    }
}

class DepositCommand {
    private $amount;

    public function __construct(float $amount) {
        $this->amount = $amount;
    }

    public function getAmount(): float {
        return $this->amount;
    }
}

class DepositCommandHandler {
    public function handle(DepositCommand $command) {
        // Deposit the funds
    }
}

$commandBus = new SimpleCommandBus();
$commandBus->registerHandler(DepositCommand::class, [new DepositCommandHandler(), 'handle']);

$commandBus->handle(new DepositCommand(100.0));
php?>
```

In this example, the `SimpleCommandBus` implements the `CommandBus` interface and acts as the central dispatch mechanism for commands. The `DepositCommand` represents a request to deposit funds, and the `DepositCommandHandler` implements the logic for handling the deposit request. The external code sends the command to the command bus, which forwards it to the appropriate handler for execution. 

### Conclusion
The command bus provides a clear and organized way to manage the flow of requests in the system, making it easier to maintain and extend.
Loading environment values into PHP classes
Tags: library, php, opensource
Published: 2023-02-01 20:40:26

---
title: Loading environment values into PHP classes
published: true
date: 2023-02-01 00:00:00 UTC
tags: library,php,opensource
canonical_url: https://diar.dev/blog/env-library-reading-environment-values-into-php-classes
---

Load environment variables with this library into php classes, easy to use and test, you can easily contribute to this open source project, code logic is very small and there is no learning curve.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r3abex47ky3po248an0n.png)
App Dev 2 Learning JS
Published: 2023-01-31 23:41:25

JS provides some new functionality including ternaries as a short-cut for conditionals. There are some differences though. For conditionals, I need to add breaks for "switch" language--similar to case when in SQL. 
Variables also have more types now (var, let, const) each with its own meaning. It seems most of the time will want to use let and const in order to protect against some of the out-of-order functionality of var.

Objects work somewhat similarly to hashes where store values with keys. Objects don't, however, preserve order--when this is necessary arrays are likely preferrable. Maps are another option that are more flexible than objects in how keys can be stored--there is also a forEach functionality similar to Ruby.

Some of the function pieces are what I think I am still struggling with most--in particular using nested functionality to allow a variable created in the outer function to update based on repeated calls of the function. The creation of partials is also somewhat new to me and something I'll need to play with more.
Big Query
Tags: bigquery, googlecloud, sql, database
Published: 2023-01-31 23:18:08

What is Big Query?

Big query is a Google product mainly used for analyzing and querying big data in the google cloud platform.

Getting started with big query

1. Create a google account [Click here ](https://account.google.com)
2. Go to the  google cloud platform [Click here](https://cloud.google.com/)
3. Enable Big Query Sandbox to use the free version [Click here](https://cloud.google.com/bigquery/docs/sandbox)
4. Click on the SQL Workspace [Click here](https://console.cloud.google.com/bigquery?project=big-query-376323&ws=!1m0)

Hurray you are ready to use big query as a data analyst

For further learning  apply on Coursera  [Google Data Analytics Professional Certificate](https://www.coursera.org/professional-certificates/google-data-analytics)

In my subsequent post, we would practice uploading the dataset into big query and using the existing public dataset available in the Google Cloud.

Happy Learning!!!!
#DEVDiscuss: to Specialize or to Generalize?
Tags: devdiscuss, career, beginners
Published: 2023-01-31 23:02:39

*image created by [Margaux Peltat](https://www.patreon.com/margauxpeltat) for the [Chilled Cow YouTube channel](https://www.youtube.com/watch?v=lTRiuFIWV54)* 

Time for #DEVDiscuss — right here on DEV 😎

{% embed https://dev.to/codewithvoid/career-question-to-specialize-or-not-to-specialize-dfd %}

Inspired by @codewithvoid's Top 7 post, tonight’s topic is...should you specialize or generalize as a developer? 🤔

---

Questions:
- **Have you chosen to specialize or generalize as a developer?**
- **What are the pros and cons of your approach?**
- **What are the pros and cons of the _other_ approach?**
- **Any triumphs, fails, or other stories you'd like to share on this topic?**
Scrimba's JavaScript Deep Dive - Part IV
Published: 2023-01-31 22:52:25

Array & Sets
- More flexible than Objects
- `indexOf`= -1 means the value does not exist in the array. We can use `includes` or `some` (like callback functions). We also have `every` to review a condition in all elements of the array
- map method return an array of the same length, if we want a subset of the array, we can use the method `filter`. But if there is not element matching, we will get an empty array. 
- Also we can use `reduce` can also be used, but need more arguments. This is the most powerful method for arrays
- push to add elements to array, but it will replicate to other arrays with reference (as array is a subtype of objects). We can use `concat` to copy and add values, or use spread operators to clone arrays and `slice`
- `object.keys()`: allow to generate an array and use the key names
- Set don't count equal elements,  unless they are in [i], as they will be arrays. We can use this method to find the unique data sets
- Array methods: map(), filter(), reduce(), some()/every(), find()/findeIndex(), forEach(). Plus: slice(), concat(), includes() + spread. Use the best for each case, that makes the code easier to write and follow
Why l chose Apollo over React Query
Tags: programming, beginners, react, frontend
Published: 2023-01-31 22:49:45

React Query specializes in working with REST APIs while Apollo Client is a comprehensive GraphQL client that can be used on any GraphQL server.

** Apollo Client**
**Working with GraphQL**

If you’re looking to create a React application that consumes data from a GraphQL server, Apollo Client is your go-to solution. Offering an impressive array of features, its powerful and flexible API makes executing queries and mutations easy. Moreover, its ability to handle local state management as well as real-time updates makes it perfect for anyone working with GraphQL.

**Applications that need real-time data updates**

Apollo Client’s support for instant updates, together with its management of the local state makes it an ideal choice for applications requiring real-time data or intricate modifications. Its flexible API permits you to quickly refresh the UI as information alters, guaranteeing that your application is ever timely and presentable.

**Larger projects or teams**

Apollo Client’s advanced API and compatibility with any GraphQL server make it the perfect choice for larger projects or teams that require a more extensive solution to manage data. If your project is on a bigger scale or you’re able to take advantage of extra resources, Apollo Client can be an incredibly valuable tool in building sophisticated, expansive applications.

 However, you may also need to know about **React-Query** , I am here for you too.

**Working with REST APIs**

React Query is a perfect choice when constructing a React application that utilizes data from REST APIs. Its easy-to-use API and integrated pagination, refetching, and error-handling features make it effortless to work with REST APIs while making your app fast-loading and responsive.

Applications that need fast, real-time data updates

React Query’s reactive programming model means that components automatically re-render when the data they depend on changes. This can be especially useful for applications that need to display real-time data, as it allows you to easily update the UI as data changes.

**Small and medium projects**

React Query makes it incredibly convenient and hassle-free to get your project up and running quickly. Its minimalistic API and lightweight design make it the perfect choice for small or medium projects where resources may be limited, making Apollo Client an overkill solution. If you need something that can help you save time while still providing powerful features, React Query is what you’re looking for.

So in short, your choice depends on the type of project you are working on.
Enjoy!
Thoughts on feedback
Tags: feedback, growth, career
Published: 2023-01-31 19:12:02

---
title: Thoughts on feedback
published: true
description: Thoughts on feedback, the really short version.
tags: feedback, growth, career
canonical_url: https://codegazerants.com/2022/10/15/thoughts-on-feedback/
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-01-31 19:06 +0000
---

Thoughts on feedback, the really short version.

Feedback is difficult and needs a lot of practice. Why? Because emotions are involved.

There are two parts to becoming better at it. The rules are simple, but it's hard to live by.

## Receiving Feedback
To get feedback, you need to be and also look open to feedback. If your face changes and you start being defensive - even if you have counter arguments - when someone gets out of their way to give you some feedback, there is a chance they won't do it again. And yes, we've all been there.

* Listen to what the other person has to say, even if you disagree.
* Ask questions to understand more about the situation. Keep notes.
* Thank the person for the feedback. They've given some thought, time and care about you.
* Sleep on it.
* Act if needed.

And yes, ask for direct feedback like hell! I usually mention to the people around me that even if their feedback "hurts" me, at the end of the day, if it's constructive, it will make me better. It's going to make me grow.

## Giving Feedback
There is a strong possibility you have some feedback about people, but you are hesitant to share it because you are afraid of how the other person will feel and how it might make you look like not a good person.

* Be empathetic, respectful and direct.
* Try not to judge, but describe a situation and its effect.
* Be precise and provide examples, don't be vague.

I'll let you in on a secret. Everything about providing feedback ends when you do it. After that, It's the other person's job to filter and evaluate the input. There is no need to convince or be convinced about anything.

You can't imagine how fulfilling it is to hear an honest "Thank you for pointing this out. I wasn't aware of that" after providing hard feedback.

One last note. I was lucky enough to be introduced to [Radical Candor](https://www.radicalcandor.com/radical-candor-not-brutal-honesty/) and [SBI (Situation Behaviour Impact) model](https://www.ccl.org/articles/leading-effectively-articles/closing-the-gap-between-intent-vs-impact-sbii/) a few years ago, which helped me improve the way I use feedback. So it's my turn now to urge some people to give these resources a try if they haven't already.

Originally posted on https://codegazerants.com/2022/10/15/thoughts-on-feedback/
Day 685 : Dial Back
Tags: hiphop, code, coding, lifelongdev
Published: 2023-01-31 22:05:35

_liner notes_:
- Professional : Had a quick meeting with the team, then another one with my manager to plan out the sprint. Needed to deploy a server to test out some code I was updating for a demo. The last one isn't working anymore. I think I have to pay or something. haha I was able to get it deployed to another place with no problem. I tested my code and everything worked. I updated the readme file also to be clearer and more accurate. Pushed the changes and made a PR to be reviewed and hopefully merged. Started on another demo application to update. And the cycle continues. haha

- Personal : Last night, I went through some tracks for the radio show. I also did mockups for the different pages for my side project. Seeing how things are laid out and what data I'll have and need, really helps me dial back any wild ideas and make sure everything is as performant as possible. Ended the night watching an episode of "Vinland Saga". I also picked up a couple of Audiobooks. Let's see if I actually listen to them. haha I may listen to them to help me go to sleep.

![Overhead view of a forest with very tall green trees Lake Brienz, Switzerland going right to the edge next to some water](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/krfqlpcnwnli45r41dpm.jpg)

Tonight, I want to go through more tracks and finish up the mockup for the admin section of my side project. If I can get that done early enough, I want to see how far I can get coding up the admin section. Also, still need to watch "You People". Maybe I'll save it for this weekend after the radio show.

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube D4UsM-gJBr4 %}
AWS Cloud Quest: Deploying APIs Gradually Study Note
Tags: aws, cloud
Published: 2023-01-31 21:48:30

This is the DIY challenge of the Deploying APIs Gradually task in AWS Cloud Quest.

### DIY Steps:
1. Change `app.py` to the following
    ```
    import json
    def lambda_handler(event, context):
        return {
            "statusCode": 200,
            "body": json.dumps({
                "message": "diy",
                "new_attribute": "I am a canary deployment"
            }),
        }
    ```
2. Change SAM template `template.yaml` `DeploymentPreference` to `Linear10PercentEvery1Minute`
    ```
  AWSTemplateFormatVersion: '2010-09-09'
    Transform: AWS::Serverless-2016-10-31
    Description: >
      MyAPI
    
      Sample SAM Template for MyAPI
    
    # More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst
    Globals:
      Function:
        Timeout: 3
    
    Resources:
      HelloWorldFunction:
        Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
        Properties:
          CodeUri: hello_world/
          Handler: app.lambda_handler
          Runtime: python3.7
          AutoPublishAlias: diy
          DeploymentPreference:
            Type: Linear10PercentEvery1Minute
          Architectures:
            - x86_64
          Events:
            HelloWorld:
              Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
              Properties:
                Path: /hello
                Method: get
    
    Outputs:
      # ServerlessRestApi is an implicit API created out of Events key under Serverless::Function
      # Find out more about other implicit resources you can reference within SAM
      # https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api
      HelloWorldApi:
        Description: "API Gateway endpoint URL for Prod stage for Hello World function"
        Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/hello/"
      HelloWorldFunction:
        Description: "Hello World Lambda Function ARN"
        Value: !GetAtt HelloWorldFunction.Arn
      HelloWorldFunctionIamRole:
        Description: "Implicit IAM Role created for Hello World function"
        Value: !GetAtt HelloWorldFunctionRole.Arn
```
3. SAM build and deploy
    ```
    sam build
    yes | sam deploy
    ```
Day 2
Tags: devjournal, beginners
Published: 2023-01-31 21:42:36

We had a whirlwind introduction to HTML, Github, and GitPod. In one day, we coded a [very simple website](https://msmithivasappde-rpshtml-bsuqc0816ja.ws-us84.gitpod.io/). 

I've dabbled in manual coding of HTML before, and it was a lightning refresher in the basic tags every website contains. Tomorrow we'll plunge into CSS, which will be something completely new to me.

I'm glad that I finally cracked open Github. That was a very intimidating site that I used before to download other people's code, but never my own.

We are running at a very fast pace, or maybe I need more coffee... ;)
Top 7 Featured DEV Posts from the Past Week
Tags: top7
Published: 2023-01-31 21:35:03

---
title: Top 7 Featured DEV Posts from the Past Week
published: true
description: A round up of the most-read and most-loved contributions from the community this past week
tags: top7
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zkihck6o31qzhnx5u7lm.jpg
---

_Every Tuesday we round up the previous week's top posts based on traffic, engagement, and a hint of editorial curation. The typical week starts on Monday and ends on Sunday, but don't worry, we take into account posts that are published later in the week._ 

## Should Developers Specialize or Generalize?

After 86 Twitter replies, @codewithvoid is ready to summarize the arguments for and against specializing and generalizing. Check out the poll results here!

{% embed https://dev.to/codewithvoid/career-question-to-specialize-or-not-to-specialize-dfd %}


## Optimal Images in HTML

It can seem pretty straightforward to just add your images in using background-image, but @steve8708 shares how you can better optimize your images for performance in this post.

{% embed https://dev.to/builderio/optimal-images-in-html-5bg9 %}


## Things to Do and Not Do During a Wave of Tech Layoffs

Meta, Amazon, Microsoft, and Google have all announced massive layoffs and many of us are affected. With this helpful advice from @codepo8, we're encouraged to handle the situation as gracefully as can be. 

{% embed https://dev.to/codepo8/things-to-do-and-not-to-do-during-a-wave-of-tech-layoffs-26bd %}


## The Quest for REST

In the current literature, REST is generally promoted as the best thing since sliced bread. Here, @nfrankel focuses on listing some of the issues with REST and provides hints at ways to solve them.

{% embed https://dev.to/nfrankel/the-quest-for-rest-192i %}


## Creating the Effect of Traveling Through Space

With a bit of math and a trick using perspective, you too can be flying amongst the stars. @eyudinkov shares how to create the effect of traveling through space using JavaScript and Canvas. 

{% embed https://dev.to/eyudinkov/creating-the-effect-of-traveling-through-space-mfg %}


## Essential Design Patterns in Java

Design patterns are reusable solutions to common software design problems. They provide a way to organize and structure code in a consistent and efficient manner. Here, @cliffsilla breaks down some of the most common patterns. 

{% embed https://dev.to/cliffsilla/essential-design-patterns-in-java-2pgd %}


## Why I Decided to Invest in My Portfolio as a Junior Developer

With a portfolio, you have the opportunity to let others know what you're all about beyond just listing off your projects. As @viktoriabors says "It's not just about showing your technical skills, it's about telling a story and showcasing your personal development."

{% embed https://dev.to/viktoriabors/why-i-decided-to-invest-in-my-portfolio-as-a-junior-developer-428p %}


_That's it for our weekly Top 7 for this Tuesday! Keep an eye on dev.to this week for daily content and discussions...and be sure to keep an eye on this series in the future. You might just be in it!_