Skip to content

Instantly share code, notes, and snippets.

View barmao's full-sized avatar

barmao barmao

  • 13:46 (UTC +03:00)
View GitHub Profile

SOLID principles with relatable examples in C# for beginners

Single Responsibility Principle (SRP)

  • A class should have only one reason to change, meaning it should have only one responsibility.

Example: Separate classes to handle user authentication and user data management.

public class UserAuthentication
{
    public bool Login(string username, string password)

Design patterns with relatable examples in C# for beginners

Singleton

  • Ensures only one instance of a class exists. For example, a single printer object shared by all users in an office, ensuring there's only one printer queue.
public class Printer
{
    private static Printer _instance;

Install PostgresSQL Linux

  1. Install PostgreSQL with the apt package manager, a postgres user is created during the installation.

    $ sudo apt install -y postgresql postgresql-contrib

  2. Switch to the postgres user.

    $ sudo su - postgres

@barmao
barmao / 01-directory-structure.md
Created December 22, 2022 16:06 — forked from tracker1/01-directory-structure.md
Anatomy of a JavaScript/Node project.

Directory structure for JavaScript/Node Projects

While the following structure is not an absolute requirement or enforced by the tools, it is a recommendation based on what the JavaScript and in particular Node community at large have been following by convention.

Beyond a suggested structure, no tooling recommendations, or sub-module structure is outlined here.

Directories

  • lib/ is intended for code that can run as-is
  • src/ is intended for code that needs to be manipulated before it can be used
@barmao
barmao / nodejs-cicd-github-actions.md
Created December 21, 2022 09:58 — forked from danielwetan/nodejs-cicd-github-actions.md
Deploy Node.js to VPS using Github Actions

Deploy Node.js to VPS using Github Actions

Steps to deploy Node.js to VPS using PM2 and Github Actions

1. Clone repo to VPS folder

@barmao
barmao / WeekIn.NET.20170314.md
Created November 19, 2022 23:59 — forked from bleroy/WeekIn.NET.20170314.md
Tips for the Week in .NET
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
@barmao
barmao / project-ideas01.md
Created June 14, 2022 14:19 — forked from MWins/project-ideas01.md
Back end Projects - list

Project Ideas

Ok. I'm going to list off some ideas for projects. You will have to determine if any particular idea is good enough to include in a portfolio. These aren't creative ideas. They likely already exist. Some are way too advanced while others are simplistic.

I will recommend to post any project you make to github and make a github project page for it. Explain in as much detail as possible how you made it, how it can be improved etc. Document it.

If you pick an advanced idea, setup a development roadmap and follow it. This will show some project management skills.

Another piece of advice for those who are design challenged. Use different front end frameworks and use different themes for those frameworks to provide appealing designs without looking like yet another bootstrap site.

@barmao
barmao / System Design.md
Created February 11, 2022 20:04 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@barmao
barmao / BinarySearchTree.cs
Created September 15, 2021 13:03 — forked from aaronjwood/BinarySearchTree.cs
Binary search tree implementation in C#
using System;
using System.Diagnostics;
namespace BinarySearchTree
{
class Node
{
public int value;
public Node left;
public Node right;