Skip to content

Instantly share code, notes, and snippets.

View biswajitpaul01's full-sized avatar
🎯
Focusing

Biswajit Paul biswajitpaul01

🎯
Focusing
View GitHub Profile
@biswajitpaul01
biswajitpaul01 / set-blockui.js
Last active August 9, 2021 14:28
WooCommerce BlockUI Examples
// Add woocommerce class in body
<body <?php body_class('woocommerce'); ?>
// Set BlockUI on any element
jQuery(element).block({
message: null,
overlayCSS: {
cursor: 'none',
background: '#fff',
opacity: 0.6
@biswajitpaul01
biswajitpaul01 / example.html
Created July 28, 2018 14:17
navigator.sendBeacon example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Send Bacon Example</title>
</head>
<body>
<button type="button" id="button">Send Response</button>
@biswajitpaul01
biswajitpaul01 / _ide_helper.php
Created July 18, 2020 20:42
Laravel IDE helper
<?php
/**
* A helper file for Laravel 5, to provide autocomplete information to your IDE
* Generated for Laravel 5.5.13 on 2017-09-28.
*
* @author Barry vd. Heuvel <barryvdh@gmail.com>
* @see https://github.com/barryvdh/laravel-ide-helper
*/
namespace {
exit("This file should not be included, only analyzed by your IDE");
@biswajitpaul01
biswajitpaul01 / boilerplate.css
Last active April 19, 2020 11:01
Basic barebone css boilerplate
:active,:focus{outline:none;}
::-moz-focus-inner{border:0;}
input:focus,textarea:focus,button:focus{outline:none !important}
body{margin:0;padding:0}
img{height:auto;image-rendering:-webkit-optimize-contrast;max-width:100%}
select {
/* for Firefox */
-moz-appearance: none;
/* for Chrome */
-webkit-appearance: none;
@biswajitpaul01
biswajitpaul01 / css.json
Last active March 7, 2020 06:43
VSCode User Snippets
{
"wp.theme": {
"prefix": "wp.theme",
"body": [
"/*",
"Theme Name: $1",
"Theme URI: $2",
"Author: $3",
"Author URI: $4",
"Description: $5",
@biswajitpaul01
biswajitpaul01 / gravatar.php
Created March 7, 2020 05:36
Get avatar image from email address
<?php
if (!function_exists('get_avatar')) {
function get_avatar ($email, $size = 32, $default = 'mp') {
return 'https://www.gravatar.com/avatar/' . md5($email) . '?' . http_build_query( [ 's' => $size, 'd' => $default ] );
}
}
@biswajitpaul01
biswajitpaul01 / change-404-page.php
Created November 3, 2019 09:09
Helping Guides in Laravel
<?php
// File: app/Exceptions/Handler.php
namespace App\Exceptions;
use Exception;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
class Handler extends ExceptionHandler
{
@biswajitpaul01
biswajitpaul01 / settings.json
Created October 3, 2019 15:57
VSCode WordPress & Delpoy Extention Setup
// Plugin URL: https://marketplace.visualstudio.com/items?itemName=mkloubert.vs-deploy
{
"files.exclude": {
"**/wp-admin": true,
"**/wp-includes": true
},
"deploy": {
"openOutputOnDeploy": false,
"showPopupOnSuccess": true,
@biswajitpaul01
biswajitpaul01 / url-params.php
Created August 31, 2019 17:59
Extract query parameters from url
<?php
$href = 'https://in.pinterest.com/bhagyashrijadhav51/happy/?utm_campaign=rdboards&e_t=5c7cb45aadb34115ba86ab4531b61a23&utm_content=733664664235398280&utm_source=31&utm_term=3&utm_medium=2004';
$query_str = parse_url($href, PHP_URL_QUERY);
parse_str($query_str, $query_params);
echo $query_params['utm_campaign'];
@biswajitpaul01
biswajitpaul01 / cache.js
Created August 31, 2019 16:46
Browser Cache API
// Source: https://blog.logrocket.com/beyond-cookies-todays-options-for-client-side-data-storage/
const apiRequest = new Request('https://www.example.com/items');
caches.open('exampleCache') // opens the cache
.then(cache => {
cache.match(apiRequest) // checks if the request is cached
.then(cachedResponse =>
cachedResponse || // return cachedReponse if available
fetch(apiRequest) // otherwise, make new request
.then(response => {