Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View prasidhda's full-sized avatar

Prasidhda Malla prasidhda

View GitHub Profile
@prasidhda
prasidhda / remove-cross-sell-products.php
Last active November 27, 2019 07:03
Remove cross sell products as well when removing the main product in woo commerce
add_action( 'woocommerce_cart_item_removed', function ( $cart_item, $cart ) {
$product_id_cart_item_pairs = WC()->session->get( 'product_id_cart_item_pairs', array() );
$cart_item_product_pairs = WC()->session->get( 'cart_item_product_pairs', array() );
// Get the product ID using session store
$product_id = isset( $product_id_cart_item_pairs[ $cart_item ] ) ? $product_id_cart_item_pairs[ $cart_item ] : false;
if ( ! $product_id ) {
return;
}
add_action('wpmu_new_blog', 'wpmudev_new_blog_role', 300, 2);
function wpmudev_new_blog_role( $blog_id, $user_id ) {
//Switch to new network site
switch_to_blog( $blog_id );
//Set default fallback user role
$default_user_role = 'administrator'; // Will be used as fallback user role, will be used if WP somehow can't create user role programitically
//Create free user role
ssh-add -K ~/.ssh/[your-private-key]
And in ~/.ssh/config you add:
Host *
UseKeychain yes
AddKeysToAgent yes
IdentityFile ~/.ssh/[your-private-key]
If you're trying to zip up a project which is stored in Git, use the git archive command. From within the source directory:
git archive -o bitvolution.zip HEAD
You can use any commit or tag ID instead of HEAD to archive the project at a certain point.
If you want to add a prefix (e.g., a top level folder) to every file:
git archive -o bitvolution.zip --prefix=bitvolution/ HEAD
You can also adjust the compression level between 0 (no compression) and 9 (maximum compression) inclusive, for example
git archive -o bitvolution.zip -9 HEAD
For other options, see the help page (git help archive).
@prasidhda
prasidhda / embedded-file-viewer.md
Created June 22, 2020 05:25 — forked from tzmartin/embedded-file-viewer.md
Embedded File Viewer: Google Drive, OneDrive

Office Web Apps Viewer

('.ppt' '.pptx' '.doc', '.docx', '.xls', '.xlsx')

http://view.officeapps.live.com/op/view.aspx?src=[OFFICE_FILE_URL]

<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=[OFFICE_FILE_URL]' width='px' height='px' frameborder='0'>
</iframe>

OneDrive Embed Links

@prasidhda
prasidhda / common spam words 2020
Last active June 21, 2023 13:17
List of common spam words
0%
0% risk
777
99%
99.9%
100%
100% more
#1
$$$
100% free
@prasidhda
prasidhda / step-to-step-to-eject-expo-by-right-way.md
Created October 20, 2020 10:57 — forked from phuochau/step-to-step-to-eject-expo-by-right-way.md
Step to Step to eject Expo by right way (Expo 32.0.0)

1. Step to step to eject to ExpoKit by right way:

Step 1. Run command: expo eject in root of expo project.

Step 2. Choose 2nd option: Eject to ExpoKit and follow step to step from Expo command to eject it completely.

Step 3 (Optional) Install dependencies (normally, Expo will auto run this command)

yarn install
@prasidhda
prasidhda / To install SQL in linux debian versions.txt
Last active October 20, 2021 12:05
To install SQL in linux debian versions
In latest version, mySQL uses auth_socket, so to login you've to know about the auto generated user credentials. or if you download binary version, while installation process, you can choose lagacy password.
To install SQL in linux debian versions
sudo apt install mysql-server
to know about the password
sudo cat /etc/mysql/debian.cnf
Now login
@prasidhda
prasidhda / variousCountryListFormats.js
Created July 10, 2023 09:02 — forked from incredimike/variousCountryListFormats.js
List of Countries in various Javascript data structures: Alphabetical country lists & Country data objects.
// Lists of countries with ISO 3166 codes, presented in various formats.
// Last Updated: July 30, 2020
// If you're using PHP, I suggest checking out:
// https://github.com/thephpleague/iso3166
// or Laravel: https://github.com/squirephp/squire
//
// JS developers can check out:
// https://www.npmjs.com/package/iso3166-2-db
//