Skip to content

Instantly share code, notes, and snippets.

View deshabhishek007's full-sized avatar
on Coffee!

Abhishek Deshpande deshabhishek007

on Coffee!
View GitHub Profile
@deshabhishek007
deshabhishek007 / WCAttendees.js
Last active April 2, 2018 04:42
JS Snippet for Chrome DevTools, Prints all WordCamp Attendees Info to Console from Attendee page
// WCAttendees.js
// https://gist.github.com/deshabhishek007/1593ca3daa429aa39b6451543a09983a
// Prints all WordCamp Attendees Info to Console from Attendee page
(function () {
var main_array = [];
var attendee_list = document.querySelectorAll('.tix-attendee-list li');
attendee_list.forEach(function(person) {
@deshabhishek007
deshabhishek007 / debloat-ubuntu.sh
Created May 9, 2018 07:45
Simple Command for De bloating ubuntu 16.04
sudo apt-get remove account-plugin-aim account-plugin-facebook account-plugin-flickr account-plugin-jabber account-plugin-salut account-plugin-twitter account-plugin-windows-live account-plugin-yahoo aisleriot brltty colord deja-dup deja-dup-backend-gvfs duplicity empathy empathy-common evolution-data-server-online-accounts example-content gnome-accessibility-themes gnome-contacts gnome-mahjongg gnome-mines gnome-orca gnome-screensaver gnome-sudoku gnome-video-effects gnomine landscape-common libsane libsane-common mcp-account-manager-uoa python3-uno rhythmbox rhythmbox-plugins rhythmbox-plugin-zeitgeist sane-utils shotwell shotwell-common telepathy-gabble telepathy-haze telepathy-idle telepathy-indicator telepathy-logger telepathy-mission-control-5 telepathy-salut thunderbird thunderbird-gnome-support totem totem-common totem-plugins unity-scope-audacious unity-scope-chromiumbookmarks unity-scope-clementine unity-scope-colourlovers unity-scope-devhelp unity-scope-firefoxbookmarks unity-scope-gdrive unity-sco
@deshabhishek007
deshabhishek007 / override-product-price.php
Last active May 16, 2018 17:48
Override WooCommerce Product Price
add_action( 'woocommerce_before_calculate_totals', 'add_custom_price' );
function add_custom_price( $cart_object ) {
$custom_price = 100; // This will be your custome price
$target_product_id = 15;
foreach ( $cart_object->cart_contents as $value ) {
if ( $value['product_id'] == $target_product_id ) {
$value['data']->set_price ($custom_price);
}
@deshabhishek007
deshabhishek007 / product-inventory.php
Created May 16, 2018 17:47
Get WooCommerce Product Inventory Status
$target_product_id = 13;
$product_in_cart = wc_get_product($target_product_id);
$stock_value = $product_in_cart->get_stock_quantity();
<?php
header('Access-Control-Allow-Origin: *');
$json_path = "http://YourDOMainname.HERE/wp-json/wp-menu-extractor/v2/menus/MENUID";
$json_menu = json_decode(file_get_contents($json_path));
$menu_items = $json_menu->items;
echo '<ul class="menu_ul">';
menu($menu_items);
echo '</ul>';
<div id="menu_container"></div>
{literal}
<script>
var json_path = "https://DOMAIN.HERE/wp-json/wp-menu-extractor/v2/menus/IDHERE";
var json_menu, menu_items, menu_markup;
fetch(json_path)
.then(json_menu => json_menu.json())
.then(json_menu =>{
@deshabhishek007
deshabhishek007 / Permission Reset
Created September 28, 2018 14:39
Reset File Permission of Linux Server Machine
find public_html -type d -perm 0777 -exec chmod 755 {} \;
find public_html -type f -perm 0666 -exec chmod 644 {} \;
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
@deshabhishek007
deshabhishek007 / SublimeLinter-Settings-user.json
Created October 9, 2018 19:59
My PHPCS Config for Sublime v01
// SublimeLinter Settings - User
{
"paths": {
"linux": [],
"osx": ["~/.composer/vendor/squizlabs/php_codesniffer/scripts/",
"~/.composer/vendor/squizlabs/php_codesniffer/bin/",
"/usr/local/bin/"],
"windows": []
},
"linters":{
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ../../peenak android-release-unsigned.apk key0
~/Library/Android/sdk/build-tools/28.0.3/zipalign -v 4 android-release-unsigned.apk release.apk