Skip to content

Instantly share code, notes, and snippets.

View adeel-raza's full-sized avatar

Adeel adeel-raza

View GitHub Profile
@adeel-raza
adeel-raza / password_generator.php
Created November 3, 2023 16:09
PHP based password generator program
<?php
function generatePassword(
$length,
$useUppercase,
$useLowercase,
$useDigits,
$useSpecialChars
) {
$formats = [
"uppercase" => "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
@adeel-raza
adeel-raza / Install.html
Last active August 8, 2023 17:40
Self Host and Install Canvas LMS on Ubuntu Server in 2023
Canvas is a powerful open-source LMS that can be self-hosted on your own server. This is a detailed guide to help you Install Canvas LMS on Ubuntu using the Apache web server and enabling SSL for secure communication. Let's get started!
Caution: Before proceeding, make sure you have administrative access to your Ubuntu server by running "sudo su" and have basic knowledge of command-line operations. Canvas requires Ubuntu 20.04 LTS and a server with at least 8GB RAM. The steps below are quite technical and require a server administrator.
If it's technically challenging for you, allow us to help you set up with our Canvas Installation Service.
Step 1: Create a PostgreSQL user and databases for Canvas
Once you execute this command, it will ask for your server password and then, your canvas PostgreSQL password. Please note the later one as it will be used when we will edit the canvas database config file.
sudo apt-get install postgresql-12; sudo -u postgres createuser canvas --no-createdb --no-superuser --no-
@adeel-raza
adeel-raza / whatsapp-icon.html
Created June 14, 2023 16:33
Add a Contact Us WhatsApp icon on your website with a simple HTML CSS snippet
<!-- Add this HTML markup on your footer section -->
<a href="https://api.whatsapp.com/send?phone={ENTER YOUR PHONE NO HERE}&amp;text=Hi%20There" class="whatsapp_float" target="_blank" rel="noopener noreferrer">
<span class="home-whatsapp-icon"><svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="80" height="80" viewBox="0 0 80 80">
<path fill="#f2faff" d="M7.904,58.665L7.8,58.484c-3.263-5.649-4.986-12.102-4.983-18.66 C2.826,19.244,19.577,2.5,40.157,2.5C50.14,2.503,59.521,6.391,66.57,13.446C73.618,20.5,77.5,29.879,77.5,39.855 c-0.01,20.583-16.76,37.328-37.34,37.328c-6.247-0.003-12.418-1.574-17.861-4.543l-0.174-0.096L2.711,77.636L7.904,58.665z"></path><path fill="#788b9c" d="M40.157,3L40.157,3c9.85,0.003,19.105,3.838,26.059,10.799C73.17,20.76,77,30.013,77,39.855 c-0.009,20.307-16.536,36.828-36.855,36.828c-6.149-0.003-12.237-1.553-17.606-4.482l-0.349-0.19l-0.384,0.101l-18.384,4.82 l4.91-17.933l0.11-0.403l-0.209-0.362c-3.22-5.574-4.92-11.94-4.917-18.41C3.326,19.52,19.852,3,40.157,3 M40.157,2 C19.302,
@adeel-raza
adeel-raza / functions.php
Created June 9, 2023 14:20
Disable Video and Audio sharing for participants in a BigBlueButton Room in Virtual Classroom with WordPress plugin
/* Add the below code snippet to your child theme's functions.php file */
/* Disable Video and Audio sharing for participants in a BBB Room */
add_filter( 'virtual_classroom_pro_join_params', 'virtual_classroom_pro_custom_join_params' );
function virtual_classroom_pro_custom_join_params( $params ) {
$params['userdata-bbb_force_listen_only'] = true;
if ( ! $params['isMod'] ) {
@adeel-raza
adeel-raza / plugin.php
Created January 1, 2022 18:29 — forked from mathetos/plugin.php
Dependent Plugin Activation/Deactivation and Alert
<?php
/*
* Dependent Plugin Activation/Deactivation
*
* Sources:
* 1. https://pippinsplugins.com/checking-dependent-plugin-active/
* 2. http://10up.com/blog/2012/wordpress-plug-in-self-deactivation/
*
*/
@adeel-raza
adeel-raza / custom-css-zoom-wordpress-plugin.css
Last active April 28, 2023 23:17
Customize the look and feel of the Zoom WordPress Plugin on your specific site with these CSS rules. Add it to your Theme’s Custom CSS option
/* Hide the back arrow on top of the meeting window and join form */
.zoom-window-wrap .go-back-icon {
display: none;
}
/* Center align Zoom WP form */
.zoom-window-wrap .meeting-view > div {
text-align: center;
}
@adeel-raza
adeel-raza / index.html
Created January 28, 2021 22:43
Open in new tab for Join via App button in Zoom WordPress Plugin
<script>
var join_link = document.querySelector('.join-link');
if(join_link) {
join_link.setAttribute('onclick', join_link.getAttribute('onclick').replace('_self', '_blank'));
}
</script>
@adeel-raza
adeel-raza / .htaccess
Last active February 9, 2020 09:15
Add this snippet to your .htaccess located inside WordPress root directory to set Expire headers on your visitor's browser and enable GZIP compression
# Expires headers (for better cache control)
<IfModule mod_expires.c>
ExpiresActive on # Perhaps better to whitelist expires rules? Perhaps. ExpiresDefault "access plus 1 month" # cache.appcache needs re-requests in FF 3.6 (thanks Remy ~Introducing HTML5) ExpiresByType text/cache-manifest "access plus 0 seconds" # Your document html ExpiresByType text/html "access plus 0 seconds" # Data ExpiresByType text/xml "access plus 0 seconds" ExpiresByType application/xml "access plus 0 seconds" ExpiresByType application/json "access plus 0 seconds" # Feed ExpiresByType application/rss+xml "access plus 1 hour" ExpiresByType application/atom+xml "access plus 1 hour" # Favicon (cannot be renamed) ExpiresByType image/x-icon "access plus 1 week" # Media: images, video, audio ExpiresByType image/gif "access plus 4 months" ExpiresByType image/png "access plus 4 months" ExpiresByType image/jpeg "access plus 4 months" ExpiresByType image/webp "access plus 4 months" ExpiresByType video/ogg "access plus 1 month" ExpiresByType au
@adeel-raza
adeel-raza / functions.php
Last active January 1, 2023 15:43
A very simple function to execute custom JS after an ajax request with a specific WordPress action is triggered
<?php
add_action( 'wp_enqueue_scripts', 'myprefix_add_custom_js');
function myprefix_add_custom_js() {
wp_add_inline_script( 'jquery',
'
jQuery(function($) {
/**
* catch AJAX complete events, to catch wordpress actions
@adeel-raza
adeel-raza / functions.php
Last active August 16, 2021 01:00
Add lesson/topic ID as a link title to lessons/topics names inside LearnDash course table
<?php
add_action( 'learndash-lesson-row-title-before', 'custom_add_title_to_course_lesson_table', 10, 3);
function custom_add_title_to_course_lesson_table( $lesson_id, $course_id, $user_id ) {
if( ! current_user_can('group_leader') && ! current_user_can('administrator') ) {
return;
}
wp_add_inline_script( 'learndash-front',
'if( jQuery("#ld-expand-'.esc_html( $lesson_id ).'").length != 0 ) {
jQuery("#ld-expand-'.esc_html( $lesson_id ).'").find(".ld-item-name").attr("title", '.esc_attr( $lesson_id ).')