Skip to content

Instantly share code, notes, and snippets.

Gulshan Kumar thegulshankumar

Block or report user

Report or block thegulshankumar

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Instant JS Minified and Modified
/*! v1.2.1 - (C) 2019 Alexandre Dieulot -*/let urlToPreload
let mouseoverTimer
let lastTouchTimestamp
const prefetcher=document.createElement('link')
const isSupported=prefetcher.relList&&prefetcher.relList.supports&&prefetcher.relList.supports('prefetch')
const allowQueryString='instantAllowQueryString'in document.body.dataset
const allowExternalLinks='instantAllowExternalLinks'in document.body.dataset
const eventListenersOptions={capture:true,passive:true,}
thegulshankumar / Disable Adsense Ads From 404
Created Mar 19, 2019
Disable Adsense Ads From 404 Pages In Wordpress
View Disable Adsense Ads From 404
Step 1. Remove adsbygoogle.js from all Ad units
Step 2. Paste below snippet in the Theme functions.php or use Code Snippets plugin
function conditional_adsense_display() {
if ( ! is_404( ) ) echo '<script async src="//"></script>';}
add_action('wp_head', 'conditional_adsense_display');
View Block Google AdSense in Some Country
// Untested: May not work with some Cache plugin.
$country_code = $_SERVER["HTTP_CF_IPCOUNTRY"];
if ($country_code == "US") {
echo "<style>.aicp {display:none;}</style>";
}else {
echo "<script async src=\"//\"></script>";
// Block multiple countries
View ServerPilot wp-config.php
define('SP_REQUEST_URL', ($_SERVER['HTTPS'] ? 'https://' : 'http://') . $_SERVER['HTTP_HOST']);
View Redirect from HTTPS to HTTP
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} =https
RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Gulshan Kumar (Born on 21st July in Bihar) is an Indian professional blogger, a dreamer, a positive thinker. Learn more at
thegulshankumar / gist:c7fb8d0d9e9cc6e4161bc45fdf2d1155
Last active Sep 24, 2017
A light weight Back to top in jQuery
View gist:c7fb8d0d9e9cc6e4161bc45fdf2d1155
<link rel='stylesheet' href='' type='text/css' />
<a class="back-to-top" title="Page Up" style="color: #eadede; font-size:32px; position: fixed; bottom:20px; right:15px;" href="#top"><i class="fa fa-arrow-circle-up" aria-hidden="true"></i></a>
var jQuerybackToTop = jQuery(".back-to-top");
jQuery(window).on('scroll', function() {
if (jQuery(this).scrollTop() > 400) { // Show button after X scroll
} else {
thegulshankumar / gist:474164f3b2cf73dbcf11c556812af48b
Created Sep 14, 2017
Leverage browsing cache via .htaccess
View gist:474164f3b2cf73dbcf11c556812af48b
# Leverage Browser Caching by setting HTTP header expires
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus 0 seconds"
ExpiresByType text/css "access plus 1 month"
# Data Interchange
ExpiresByType application/json "access plus 0 seconds"
thegulshankumar / amp
Created Aug 14, 2017
Remove output of rel=amphtml in official AMP plugin (WordPress)
View amp
// Callbacks for adding AMP-related things to the main theme
/** Using comment syntax at amp/includes/amp-frontend-actions.php file.
add_action( 'wp_head', 'amp_frontend_add_canonical' );
function amp_frontend_add_canonical() {
if ( false === apply_filters( 'amp_frontend_show_canonical', true ) ) {
thegulshankumar / Google Analytic Code-with-cookies-domain
Created Jul 12, 2017
Google Analytics Tracking With Cookie Domain
View Google Analytic Code-with-cookies-domain
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
ga('create', 'UA-XXXXX-Y', {'cookieDomain': ''});
ga('send', 'pageview');
You can’t perform that action at this time.