Skip to content

Instantly share code, notes, and snippets.

Avatar

Prasidhda Malla prasidhda

View GitHub Profile
View Assign separate user roles to super admin and other user to new network site
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
@prasidhda
prasidhda / remove-cross-sell-products.php
Last active Nov 27, 2019
Remove cross sell products as well when removing the main product in woo commerce
View remove-cross-sell-products.php
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;
}
View Solving access denied error
ssh-add -K ~/.ssh/[your-private-key]
And in ~/.ssh/config you add:
Host *
UseKeychain yes
AddKeysToAgent yes
IdentityFile ~/.ssh/[your-private-key]
View GIT zip without ignored files, folders
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 Jun 22, 2020 — forked from tzmartin/embedded-file-viewer.md
Embedded File Viewer: Google Drive, OneDrive
View embedded-file-viewer.md

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

View step-to-step-to-eject-expo-by-right-way.md

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 Oct 20, 2021
To install SQL in linux debian versions
View To install SQL in linux debian versions.txt
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 / common spam words 2020
Last active Apr 19, 2022
List of common spam words
View common spam words 2020
0%
0% risk
777
99%
99.9%
100%
100% more
#1
$$$
100% free