Skip to content

Instantly share code, notes, and snippets.

View fahdi's full-sized avatar

Fahad Murtaza fahdi

View GitHub Profile
@fahdi
fahdi / Migrate a ghost website.md
Created March 30, 2024 09:31
Migrate a Ghost Website

Migrating a Ghost website from a development machine to a production environment involves several key steps. The exact process might vary depending on your specific setup, especially regarding your development and production environments, but the general approach is as follows:1. Backup Your Development SiteExport Content: Use the "Labs" section of the Ghost admin panel to export your content to a JSON file. This file includes all your posts, pages, tags, and settings.Backup Themes and Images: Manually copy your themes and images. Themes are typically located in the /content/themes/ directory, and images in the /content/images/ directory of your Ghost installation.2. Prepare the Production EnvironmentInstall Ghost: Ensure Ghost is installed on your production server. You can follow the official Ghost setup guide for various environments at the Ghost installation documentation.Setup Domain and SSL: Configure your domain and SSL certificate. Ghost CLI can automatically obtain a Let's Encrypt SSL certificate if

@fahdi
fahdi / ReadMe.md
Created January 24, 2024 04:44 — forked from ano/ReadMe.md
Formidable Forms Manage Entries Script

Introduction

A single page standalone PHP script to help manage formidable forms data in the front-end.

Usage

Add Entry

To add a see the URL below, note that

  • [z] is the id of the form
@fahdi
fahdi / um-to-sub.php
Last active December 4, 2023 20:57
Add Ultimate Member user to The Newsletter plugin on registration
<?php
add_action( 'um_after_save_registration_details', 'my_after_save_registration_details', 10, 2 );
function my_after_save_registration_details( $user_id, $submitted ) {
if ( isset( $submitted['newsletter_subscription'] ) && $submitted['newsletter_subscription'][0] === 'Yes' ) {
// Check if the user is not already subscribed
@fahdi
fahdi / embed-game.html
Last active November 28, 2023 20:04
Guess the number Embed
<embed type="text/html" src="https://fahdi.github.io/guess-the-number/" width="500" height="300">
@fahdi
fahdi / sticky-situation.css
Last active November 3, 2023 20:47
Ah, I understand now. If you want the .sticking to be applied when the header is touching the top (i.e., when its top is at the top of the viewport) and removed otherwise, you can check the getBoundingClientRect of the header.
.sticking {
box-shadow: none !important;
}
@fahdi
fahdi / lambda-size.txt
Created February 6, 2023 23:22
Conversation with ChatGPT about Lamba Functions.
You:
If we have lambda functions running on AWS how to we translate the sizing requirement to an onpremise setup?
ChatGPT:
Translating sizing requirements from a cloud-based AWS Lambda setup to an on-premise setup requires considering multiple factors, including the amount of memory and CPU resources required by the functions, the number of requests they receive, and the size of the data they handle. Here are some steps to consider:
1. Determine resource requirements: Evaluate the memory and CPU utilization of the Lambda functions in the cloud setup to determine the minimum amount of memory and CPU needed in the on-premise setup.
2. Calculate request volume: Estimate the number of requests the Lambda functions receive, including the frequency and duration of each request. This information will help you determine the amount of resources needed to handle the request volume.
3. Consider data storage: If the Lambda functions access or store data, you will need to consider the size of the data and determine how
@fahdi
fahdi / ellies_score-negative_index.py
Created February 6, 2023 23:14
Python Negative Indexes
class_name_test =[
["Jenny", 90],
["Alexus", 85.5],
["Sam", 83],
["Ellie", 101.5] # <---- [-1][-1]
# Can be done in many ways but that's not what they wanted
]
print(class_name_test)
@fahdi
fahdi / pemdas.py
Last active February 4, 2023 02:59
PEMDAS is an acronym used to help remember the order of operations in mathematics. It stands for: P: Parentheses E: Exponents MD: Multiplication and Division (performed left to right) AS: Addition and Subtraction (performed left to right) The order of operations is used to determine the sequence in which mathematical operations should be perform…
#PEMDAS
# PEMDAS is an acronym used to help remember the order of operations in mathematics. It stands for:
# P: Parentheses
# E: Exponents
# MD: Multiplication and Division (performed left to right)
# AS: Addition and Subtraction (performed left to right)
# The order of operations is used to determine the sequence in which mathematical operations should be performed to get the correct answer. When evaluating an expression, we start with the operations inside any parentheses, then exponents, then multiplication and division from left to right, and finally addition and subtraction from left to right. This helps to avoid ambiguity and ensures that the expression is evaluated consistently.
@fahdi
fahdi / bg-changer-js-events-example.markdown
Created January 26, 2023 03:16
BG Changer JS events example
@fahdi
fahdi / front-page.php
Created October 17, 2022 11:18
get_theme_file_uri example
<?php get_header();
?>
<div class="Home-Banner" style="background-image: url(<?php echo get_theme_file_uri('/images/HomeSection1.png') ?>);">
<div style="width:60%">
<h1 >We Are WordPress Website Creators</h1>
<button class="Hero-btn">Know More About Us</button>
</div>
</div>