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:adb89446ea35102cc63d99a56a2b6124
Last active August 10, 2021 11:19
Select 2 basic usage with Group, Search & Highlights
Group, Simple Search, Highlight, Shorten Text with Tooltip
https://jsfiddle.net/gb7aju95/91/
Keyword Search, Highlight,
https://jsfiddle.net/bzotcxrp/92/
Keyword Search, Highlight,
https://jsfiddle.net/bzotcxrp/200/
Complete String with Keyword Search and Highlight
@aayushdrolia
aayushdrolia / screencapture_gist.txt
Created June 19, 2020 04:52
Change Mac Default Screenshot Location
By default it is set to Desktop.
To change it, open terminal and fire the provided command.
----------------------------------------------------------------------
defaults write com.apple.screencapture location "Your New Location"
----------------------------------------------------------------------
@aayushdrolia
aayushdrolia / import-sql.md
Created July 16, 2019 05:44 — forked from ankurk91/import-sql.md
MySQL: Import database via command line

Import large database to MySql ⚡

cd /path/to/backups
mysql -u root -p --default-character-set=utf8
# Switch to database 
USE database_name;
SET names 'utf8';
SET autocommit=0 ;
SOURCE backup.sql;
@aayushdrolia
aayushdrolia / gist:3a58da065bbb4dc38d33e90da08ea7b3
Created March 12, 2019 05:09
Add Google Translation Widget
<div id="google_translate_element"></div>
<script type="text/javascript">
function googleTranslateElementInit() {
new google.translate.TranslateElement({pageLanguage: 'en'}, 'google_translate_element');
}
</script>
<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
# Step 1: You need to navigate to C:/xampp/apache/conf/extra or wherever your xampp files are located.
# Step 2: Edit httpd-vhosts.conf.
1. Remove ##<VirtualHost *:80>
2. Add <VirtualHost *:80>
DocumentRoot "c:/xampp/htdocs/project"
ServerName project.localhost
<Directory "c:/xampp/htdocs/project"></Directory>
</VirtualHost>
# Step 3: Move to C:\Windows\System32\drivers\etc\hosts file.
1. Add 127.0.0.1 project.localhost at the bottom and hit save.
@aayushdrolia
aayushdrolia / gist:0a7cec04cd42faf6454b8ad37dd70ce4
Created May 17, 2018 10:29
Open Mobile Messaging Application via Link from Website with Pre-filled Contact and Message.
/** Without Contact Number **/
<a href="sms:?&body=message">Text Message</a>
/** With Contact Number **/
<a href="sms:1234567890;?&body=message">Text Message</a>
/** Works on both Android and iOS **/
@aayushdrolia
aayushdrolia / git_remember_password.md
Created April 17, 2018 12:25 — forked from ankurk91/git_remember_password.md
Git credential cache, why type password again and again

Git tip: Tired of entering password again and again ?

Run this command to remember your password:

git config --global credential.helper 'cache --timeout 28800'

Above command will tell git to cache your password for 8 hours.

@aayushdrolia
aayushdrolia / gist:6b3e2fe078272146c05c57c687413a0a
Created February 2, 2018 06:48 — forked from maxrice/gist:7918315
Get SKU from products in an order
<?php
$order = new WC_Order( $order_id );
foreach ( $order->get_items() as $item_key => $item ) {
$product = $order->get_product_from_item( $item );
$sku = $product->get_sku();
@aayushdrolia
aayushdrolia / gist:99efaa3919aa00b5f6aa7dda3a5cd87a
Created December 27, 2017 13:04
Delete a post using Ajax with Laravel 5.5
$('body').on('click', '#delete', function () {
var post = $(this).parent().parent();
var postID = $(this).attr('item-id');
$.ajax({
dataType: 'json',
type: 'DELETE',
url: 'post/'+ postID,
headers : {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') },
@aayushdrolia
aayushdrolia / gist:2605c96907f7d1d59841ca03e01b0e05
Created December 6, 2017 07:58
Allow only numbers in text field
$(document).ready(function () {
$("#field_id").keydown(function (e) {
if (e.shiftKey) e.preventDefault();
else {
var nKeyCode = e.keyCode;
//Ignore Backspace and Tab keys
if (nKeyCode == 8 || nKeyCode == 9) return;
if (nKeyCode < 95) {
if (nKeyCode < 48 || nKeyCode > 57) e.preventDefault();
} else {