Skip to content

Instantly share code, notes, and snippets.

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

wpstorm esradev

🏠
Working from home
View GitHub Profile
@esradev
esradev / functions.php
Created February 19, 2025 08:53 — forked from LearnWebCode/functions.php
WordPress functions to fetch external JSON (and store in transient + option backup) and also functions to setup programmatic URL patterns and use custom template files for said URLs
function get_cached_external_json($url) {
$transient_key = 'our_fetched_json_' . md5($url);
$option_key = 'our_fetched_json_backup_' . md5($url);
$cached_data = get_transient($transient_key);
if (false !== $cached_data) {
return $cached_data;
}
@esradev
esradev / manage-servers.sh
Created December 19, 2024 10:14
manage-servers.sh
#!/bin/bash
# Function to start the services
start_services() {
echo "Starting Apache2 and MySQL..."
sudo systemctl start apache2
sudo systemctl start mysql
echo "Apache2 and MySQL started."
}
@esradev
esradev / install-wordpress.sh
Created December 16, 2024 19:41
install-wordpress.sh
# Gist: install_wordpress.sh
## Description
This script automates the process of setting up a new WordPress site on a server. It performs the following tasks:
1. Checks if a site name is provided as an argument.
2. Creates a MySQL database and user for the new site.
3. Sets up the web root directory.
4. Downloads and installs WordPress.
5. Configures the `wp-config.php` file with database details and security salts.
6. Configures Apache to serve the new WordPress site.
@esradev
esradev / vscode-settings.json
Created December 1, 2024 10:47
Visual Studio Code settings.json
{
"editor.fontFamily": "JetBrainsMono Nerd Font Propo, FiraCode Nerd Font, Cascadia Mono NF, monospace",
"editor.fontSize": 16,
"editor.fontLigatures": true,
"editor.lineHeight": 30,
"editor.tabSize": 2,
"editor.minimap.enabled": false,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.formatOnPaste": true,
@esradev
esradev / gist:10ff60e115d00287652c6122e178ab51
Last active February 1, 2024 23:42
wpstorm-typing-app-data
{
"en": [
"Programming is the art of instructing a computer to perform a task.",
"In the world of coding, algorithms are the building blocks of solutions.",
"A programming language is like a set of tools that developers use to create software.",
"Debugging is a crucial skill; finding and fixing errors is part of the coding process.",
"Object-oriented programming promotes code reusability and modular design.",
"Version control systems like Git help teams collaborate on software projects seamlessly.",
"Learning to code is not just about syntax; it's about problem-solving and logical thinking.",
"Web development involves creating websites and web applications using various technologies.",