Skip to content

Instantly share code, notes, and snippets.

View muhammadawaisshaikh's full-sized avatar
💻
#codedWorld #dev

Muhammad Awais muhammadawaisshaikh

💻
#codedWorld #dev
View GitHub Profile
@muhammadawaisshaikh
muhammadawaisshaikh / AllFilms.tsx
Created April 24, 2024 10:31
graphql-apollo-react
import { useQuery } from '@apollo/client';
import { Link } from 'react-router-dom';
import { ALL_FILMS_QUERY } from '../queries/films';
const AllFilms: React.FC<any> = () => {
const { data, loading, error } = useQuery(ALL_FILMS_QUERY);
if (loading) return "Loading...";
if (error) return <pre>{error.message}</pre>
@muhammadawaisshaikh
muhammadawaisshaikh / app.js
Created July 14, 2022 19:06
animated gradient using css keyframe
// empty file
@muhammadawaisshaikh
muhammadawaisshaikh / scroll.scss
Created July 15, 2021 12:25
vertical scrollable section mixin
@mixin scroll-menu($width, $height, $padding, $margin, $background, $color) {
background-color: $background;
overflow: auto;
white-space: nowrap;
.item {
display: inline-block;
color: $color;
text-align: center;
padding: $padding;
margin: $margin;
@muhammadawaisshaikh
muhammadawaisshaikh / location.service.ts
Created July 3, 2021 15:47
getting location (lat, lng) using javascript
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class LocationService {
constructor() { }
// getting lat,lng - once
@muhammadawaisshaikh
muhammadawaisshaikh / api-service-usage.ts
Last active May 30, 2021 13:11
firebase CloudFirestore centralized api-service to consume CRUD methods of firebase from a single source of truth
// POST
createCategory() {
let data = {
name: this.programForm.value.categoryName
}
let request = this.api.post(this.config.collections.categories_table, data);
request.then(() => {
@muhammadawaisshaikh
muhammadawaisshaikh / app.module.ts
Created March 20, 2021 10:07
Implementing global loader Interceptor for Http Calls
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { HttpClientModule } from '@angular/common/http';
...
// for token interceptor
import { HTTP_INTERCEPTORS } from '@angular/common/http';
import { LoaderInterceptorService } from './core/interceptors/loader-interceptor/loader-interceptor.service';
@muhammadawaisshaikh
muhammadawaisshaikh / component.html
Created December 29, 2020 16:01
getting selected tree with parent nodes of 2 and three layered respectively
<div nz-row nzType="flex">
<div nz-col nzXs="24" nzSm="24" nzMd="24" nzLg="24" nzXl="24">
<p>*Sales Areas</p>
</div>
<div nz-col nzXs="24" nzSm="24" nzMd="24" nzLg="24" nzXl="24">
<label nz-checkbox formControlName="disableAreas">Disable Sales Areas</label>
<encore-tree-layered
Layers="3"
Heading="Sales Area Groups"
@muhammadawaisshaikh
muhammadawaisshaikh / component.html
Created September 28, 2020 13:16
Understanding DOM manipulation in Angular using @ViewChild, ElementRef
<div #child1>First Child</div>
<div #child2>Second Child</div>
<div #errors>2 Errors</div>
@muhammadawaisshaikh
muhammadawaisshaikh / app.module.ts
Created September 11, 2020 11:43
http interceptor angular
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { HttpClientModule } from '@angular/common/http';
// for token interceptor
import { HTTP_INTERCEPTORS } from '@angular/common/http';
@muhammadawaisshaikh
muhammadawaisshaikh / style.scss
Created June 21, 2020 03:27
change items color dynamically using scss loops
$base-color: rgb(239, 109, 172);
$gradiated-buttons-count: 10;
$strength: 5;
$degrees: 20deg;
.sidebar {
@for $i from 0 to $gradiated-buttons-count {
ul {
li:nth-child(#{$i}) {
img {