Skip to content

Instantly share code, notes, and snippets.

View owaisahmed5300's full-sized avatar
🏠
Working from home

Owais ahmed owaisahmed5300

🏠
Working from home
View GitHub Profile
@owaisahmed5300
owaisahmed5300 / 1-class-geo-query.php
Last active April 29, 2024 11:31
WordPress WP Query GEO Query Support and Google Map AdvancedMarkerElement Example
<?php
/**
* Geo Query
*
* This class provides methods to perform geographical queries in WordPress,
* allowing users to filter posts based on geographical parameters like distance.
*
* @package WPSnippets
* @author Owaisansari53 <owaisansari666@yahoo.com>
*/
@owaisahmed5300
owaisahmed5300 / _colors.scss
Last active March 28, 2024 04:57
Material Design or Tailwind like SCSS Color Shades Generator.
// Check Usage in first Comment.
// Function to generate a series of color shades from a base color
@function tailwind-shades($base-color) {
// Initialize an empty map to store the shades
$shades: ();
// Define the scale for the shades
$scale: (50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950);
// Iterate over each value in the scale to generate shades
@owaisahmed5300
owaisahmed5300 / lampstack-docker-compose.yml
Last active April 13, 2024 14:06
Basic Configuration for Docker Lamp Stack & WordPress
version: '3.7'
services:
db:
image: mysql:latest
ports:
- 3307:3306
environment:
- MYSQL_USER=iamadmin
- MYSQL_PASSWORD=iamadmin
- MYSQL_ALLOW_EMPTY_PASSWORD=1
@owaisahmed5300
owaisahmed5300 / closeConnection.php
Created December 23, 2023 08:00 — forked from bubba-h57/closeConnection.php
Easy way to close connections to the browser and continue processing on the server.
<?php
/**
* Close the connection to the browser but continue processing the operation
* @param $body
*/
public function closeConnection($body, $responseCode){
// Cause we are clever and don't want the rest of the script to be bound by a timeout.
// Set to zero so no time limit is imposed from here on out.
set_time_limit(0);
@owaisahmed5300
owaisahmed5300 / InfiniteScroll.tsx
Last active November 13, 2023 09:12
React Infinite Scroll Typescript Intersection Observer
import {FC, ReactNode, useCallback, useEffect, useRef} from "react";
interface InfiniteScrollProps {
load: () => void;
hasMore: boolean;
loader: ReactNode;
children?: ReactNode;
endMessage?: ReactNode;
}
// Converting Twitter Bootstrap RFS mechanism into typescript to make it available for CSS in JS i.e. (styled components).
// Twitter Bootstrap RFS: https://github.com/twbs/rfs
// Javascript Approach: https://gist.github.com/supposedly/9b9f5de66c2bcbbf5d7469dcec50bfd7
// Usage
// import rfs from 'rfs';
// rfs( '20px', 'font-size' );
// rfs( '1.5rem', 'font-size' );
// rfs( '1rem', 'margin-bottom' );