Skip to content

Instantly share code, notes, and snippets.

View belachkar's full-sized avatar
💻
Freelance

Ali Belachkar belachkar

💻
Freelance
View GitHub Profile

Tailwindcss SCSS directives

Fixation of Tailwindcss Error: Unknown at rule @tailwind.

  1. Add the the following Custom Data for CSS file css_custom_data.json.
  2. Declare it into the VSCode settings file.

.vscode/settings.json:

Angular keep fils on the build

Example of copying _redirects file from the root filder to the dist root folder on build time.

angular.json:

"assets": [
  "src/favicon.ico",
 "src/assets",

Angular interceptors

http-errors-interceptor.ts:

import {
  HttpEvent,
  HttpHandler,
  HttpInterceptor,
  HttpRequest,

RxJS - common use case

results: Observable<RedditResult[]>;
search: FormControl = new FormControl('');

constructor(ris: RedditImageSearchService) {
  this.results = this.search.valueChanges.pipe(
    map(search => search.trim()),
 debounceTime(200),
@belachkar
belachkar / before & after css.md
Last active November 8, 2021 02:40
::before & ::after css

::before & ::after

The content property

source code: codepen.io

index.html:

<h1 class="intro">Here is some generic content</h1>
@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

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);

CSS Logo changing color animation on hover

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

 to {
@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;