Skip to content

Instantly share code, notes, and snippets.

View pmbaldha's full-sized avatar
🏠
Working from Home

Prashant Baldha pmbaldha

🏠
Working from Home
View GitHub Profile
@pmbaldha
pmbaldha / git-tag-delete-local-and-remote.sh
Created September 29, 2019 12:38 — forked from mobilemind/git-tag-delete-local-and-remote.sh
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@pmbaldha
pmbaldha / backup.php
Created February 15, 2017 15:09 — forked from menzerath/backup.php
PHP: Recursively Backup Files & Folders to ZIP-File
<?php
/*
* PHP: Recursively Backup Files & Folders to ZIP-File
* (c) 2012-2014: Marvin Menzerath - http://menzerath.eu
*/
// Make sure the script can handle large folders/files
ini_set('max_execution_time', 600);
ini_set('memory_limit','1024M');
@pmbaldha
pmbaldha / get-current-url-in-wordpress-wp.php
Created November 16, 2016 09:47
Get current url in wordpress
global $wp;
$current_url = home_url(add_query_arg(array(),$wp->request));
@pmbaldha
pmbaldha / thumb.click.change.main.img.js
Created June 21, 2016 16:20
update woocommerce main product image on thumbnail click( function( $ ) { $(document).on('click','.thumbnails .zoom', function(){ var photo_fullsize = $(this).attr("href"); $('.woocommerce-main-image').attr('href',$(this).attr("href")); $('.woocommerce-main-image img').removeAttr("srcset") $('.woocommerce-main-image img').removeAttr("src").attr(…
( function( $ ) {
$(document).on('click','.thumbnails .zoom', function(){
var photo_fullsize = $(this).attr("href");
$('.woocommerce-main-image').attr('href',$(this).attr("href"));
$('.woocommerce-main-image img').removeAttr("srcset")
$('.woocommerce-main-image img').removeAttr("src").attr('src', photo_fullsize);
return false;
});
} )( jQuery );
@pmbaldha
pmbaldha / http_basic_authentication.php
Created March 15, 2016 04:32
HTTP Basic authentication in php
//For http basic authentication in php
//Just add this code on top before any echo or print in common file
$user = 'user';
$password = 'pass';
if (!($_SERVER['PHP_AUTH_USER'] == $user && $_SERVER['PHP_AUTH_PW'] == $password)) {
header('WWW-Authenticate: Basic realm="Please enter username and password to access tgis website"');
header('HTTP/1.0 401 Unauthorized');
echo '<h1>Unauthorized Access</h1>';
exit;
}