Skip to content

Instantly share code, notes, and snippets.

View belachkar's full-sized avatar
💻
Freelance

Ali Belachkar belachkar

💻
Freelance
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

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>
import React from 'react';
import moment from 'moment';
import Image from 'next/image';
import Link from 'next/link';
const FeaturedPostCard = ({ post }) => (
<div className="relative h-72">
<div className="absolute rounded-lg bg-center bg-no-repeat bg-cover shadow-md inline-block w-full h-72" style={{ backgroundImage: `url('${post.featuredImage.url}')` }} />
<div className="absolute rounded-lg bg-center bg-gradient-to-b opacity-50 from-gray-400 via-gray-700 to-black w-full h-72" />
<div className="flex flex-col rounded-lg p-4 items-center justify-center absolute w-full h-full">
@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);