Skip to content

Instantly share code, notes, and snippets.

digamber pradhan digamber89

Block or report user

Report or block digamber89

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@digamber89
digamber89 / main.js
Created May 3, 2019
Check if Item is in viewport -> add class if it is - remove class if it isn't
View main.js
(function ($) {
var digthisAddClassToElement = function (element) {
//cache the DOM
//use the element send through function as the dom element
var $element = $(element);
//scoped helper functions
var isInViewport = function (elem) {
var bounding = elem.getBoundingClientRect();
return (
@digamber89
digamber89 / index.html
Last active Apr 11, 2019
Multi Image Uploader Using - jQuery Dependent
View index.html
<form class="digthis-multi-upload-form" action="" method="post" enctype="multipart/form-data">
<div>
<label for="title">Title</label>
<input type="text" id="title" name="title" required>
</div>
<div>
<label for="content">Content</label>
<textarea id="content" name="content" required></textarea>
</div>
@digamber89
digamber89 / modify-functions.php
Last active Feb 21, 2019
Quick Fix Terms and Conditions
View modify-functions.php
<?php
add_action( 'woocommerce_after_checkout_validation', 'digthis_two_step_checkout_validate', 9999, 2 );
function digthis_two_step_checkout_validate( $data, $errors ) {
$step = filter_input( INPUT_POST, 'current_step' );
if ( empty( $errors->errors ) && $step == 'step-1' ) {
$errors->add( 'digthis', __( '<span id="digthis-prevent-error">Digthis Error</span>', 'woocommerce' ) );
}
@digamber89
digamber89 / enqueue.php
Created Feb 5, 2019
Multiple Upload WordPress Media
View enqueue.php
<?php
function enqueue_media_uploader()
{
wp_enqueue_media();
}
add_action("admin_enqueue_scripts", "enqueue_media_uploader");
View Lock-price-example
<?php
add_action( 'woocommerce_removed_coupon', 'cart_prices', 0 );
add_action( 'woocommerce_after_calculate_totals', 'cart_prices', 0 );
add_action( 'woocommerce_cart_loaded_from_session', 'cart_prices', 0 );
@digamber89
digamber89 / bootstrap-fix.html
Last active Nov 15, 2018
Fix for Bootstrap scrolling to div issue.
View bootstrap-fix.html
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap Nav Example</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<style>
@digamber89
digamber89 / tab-fix.js
Last active Nov 5, 2018
Bootstrap 3 Remember State
View tab-fix.js
// store the currently selected tab in the hash value
$("ul.nav.panel-tabs > li > a").on("shown.bs.tab", function(e) {
var id = $(e.target).attr("href").substr(1);
window.location.hash = id;
});
// on load of the page: switch to the currently selected tab
var hash = window.location.hash;
$('ul.nav.panel-tabs a[href="' + hash + '"]').tab('show');
View gist:041c98235a0a0b4ecded22cf07b9032f
https://www.sandbox.paypal.com/us/cgi-bin/webscr?cmd=_display-ipns-history
View viewport.js
$.fn.isInViewport = function () {
var elementTop = $(this).offset().top;
var elementBottom = elementTop + $(this).outerHeight();
var viewportTop = $(window).scrollTop();
var viewportBottom = viewportTop + $(window).height();
return elementBottom > viewportTop && elementTop < viewportBottom;
};
View index.html
<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" type="text/css" href="./slick/slick.css"/>
<!-- Add the slick-theme.css if you want default styling -->
<link rel="stylesheet" type="text/css" href="./slick/slick-theme.css"/>
You can’t perform that action at this time.