Skip to content

Instantly share code, notes, and snippets.

View dhanar98's full-sized avatar
🎯
Focusing

Dhanasekaran Ravichandran dhanar98

🎯
Focusing
View GitHub Profile
@dhanar98
dhanar98 / 503.blade.php
Last active January 28, 2024 15:57
Laravel Customized Maintenance Mode
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}" class="h-full">
<title>{{ config('app.name', 'Laravel') }}</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
<link rel="preconnect" href="https://fonts.bunny.net">
@dhanar98
dhanar98 / helper.php
Created January 15, 2024 16:33
Reading Time in Blog Post Using laravel Str:wordCount() Function In Helper
<?php
# Filename : app/helpers.php
use Illuminate\Support\Str;
if (!function_exists('calculateReadingTime')) {
function calculateReadingTime($content)
{
$word_count = Str::wordCount($content);
$reading_time = ceil($word_count / 200);
@dhanar98
dhanar98 / helper.php
Last active January 13, 2024 10:08
Send Telegram Notification or Message to Telegram Channel in Laravel Application in Custom Helper Function
<?php
use GuzzleHttp\Client;
use Illuminate\Support\Facades\Log;
function sendTelegramNotification($botKey,$chatId, $message) {
try {
$botToken = $botKey;
$apiEndpoint = "https://api.telegram.org/bot{$botToken}/sendMessage";
@dhanar98
dhanar98 / create-laravel-project.sh
Last active November 2, 2023 13:33
Building Your First Laravel Application using Bash Script Just giving Name - Database Support in MYSQL , Need Install Breeze Just giving Yes
#!/bin/bash
# Step 1: Install Composer if not already installed
if ! [ -x "$(command -v composer)" ]; then
echo "Composer is not installed. Installing..."
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php --install-dir=/usr/local/bin --filename=composer
php -r "unlink('composer-setup.php');"
fi
@dhanar98
dhanar98 / sitemap-fix.php
Created September 22, 2023 07:51
WordPress Sitemap Error - Error on line 2 at column 6: XML declaration allowed [FIXED]
<?php
function ___wejns_wp_sitemap_fix($arg) {
$allowed = false;
$found = false;
foreach (headers_list() as $header) {
if (preg_match("/^content-type:\\s+(text\\/|application\\/((xhtml|atom|rss)\\+xml|xml))/i", $header)) {
$allowed = true;
}
if (preg_match("/^content-type:\\s+/i", $header)) {
@dhanar98
dhanar98 / phalcon-installation-in-ubuntu.sh
Last active April 29, 2024 14:06
Install PHP 7.4 , Nginx and Install Phalcon Framework in Single Bash Script
#!/bin/bash
# Set DEBIAN_FRONTEND to noninteractive to avoid prompts
export DEBIAN_FRONTEND=noninteractive
# Update package list and upgrade existing packages
sudo apt update && sudo apt upgrade -y
# Install Nginx
sudo apt install nginx -y
@dhanar98
dhanar98 / phalcon.conf
Last active December 11, 2021 17:24
Phalcon Configuration for Nginx Server
server {
listen 80;
server_name localhost;
root /var/www/phalcon/public; #root_path
index index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?_url=$uri&$args;
}
@dhanar98
dhanar98 / nginx-server-management-commands.md
Created December 11, 2021 16:55
Nginx Server basic commands

To Start the Nginx Server

sudo systemctl start nginx

To Stop the Nginx Server

sudo systemctl stop nginx

To Restart the Nginx Server

@dhanar98
dhanar98 / apache-server-commands.md
Created December 5, 2021 17:33
Managing Apache Server Commands

To start the Apache server: sudo systemctl start apache2

To stop the Apache server: sudo systemctl stop apache2

To stop and then start Apache sudo systemctl restart apache2

To reload apache server to update the new configurations

@dhanar98
dhanar98 / SitelinksSearchbox.js
Created November 28, 2021 18:26
Sitelinks Searchbox in Next-seo
import { SiteLinksSearchBoxJsonLd } from 'next-seo';
const SiteLinksSearchBox = () => (
<>
<SiteLinksSearchBoxJsonLd
url="https://dhanar98.hashnode.dev/"
potentialActions={[
{
target: 'https://dhanar98.hashnode.dev/search?q',
queryInput: 'search_term_string',