Skip to content

Instantly share code, notes, and snippets.

View Nav-Appaiya's full-sized avatar
🏠
Available

Nav Appaiya Nav-Appaiya

🏠
Available
View GitHub Profile
@Nav-Appaiya
Nav-Appaiya / gist:d4f46c6dbd1c38a3ff07a6a2dc5afa54
Created October 13, 2022 17:39
michaelvillar-timer for mac (brew one liner installation for a simple timer app on your mac)
brew install --cask michaelvillar-timer
@Nav-Appaiya
Nav-Appaiya / timer.js
Created September 10, 2022 14:14
A javascript snippet to see how long a script or import is taking, will count when executed in your browser console
var start = Date.now();
function output(variable){console.log(variable);}
setInterval(function() {
var delta = Date.now() - start; // milliseconds elapsed since start
output(Math.floor(delta / 1000)); // in seconds
// alternatively just show wall clock time:
output(new Date().toUTCString());
}, 1000); // update about every second
@Nav-Appaiya
Nav-Appaiya / index.js
Created September 2, 2022 14:42
index.js file for node server
const { createServer } = require("http");
const { parse } = require("url");
const next = require("next");
const dev = process.env.NODE_ENV !== "production";
const port = !dev ? process.env.PORT : 3000;
// Create the Express-Next App
const app = next({ dev });
const handle = app.getRequestHandler();
@Nav-Appaiya
Nav-Appaiya / settings.php
Created August 24, 2022 12:56
Drupal 8/9 set error reporting to verbose (add in sites/settings.php)
$config['system.logging']['error_level'] = 'verbose';
@Nav-Appaiya
Nav-Appaiya / index.html
Created July 12, 2022 23:17
Tic Tac Toe
<div id="errors" style="
background: #c00;
color: #fff;
display: none;
margin: -20px -20px 20px;
padding: 20px;
white-space: pre-wrap;
"></div>
<div id="root"></div>
<script>
@Nav-Appaiya
Nav-Appaiya / functions.php
Created June 20, 2022 18:38
disable shipping for specific products woocommerce php
function hide_shipping_methods( $available_shipping_methods, $package ) {
$shipping_classes = array( 'some-shipping-class-1', 'some-shipping-class-2' );
$excluded_methods = array( 'free_shipping' );
$shipping_class_exists = false;
foreach( $package['contents'] as $key => $value )
if ( in_array( $value['data']->get_shipping_class(), $shipping_classes ) ) {
$shipping_class_exists = true;
break;
}
if ( $shipping_class_exists ) {
@Nav-Appaiya
Nav-Appaiya / gist:c7dd99f46c084f23d7cc882ca2f69670
Created May 27, 2022 16:33
Magento 2 cli disable the minify & bundling settings by cli
magerun config:store:set dev/js/merge_files 0
magerun config:store:set dev/js/enable_js_bundling 0
magerun config:store:set dev/js/minify_files 0
magerun config:store:set dev/css/merge_css_files 0
magerun config:store:set dev/css/minify_files 0
@Nav-Appaiya
Nav-Appaiya / index.html
Last active May 21, 2022 17:48
Under construction default template
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Webshop under construction</title>
<link href="https://fonts.googleapis.com/css?family=Noto+Sans:400,700" rel="stylesheet">
</head>
<body>
<style>
@Nav-Appaiya
Nav-Appaiya / Disable magento MSI
Created May 8, 2022 16:00
Disable Magento 2 Multi source inventory management by CLI
php bin/magento module:status | grep Magento_Inventory | grep -v List | grep -v None | grep -v -e '^$' | xargs php bin/magento module:disable
php bin/magento s:upgrade
php bin/magento s:s:deploy -f
php bin/magento c:flush
php bin/magento i:reindex
@Nav-Appaiya
Nav-Appaiya / git config user.name ""
Created May 1, 2022 13:30
set your git username + email
To set your global username/email configuration:
Open the command line.
Set your username: git config --global user.name "Nav Appaiya"
Set your email address:
git config --global user.email "[email protected]"
git config --global user.name "Nav Appaiya"
git config user.email "[email protected]"
git config user.name "Nav Appaiya"