Skip to content

Instantly share code, notes, and snippets.

View isaumya's full-sized avatar
👨‍💻
Think Twice, Code Once

Saumya Majumder isaumya

👨‍💻
Think Twice, Code Once
View GitHub Profile
@ashwebstudio
ashwebstudio / custom-featured-image-size.php
Last active August 22, 2023 10:23
WordPress: Make unique custom image size ONLY for featured image of a post
@ryanwelcher
ryanwelcher / theme.json
Created February 8, 2022 17:30
When adding theme.json to an existing Classic Theme, these settings will stop the default color and typography controls from being enabled.
{
"$schema": "http://schemas.wp.org/trunk/theme.json",
"version": 2,
"settings": {
"layout": {
"contentSize": "750px"
},
"color": {
"background": false,
"custom": false,
@bradtraversy
bradtraversy / vscode_shortcuts.md
Last active November 8, 2024 00:34
Helpful shortcuts for VSCode

VSCode Shortcuts

List of helpful shortcuts for faster coding

If you have any other helpful shortcuts, feel free to add in the comments of this gist :)

Official List of all commands

@isaumya
isaumya / vs-code-git-repo-add.md
Last active August 9, 2023 15:46
Add repo to VS Code Projects

Add Git Repo to your CLI created project in VS Code

Let's say that you have created a project using @vue/cli or some other cli locally. Now you created a github repo. Also at the time of creating the repo you have set the LICENSE file from the web creation portal. Now if you are using VS Cose, here are the following commands that you need to run for the first time to ensure the remote repo gets properly connected with your project.

Step 1. Add Remote Repo URL

git remote add origin https://<AccountName>.github.com/somerepo.git

Step 2. Pull from the Remote Repo with --allow-unrelated-histories flag

@DavidWells
DavidWells / aligning-images.md
Last active November 14, 2024 03:45
Guide to aligning images in github readme.md files. https://davidwells.io/snippets/how-to-align-images-in-markdown

Aligning images

This is a guide for aligning images.

See the full Advanced Markdown doc for more tips and tricks

left alignment

@mikejolley
mikejolley / functions.php
Created March 10, 2016 09:39
WooCommerce Disable guest checkout for certain products
<?php
// Code goes in theme functions.php or a custom plugin
add_filter( 'pre_option_woocommerce_enable_guest_checkout', 'conditional_guest_checkout_based_on_product' );
function conditional_guest_checkout_based_on_product( $value ) {
$restrict_ids = array( 1, 2, 3 ); // Replace with product ids which cannot use guest checkout
if ( WC()->cart ) {
$cart = WC()->cart->get_cart();
/**
* Unhook the cart widget/icon
*
*/
function checkout_remove_cart_icon() {
remove_filter( 'wp_nav_menu_items', 'checkout_add_cart_widget_to_menu', 10, 2 );
add_filter( 'wp_nav_menu_items', 'checkout_add_revised_cart_widget_to_menu', 1, 2 );
}
add_action( 'init', 'checkout_remove_cart_icon' );
@mandiwise
mandiwise / Count lines in Git repo
Last active September 29, 2024 19:44
A command to calculate lines of code in all tracked files in a Git repo
// Reference: http://stackoverflow.com/questions/4822471/count-number-of-lines-in-a-git-repository
$ git ls-files | xargs wc -l
@richardW8k
richardW8k / rw-gf-age-calculation.php
Last active April 24, 2019 06:14
calculate age from date field when age modifier specified on merge tag e.g. {Date of Birth:10:age}
<?php
class RW_GF_Age_Calculation {
public function __construct() {
add_action( 'init', array( $this, 'init' ) );
}
function init() {
if ( ! class_exists( 'GFForms' ) || ! property_exists( 'GFForms', 'version' ) && version_compare( GFForms::$version, '1.9', '>=' ) ) {