Skip to content

Instantly share code, notes, and snippets.

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

Fahad Ali Khan fhdalikhan

🏠
Working from home
  • Karachi, Pakistan.
View GitHub Profile
@fhdalikhan
fhdalikhan / help.js
Created October 11, 2020 22:08
jQuery Disable Button
jQuery.fn.extend({
disable: function(state) {
return this.each(function() {
this.disabled = state;
});
}
});
@fhdalikhan
fhdalikhan / help.js
Created October 11, 2020 22:08
JS Delete Confirmation for Buttons/ or something else
// Delete Confirmation for Buttons/ or something else
function secureDelete(text){
text = typeof text !== 'undefined' ? text : 'Are you sure?';
if(confirm(text)==false){
return false;
}else{
return true;
}
@fhdalikhan
fhdalikhan / help.js
Created October 11, 2020 22:05
GET URL PARAMETER
// GET URL PARAMETER
var getUrlParameter = function getUrlParameter(sParam) {
var sPageURL = decodeURIComponent(window.location.search.substring(1)),
sURLVariables = sPageURL.split('&'),
sParameterName,
i;
for (i = 0; i < sURLVariables.length; i++) {
sParameterName = sURLVariables[i].split('=');
@fhdalikhan
fhdalikhan / help.js
Created October 11, 2020 22:04
ADD CLASS TO ACTIVE ANCHOR THROUGH JS
// ADD CLASS TO ACTIVE ANCHOR THROUGH JS
$(function() {
var url = window.location.href;
// Will only work if string in href matches with location
$('.Topnav a[href="'+ url +'"]').addClass('active');
// Will also work for relative and absolute hrefs
$('.Topnav a').filter(function() {
return this.href == url;
}).addClass('active');
@fhdalikhan
fhdalikhan / help.js
Created July 23, 2020 05:03
Bootstrap modal scroll to top with animation
$('.modal').animate({ scrollTop: 0 }, 'slow');
@fhdalikhan
fhdalikhan / help.js
Created July 23, 2020 04:28
jQuery Scroll to top with animation duration and based on target div
$("#button").click(function() {
$('html, body').animate({
scrollTop: $("#myDiv").offset().top
}, 2000);
});
@fhdalikhan
fhdalikhan / backup.php
Created July 14, 2020 00:16 — forked from toddsby/backup.php
backup.php
<?php
/*
* PHP: Recursively Backup Files & Folders to ZIP-File
* (c) 2012-2014: Marvin Menzerath - http://menzerath.eu
* contribution: Drew Toddsby
*/
// Make sure the script can handle large folders/files
ini_set('max_execution_time', 600);
ini_set('memory_limit','1024M');
@fhdalikhan
fhdalikhan / Dockerfile
Last active May 29, 2020 13:46
Dockerfile for PHP 7.3 FPM Alpine
FROM php:7.3-fpm-alpine
WORKDIR /var/www/html
# Setup GD extension
RUN apk add --no-cache \
freetype \
libjpeg-turbo \
libpng \
freetype-dev \
@fhdalikhan
fhdalikhan / Dockerfile
Last active May 29, 2020 13:50
Dockerfile for PHP 7.1 FPM Alpine
FROM php:7.1-fpm-alpine
WORKDIR /var/www/html
# Setup GD extension
RUN apk add --no-cache \
freetype \
libjpeg-turbo \
libpng \
freetype-dev \
@fhdalikhan
fhdalikhan / Dockerfile
Last active March 23, 2025 08:56
Dockerfile for PHP 7.4 FPM Alpine
FROM php:7.4-fpm-alpine
WORKDIR /var/www/html
# Setup GD extension
RUN apk add --no-cache \
freetype \
libjpeg-turbo \
libpng \
freetype-dev \