Skip to content

Instantly share code, notes, and snippets.

View raftaar1191's full-sized avatar
🏠
Working from home

Deepak Gupta raftaar1191

🏠
Working from home
View GitHub Profile
@sabrina-zeidan
sabrina-zeidan / stop_loading_unused_blocks _crap.php
Created July 13, 2022 16:00
Stop loading unused Gutenberg blocks assets [WordPress]
//In a better world block's author makes sure the block's assests are loaded only if block is actually in use (via enqueue_block_assets). For other cases:
add_filter( 'script_loader_tag', 'sz_stop_loading_unused_block_crap', 10, 3 );
function sz_stop_loading_unused_block_crap( $tag, $handle, $src ) {
// Check if block's assets are loaded
if (str_contains($src, 'plugins/wp-swiper')) { //plugin directory here
if (is_singular()) {// works only on Singular
//TODO: //Will work for content only. if block is elsewhere or post it's archive use this https://wordpress.stackexchange.com/questions/392493/find-if-widget-block-is-active
$id = get_the_ID();
if (has_block('da/wp-swiper-slide', $id) !== true) { //block name here
@raftaar1191
raftaar1191 / wp-config.php
Created September 25, 2019 09:07
Change the URL from Wp-confi file directly
define( 'WP_HOME', 'http://example.com' );
define( 'WP_SITEURL', 'http://example.com' );
@raftaar1191
raftaar1191 / mysql command
Last active September 7, 2020 06:40
MYSQL
mysql -u UN -h HOSTNAME -p DATABASENAME < FILENAME.sql
mysql -u root -h localhost -p local < mysql.sql
@raftaar1191
raftaar1191 / funtions.php
Created May 16, 2018 23:08
var_dump in new file
error_log( print_r( $is_active, true ) . "\n", 3, WP_CONTENT_DIR . '/debug_new.log' );
@raftaar1191
raftaar1191 / shell.bash
Created March 7, 2018 21:58
Display xbedug in Local By Flyweel
1> Login into the sites shell of Local By Flyweel sites
2> Then past the following command into the login shell `php -i | grep "php.ini"`
OUTPUT
root@05438eed18c9:/# php -i | grep "php.ini"
Configuration File (php.ini) Path => /conf/php/7.0.3
Loaded Configuration File => /conf/php/7.0.3/php.ini
@raftaar1191
raftaar1191 / installConfig.sh
Created December 15, 2017 20:49 — forked from growdigital/installConfig.sh
Install script for brew and cask for Mac OS X
#!/bin/sh
#
# Brew packages
#
brew install git
# brew install node - having npm install issues, so installed manually
brew install wget
brew install homebrew/php/php56
brew install homebrew/php/composer
# brew install task - didn't install with gnutls, had to make from source
@raftaar1191
raftaar1191 / wp-config.php
Last active February 24, 2023 10:04 — forked from emgk/wp-config.php
WP Debug Configurations
define( 'WP_DEBUG', true );
define( 'SCRIPT_DEBUG', true );
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
// Enable Debug logging to the /wp-content/debug.log file
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'log_errors', 'On' );
@ini_set( 'display_errors', 'Off' );
@ini_set( 'error_reporting', E_ALL );
@ini_set( 'error_log', 'php_error.log' );
@raftaar1191
raftaar1191 / shell
Created December 5, 2017 05:53
Clone all repo from wordimpress
curl "https://api.github.com/users/wordimpress/repos?page=1&per_page=100" |
grep -e 'git_url*' |
cut -d \" -f 4 |
xargs -L1 git clone
@kevinwhoffman
kevinwhoffman / resources-web-developers-designers.md
Last active January 26, 2024 21:20
Resources for Web Developers and Designers

Resources for Web Developers and Designers

This is an incomplete list of resources including courses and individuals who publish content that has helped me grow as a web developer and designer. Many of these resources are WordPress-specific as that is my current area of specialization. This list will grow over time. If you've got something to add, send me a link @kevinwhoffman and I'll check it out!

Course Providers

@raftaar1191
raftaar1191 / Gulp give
Last active August 9, 2018 06:26
Gulp command to run first time when installing the give and running the gulp
npm install --save-dev del eslint fs-extra gulp gulp-bower gulp-checktextdomain gulp-concat gulp-cssmin gulp-filter gulp-imagemin gulp-livereload gulp-notify gulp-rename gulp-rtlcss gulp-sass gulp-sort gulp-sourcemaps gulp-uglify gulp-watch gulp-wp-pot main-bower-files