Skip to content

Instantly share code, notes, and snippets.

View hmowais's full-sized avatar
🎯
Focusing

HM Owais hmowais

🎯
Focusing
  • Karachi, Pakistan
View GitHub Profile
@hmowais
hmowais / index.html
Last active October 24, 2024 15:42
Light Mode / Dark Mode Toggle Slider
<label id="toggle_mode" class="switch" for="checkbox">
<input type="checkbox" id="checkbox" />
<div class="slider round"></div>
<span class="mode_text">Light Mode</span> <!-- Default text -->
</label>
<style>
html, body {
overflow-x: hidden;
transition: background-color 0.3s, color 0.3s; /* Smooth transition */
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"></script>
<script src="https://leafletjs.com/examples/choropleth/us-states.js"></script>
<script>
document.addEventListener("DOMContentLoaded", function() {
var map = L.map('map', {
center: [37.8, -96],
zoom: 5,
minZoom: 5,
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"></script>
<script src="https://leafletjs.com/examples/choropleth/us-states.js"></script>
<script>
document.addEventListener("DOMContentLoaded", function() {
var map = L.map('map', {
center: [37.8, -96],
zoom: 5,
minZoom: 5,
@hmowais
hmowais / script.js
Created August 9, 2024 17:38
Custom Map with Popup and Hover in Webflow
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"></script>
<script src="https://leafletjs.com/examples/choropleth/us-states.js"></script> <!-- US States GeoJSON -->
<script src="https://unpkg.com/leaflet-ajax/dist/leaflet.ajax.min.js"></script> <!-- For loading external GeoJSON -->
<script>
document.addEventListener("DOMContentLoaded", function() {
var map = L.map('map', {
center: [37.8, -96],
zoom: 5,
minZoom: 5,
@hmowais
hmowais / functions.php
Created July 26, 2024 13:51
Post Sync to other website with REST API
<?php
// Website 1
/* API for Post Sync */
function send_post_to_campus($post_id) {
if (wp_is_post_revision($post_id)) {
error_log('Skipping post revision ID: ' . $post_id);
return;
@hmowais
hmowais / body
Created July 22, 2024 16:03
Custom Map with Popup in Webflow
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"></script>
<script src="https://leafletjs.com/examples/choropleth/us-states.js"></script> <!-- US States GeoJSON -->
<script src="https://unpkg.com/leaflet-ajax/dist/leaflet.ajax.min.js"></script> <!-- For loading external GeoJSON -->
<script>
$(".get-my-src").each(function() {
var src = $(this).attr("src");
var customHrefWrapper = "<a href='" + src + "' target='_blank'></a>";
@hmowais
hmowais / functions.php
Created July 16, 2024 12:10
Add to Calender for WordPress Shortcode
<?php
/* Event Add to Calendar Shortcode */
// Shortcode function to display Events
function display_events() {
ob_start();
// Get the current post ID
$current_post_id = get_the_ID();
@hmowais
hmowais / jquery.js
Last active July 5, 2024 15:17
US Map with Jquery HTML, CSS
jQuery(document).ready(function ($) {
var $detailsBox = $('#details-box');
var $detailsImg = $('#details-img');
// var $detailsName = $('#details-name');
// var $detailsText = $('#details-text');
// var $detailsLink = $('#details-link');
$(document).on('mouseover', 'path', function (e) {
var imgSrc = $(this).data('img'); // Fetching data-img attribute from hovered path
// var textContent = $(this).data('name'); // Fetching data-text attribute from hovered path
@hmowais
hmowais / custom.liquid
Created April 25, 2024 16:11
Get Menu list in shopify code
<div class="sidebar-menu">
<h2>Categories</h2>
<ul class="footer-menu-list">
{% for link in linklists.collection-menu.links %}
<li class="custom-menu-item {{ link.title }}"><a href="{{ link.url }}">{{ link.title }}</a></li>
{% endfor %}
<li class="vieW_more"><a href="/collections/all">View More</a></li>
</ul>
</div>
@hmowais
hmowais / functions.php
Last active February 21, 2024 06:44
Get User Role Field in Woocommerce Product
<?php
// Add meta box to Products post type
function add_product_user_role_meta_box() {
add_meta_box(
'product_user_role_meta_box',
'User Role',
'render_product_user_role_meta_box',
'product',
'side',