Skip to content

Instantly share code, notes, and snippets.

View aayushdrolia's full-sized avatar
🕸️
Spider

Aayush Drolia aayushdrolia

🕸️
Spider
View GitHub Profile
@aayushdrolia
aayushdrolia / gist:56d8b1cfc1deabf9f479e01111b56b0a
Last active May 19, 2020 05:24
Import & Export Database using Command Line Interface
Import Command
--------------
mysql -u [username] -p -e "create database [databasename];"
mysql -u[username] -p [databasename] < [.sql filename]
Export Command
--------------
mysqldump -u [username] -p [databasename] > [output path]
$(‘body').on('click','#id',function(){
var btn = $('.class');
jQuery.post().complete(function(){
btn.prop('disabled', false);
});
btn.prop('disabled', true);
});
@aayushdrolia
aayushdrolia / gist:8a756d594b1d70c75f5a8edd79f3b751
Created October 12, 2017 06:42
Fetch custom field value from category page in wordpress
global $wp_query; // get the query object
$cat_obj = $wp_query->get_queried_object();
$value = get_field('field_name',$cat_obj->taxonomy.'_'.$cat_obj->term_id);
@aayushdrolia
aayushdrolia / gist:23b40152f34fa790773ea894fd4d6091
Last active October 14, 2022 06:59
Comment form validation message on the same page in wordpress
***********************************************
PHP CODE (add it in your theme's functions.php)*
***********************************************
function insert_jquery_validate(){
wp_enqueue_script('validate', 'http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js', array( 'jquery' ), false, true );
}
add_filter('wp_enqueue_scripts','insert_jquery_validate');
@aayushdrolia
aayushdrolia / gist:3c8928717efc34ccc5806f6f7590b486
Created October 17, 2017 05:17
Command to install npm in mac
# install command
$ brew install node
# to check if node is installed
$ node -v
# to check if npm is installed
$ npm -v
# to make sure HomeBrew has latest version of node packages
@aayushdrolia
aayushdrolia / gist:992d4494e73a8bc522e5950b1a4865d7
Created October 21, 2017 11:10
Restrict multiple select list to max of 2 selections
<script>
jQuery(document).ready(function($){
$('#subjects option').click(function()
{
var items = $(this).parent().val();
if (items.length > 2) {
alert("You can only select 2 values at a time");
$('#subjects option:selected').prop("selected",false);
}
@aayushdrolia
aayushdrolia / gist:d6cc4c30f60aa1c372ac566026180b22
Created October 23, 2017 05:38
Event Listeners with Vue js
// Create your html structure
<div id= "root">
<input type= "text" id= "input">
<button v-on:click= "addname" >AddName</button>
</div>
OR
var customerName = $('#billing_first_name').val();
var noteCharacter = 0;
var billingName = "you";
var time = $('body > div.container.page-container > div > ul > li > div > span').text().replace(':', '');
$("#shipping_myfield12").val('');
$(".coupon-env").addClass("coupon-visible");
$(".coupon > .btn-primary").val("APPLY DISCOUNT");
$(".sidebar_zip_code_checker_error").html("Your target is out of our area. Sorry.")
$("#coupon_code").attr("placeholder", "enter discount");
$(".cart_totals h2").html("BASKET TOTALS");
@aayushdrolia
aayushdrolia / gist:d9f156699cdadfb18dfe0ddde84738a3
Created November 29, 2017 06:39
Create aliases for git commands.
// Aliases for git commands can be created by the following two methods.
/*****************************************************************************
1. Add lines to ~/.gitconfig
[alias]
st = status
cm = commit -m
/*****************************************************************************