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 / media-blob.html
Last active May 11, 2019 18:01
Image, Video, Media as Blob URL
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<meta content="ie=edge" http-equiv="X-UA-Compatible">
<title>Image Blob</title>
</head>
@biswajitpaul01
biswajitpaul01 / enqueue-block-js-and-css-plugin.php
Created March 28, 2019 19:22 — forked from zgordon/enqueue-block-js-and-css-plugin.php
Example plugin file for enqueueing Gutenberg block JS and CSS
<?php
/**
* Enqueue block editor JavaScript and CSS
*/
function jsforwpblocks_editor_scripts() {
// Make paths variables so we don't write em twice ;)
$blockPath = '/assets/js/blocks.js';
$editorStylePath = '/assets/css/blocks.editor.css';
@biswajitpaul01
biswajitpaul01 / functions.php
Created March 28, 2019 15:28
Show Custom Input Field @ WooCommerce Single Product Page
<?php
// Source: https://businessbloomer.com/woocommerce-product-add-ons-without-plugin/?ck_subscriber_id=69986993
// -----------------------------------------
// 1. Show custom input field above Add to Cart
add_action( 'woocommerce_before_add_to_cart_button', 'bbloomer_product_add_on', 9 );
function bbloomer_product_add_on() {
$value = isset( $_POST['_custom_text_add_on'] ) ? sanitize_text_field( $_POST['_custom_text_add_on'] ) : '';
echo '<div><label>Custom Text Add-On <abbr class="required" title="required">*</abbr></label><p><input name="_custom_text_add_on" value="' . $value . '"></p></div>';
@biswajitpaul01
biswajitpaul01 / email.php
Created March 16, 2019 13:25
Send html mail without inline css
<?php
// To send HTML mail, the Content-type header must be set
$headers = [];
$headers[] = 'MIME-Version: 1.0';
$headers[] = 'Content-type: text/html; charset=iso-8859-1';
$headers[] = 'From: Do Not Reply <noreply@example.com>';
$content = '
<html>
<head>
@biswajitpaul01
biswajitpaul01 / index.html
Created November 24, 2018 13:00
scroll snapping
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/12005/gallery2.jpg">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/12005/gallery6.jpg">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/12005/gallery2.jpg">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/12005/gallery6.jpg">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/12005/gallery2.jpg">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/12005/gallery6.jpg">
@biswajitpaul01
biswajitpaul01 / import-export.html
Created November 1, 2018 18:05
Javascript Import Export
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Javascript Import Export Module Example</title>
</head>
<body>
<script type="module">
@biswajitpaul01
biswajitpaul01 / mysql-db-import-export.sh
Last active October 14, 2018 13:32
Mysql Database import expost
### Ref 1: https://www.tecmint.com/transfer-mysql-databases-from-old-to-new-server/
### Ref 2: http://osxdaily.com/2017/01/19/export-import-all-mysql-databases/
# Export all MySQL Databases to Dump File
> mysqldump -u [user] -p –all-databases > all_databases.sql
# If you want to dump a single database
> mysqldump -u root -p --opt [database name] > database_name.sql
# Transfer MySQL Databases Dump File to New Server
@biswajitpaul01
biswajitpaul01 / instructions.txt
Created August 16, 2018 19:47
UWAMP PHP Curl Setup
I had the same problem, but it only manifested when running PHP through Apache. In CLI it was fine - cURL was shown in phpinfo().
The solution was to replace several files in Apache's bin directory:
libeay32.dll
ssleay32.dll
libssh2.dll
nghttp2.dll
When PHP is run through Apache, its bin directory probably takes precedence over system %PATH% variable and therefore PHP's curl extension uses libraries from Apache, resulting in version mismatch (Apache's libraries seem to be older than required).
@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 / spinner.html
Created July 26, 2018 20:13
Wordpress Spinner
<span class="spinner is-active"></span>