Skip to content

Instantly share code, notes, and snippets.

View k-msalehi's full-sized avatar
🎵
What's happening?

Mohammad Salehi k-msalehi

🎵
What's happening?
View GitHub Profile
@evgenyneu
evgenyneu / setup_cursor_ubuntu.md
Last active July 1, 2025 17:08
Install Cursor AI code editor on Ubuntu 24.04 LTS

Install Cursor AI editor on Ubuntu 24.04

  1. Use the Download button on www.cursor.com web site. It will download the NAME.AppImage file.

  2. Copy the .AppImage file to your Applications directory

cd ~/Downloads
mkdir -p ~/Applications
mv NAME.AppImage ~/Applications/cursor.AppImage
@felipeelia
felipeelia / woocommerce-catalog-sort-snippet.php
Created July 5, 2017 12:22 — forked from mikejolley/gist:1622323
WooCommerce - Change default catalog sort order to stock status and date
/**
* This code should be added to functions.php of your theme
**/
function my_woocommerce_catalog_orderby( $args ) {
$args['meta_key'] = '_stock_status';
$args['orderby'] = array( 'meta_value' => 'ASC', 'date' => 'DESC' );
return $args;
}
add_filter( 'woocommerce_get_catalog_ordering_args', 'my_woocommerce_catalog_orderby' );
@duroe5698
duroe5698 / add-custom-menu-item-and-endpoint-to-woocommerce-my-account-page.php
Last active July 8, 2023 18:05
Add custom menu item and endpoint to WooCommerce my-account page
/* Add custom menu item and endpoint to WooCommerce My-Account page */
function my_custom_endpoints() {
add_rewrite_endpoint( 'refunds-returns', EP_ROOT | EP_PAGES );
}
add_action( 'init', 'my_custom_endpoints' );
function my_custom_query_vars( $vars ) {
$vars[] = 'refunds-returns';
@AKTed
AKTed / wp-reset-roles.php
Last active July 3, 2022 09:45
The following code will reset a WordPress default role to it's default capabilities. Note: these defaults are for WordPress 3.5, any other versions might have different defaults. To be safe, only use this code on WordPress 3.5. Warning: This cannot be undone! The role, in it's current state, is removed and recreated with the WordPress default ro…
<?php
/*
* example usage: $results = reset_role_WPSE_82378( 'subscriber' );
* per add_role() (WordPress Codex), $results "Returns a WP_Role object
* on success, null if that role already exists."
*
* possible $role values:
* 'administrator'
* 'editor'
* 'author'