Skip to content

Instantly share code, notes, and snippets.

View belachkar's full-sized avatar
💻
Freelance

Ali Belachkar belachkar

💻
Freelance
View GitHub Profile

NodeJS MongoDB Connection Configuration

  • mongoose v14+

config.js:

const secretKey = 'XXXX-XXXX-XXXX-XXXX-XXXX';

// MongoDB Connection

Netlify React SPA Configuration

To avoid 404 error, and to redirect all the requests to index.html

Create _redirects file

create an _redirects file in the root of the deployed folder with the content:

/* /index.html 200

Eslint React Configuration

A simple example of .eslintrc configuration, with

  • max-len of 110 characters per line.
  • Parser babel-eslint for better support of new features.
  • Fix error: 'React' must be in scope when using JSX react/react-in-jsx-scope:

.eslintrc.json:

kubernetes docker installation prerequis

prérequis : installation de Docker

curl -fsSL https://get.docker.com | sh;
sudo usermod -aG docker $USER

groupadd -g 500000 dockremap && 
groupadd -g 501000 dockremap-user && 

Github workflow - CI, CD

Dart CI

.github/workflow/dart.yml:

name: Dart CI

on:
@belachkar
belachkar / React With Error Boundary.md
Last active August 22, 2021 02:11
React Implemantation of Error Boundary

React - Implemanting Error Boundary

hoc/WithErrBoundary/index.tsx:

import { Component, ComponentClass, ComponentType } from 'react';

interface State {
 hasError: boolean;

CSS Logo changing color animation on hover

/* Logo animation */
@keyframes color-rotate {
  from {
    filter: hue-rotate(0deg);
  }

 to {

Firebase Custom Hooks

hooks/useUser.js:

import { useEffect, useState } from 'react';

export const useUser = (auth) => {
  const [user, setUser] = useState(null);
  const [isLoading, setIsLoading] = useState(true);
@belachkar
belachkar / Dotenv makeup.md
Last active November 8, 2021 09:14
Dotenv file makeup example

Dotenv file makeup example

.env:

## For DEVELOPMENT
# - Rename this file to .env
# - Update the values

## For PRODUCTION