Skip to content

Instantly share code, notes, and snippets.

View prantomollick's full-sized avatar
🎯
Focusing

Pranto Mollick prantomollick

🎯
Focusing
View GitHub Profile
@prantomollick
prantomollick / btoa(`svg`)
Last active January 26, 2025 13:17
convert svg to base64 using console of developer tool in browser (btoa)
btoa(`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M10 20C15.5229 20 20 15.5229 20 10C20 4.47714 15.5229 0 10 0C4.47714 0 0 4.47714 0 10C0 15.5229 4.47714 20 10 20ZM11.99 7.44666L10.0781 1.5625L8.16626 7.44666H1.97928L6.98465 11.0833L5.07275 16.9674L10.0781 13.3308L15.0835 16.9674L13.1716 11.0833L18.177 7.44666H11.99Z" fill="#FFDF8D"/>
</svg>
`)
"PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMCAyMEMxNS41MjI5IDIwIDIwIDE1LjUyMjkgMjAgMTBDMjAgNC40NzcxNCAxNS41MjI5IDAgMTAgMEM0LjQ3NzE0IDAgMCA0LjQ3NzE0IDAgMTBDMCAxNS41MjI5IDQuNDc3MTQgMjAgMTAgMjBaTTExLjk5IDcuNDQ2NjZMMTAuMDc4MSAxLjU2MjVMOC4xNjYyNiA3LjQ0NjY2SDEuOTc5MjhMNi45ODQ2NSAxMS4wODMzTDUuMDcyNzUgMTYuOTY3NEwxMC4wNzgxIDEzLjMzMDhMMTUuMDgzNSAxNi45Njc0TDEzLjE3MTYgMTEuMDgzM0wxOC4xNzcgNy40NDY2NkgxMS45OVoiIGZpbGw9IiNGRkRGOEQiLz
@prantomollick
prantomollick / utils.js
Created January 19, 2025 14:57
javascript-debounce-function-on-input-ajax-request
function debounce(func, wait, immediate) {
let timeout;
return function () {
const context = this;
const args = arguments;
const later = function () {
timeout = null;
if (!immediate) func.apply(context, args);
};
@prantomollick
prantomollick / laragon\etc\apache2\sites-enabled\00-default.conf
Last active January 19, 2025 14:59
Laragon Virtual Host Custom Path In Windows Operating System
<VirtualHost *:80>
ServerName name.localhost
ServerAlias name.localhost
DocumentRoot "drive:\theme\path\www"
<Directory "drive:\theme\path\www">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog "logs/dummy-host2.example.com-error.log"
@prantomollick
prantomollick / themes\woocommerce\single-product-reviews.php
Created January 8, 2025 14:24
Customer reviews for woocommerce
<?php
function dynamic_product_reviews_section() {
global $product;
// Get product data
$average_rating = $product->get_average_rating();
$review_count = $product->get_review_count();
$ratings_count = $product->get_rating_counts();
if ($review_count > 0): // Only show if there are reviews
@prantomollick
prantomollick / blog-post.php
Last active January 19, 2025 14:59
elementor-blog-post-widget | Blog Post Queries Based on Terms (categories) | Blog Post query in WordPress
<?php
namespace Aidzone_Core\Widgets;
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* Elementor Hello World
@prantomollick
prantomollick / docker-examples.md
Created April 23, 2018 21:35 — forked from thaJeztah/docker-examples.md
Some docker examples

Commit, clone a container

To 'clone' a container, you'll have to make an image of that container first, you can do so by "committing" the container. Docker will (by default) pause all processes running in the container during commit to preserve data-consistency.

For example;

docker commit --message="Snapshot of my container" my_container my_container_snapshot:yymmdd
@prantomollick
prantomollick / mysql-docker.sh
Last active January 19, 2025 14:58 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE