Skip to content

Instantly share code, notes, and snippets.

View Arifursdev's full-sized avatar
🕷️

Arifursdev

🕷️
View GitHub Profile
@Arifursdev
Arifursdev / shopify-custom-pagination.liquid
Last active February 7, 2025 15:57
Shopify Custom Pagination
{% comment %} First page {% endcomment %}
{% comment %} [<] [1] 2 3 [>] {% endcomment %}
{% comment %} Second page {% endcomment %}
{% comment %} [<] 1 [2] 3 [>] {% endcomment %}
{% comment %} Third page {% endcomment %}
{% comment %} [<] 1 2 [3] [>] {% endcomment %}
{%- if paginate.parts.size > 0 -%}
<div class="blog-mb__pagination">
<div class="blog-mb__p-inner">
@Arifursdev
Arifursdev / add-metafields-on-wp-block-editor.md
Last active January 25, 2025 15:56
Add Metafields on WP BlockEditor
(function (wp) {
    
    const el = wp.element.createElement;

    if (!wp.plugins) {
        return;
    }
const repeatWithTimeout = (action, interval) => {
let timerId;
function repeat() {
action();
timerId = setTimeout(repeat, interval);
}
repeat();
@Arifursdev
Arifursdev / pagination-with-alpinejs.md
Last active December 18, 2024 11:55
Pagination with Alpine.js
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Pagination with Alpine.js</title>
    <script
      src="https://cdn.jsdelivr.net/npm/[email protected]/dist/cdn.min.js"
@Arifursdev
Arifursdev / load-wordpress-from-theme-folder.php
Created December 11, 2024 21:46
default location of wp-load from theme folder
<?php
require_once( dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) . '/wp-load.php' );
@Arifursdev
Arifursdev / upload_files_to_wordpress_php.php
Last active December 11, 2024 19:37
Upload files to WordPress PHP
<?php
$final_submission = [];
if ( isset( $_FILES['files'] ) && is_array( $_FILES['files']) && !empty( $_FILES['files'] ) ) {
$files = $_FILES['files'];
$allowed_file_types = ['image/jpeg', 'image/png', 'video/mp4'];
$max_file_size = 5 * 1024 * 1024; // 5MB
$max_files = 5;
class AdevScrollState {
constructor(element) {
this.scrollableEl = this.selectElement(element);
if (this.scrollableEl === null) return console.error("AdevScrollState: Element not found");
this.isScrollable = false;
this.isScrolled = false;
this.isAtTop = false;
this.isAtBottom = false;
@Arifursdev
Arifursdev / .htaccess
Last active December 7, 2024 10:50
.htaccess for WordPress Speed Optimization
# Directory access disable
<IfModule mod_autoindex.c>
Options -Indexes
</IfModule>
# Custom HTTP headers for specific file types.
<IfModule mod_alias.c>
<FilesMatch "\.(html|htm|rtf|rtx|txt|xsd|xsl|xml)$">
<IfModule mod_headers.c>
Header set X-Powered-By "WordPress/Adev"
@Arifursdev
Arifursdev / createFormDataFromArray.js
Last active July 11, 2024 12:22
createFormDataFrom Array
function adevCreateFormData(formData, key, data) {
if (data === Object(data) || Array.isArray(data)) {
for (var i in data) {
adevCreateFormData(formData, key + '[' + i + ']', data[i]);
}
} else {
formData.append(key, data);
}
}

WARNING: USE AT YOUR OWN RISK.

Create a folder on any disk, for example, D:\python_scripts and add that folder to the system environment variable path. create new file eg: 'xampp.py' in that folder.

paste this code and rename the xampp_path variable to the path where you have installed xampp.

import subprocess
import os
import time