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
@redoPop
redoPop / .gitignore
Created June 18, 2010 22:08
Template .gitignore file for WordPress projects
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your
@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', '>=' ) ) {
@mandiwise
mandiwise / Count lines in Git repo
Last active July 4, 2024 16:56
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
/**
* 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' );
@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();

Aligning images

This is a guide for aligning images.

See the full Advanced Markdown doc for more tips and tricks

left alignment

@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

@bradtraversy
bradtraversy / vscode_shortcuts.md
Last active July 22, 2024 10:30
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

@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,