Skip to content

Instantly share code, notes, and snippets.

View bryanrsebastian's full-sized avatar

Bryan Sebastian bryanrsebastian

View GitHub Profile
const fs = require('fs');
const fbiPath = 'Z:/';
new Promise( ( resolve, reject ) => {
/* Read filenames in specified directory */
fs.readdir( fbiPath, function( error, filenames ) {
if ( error ) return reject( error );
/* Filter out only csv files with old to new date */
@bryanrsebastian
bryanrsebastian / move_product_description
Created March 21, 2023 23:39
Move the product main description oustide of the tab
/* Move the product main description oustide of the tab */
function move_product_description() {
global $woocommerce, $post;
if ( $post->post_content ) : ?>
<div itemprop="description" class="item-description">
<?php $heading = apply_filters('woocommerce_product_description_heading', __('Product Description', 'woocommerce')); ?>
<!-- <h2><?php echo $heading; ?></h2> -->
/**
* Remove the "Place Order" button if the
* Product Variant is not available selling world wide
*/
add_filter( 'woocommerce_order_button_html', 'disable_place_order_button_html' );
function disable_place_order_button_html( $button ) {
/* Exit if the screen is Dashboard and not Checkout */
if( is_admin() && ! is_checkout() )
return $button;
@bryanrsebastian
bryanrsebastian / CSS
Last active June 9, 2021 02:37
Simple Cookie Consent
.dp-cookie {
display: none;
position: fixed;
z-index: 11;
bottom: 18px;
left: 50%;
transform: translateX(-50%);
background-color: #2e2e2b;
width: calc(100% - 50px);
max-width: 1500px;
@bryanrsebastian
bryanrsebastian / Featured Image Wordpress Insructions
Created January 19, 2021 22:21
Add an instructions on Featured Image box of the certain Post Type
$( document ).ready( function() {
/** Features Recent Posts Search Functionality **/
$( '#__search_recent' ).keyup( function( event ) {
var search = $( this ).val().toUpperCase();
$( '#features_archive .__recent_post_sub_container' ).each( function( index, el ) {
if( $( 'a', el ).text().toUpperCase().indexOf( search ) > -1 ) {
$( el ).show();
// $(".__recent_post_sub_container:nth-of-type(11)").addClass('hide-post');
// $(".__recent_post_sub_container:nth-of-type(12)").addClass('hide-post');
$(".__recent_post_sub_container:nth-of-type(11)").removeClass('hide-post-hidden');
@bryanrsebastian
bryanrsebastian / Custom Radio Button - CSS
Created January 11, 2021 02:00
Custom Radio Button
.__radio_field {
border: 1px solid #767676;
padding: 8px 15px;
input {
position: absolute;
width: 0;
height: 0;
opacity: 0;
cursor: default;
&:checked ~ label {
@bryanrsebastian
bryanrsebastian / Custom Select - HTML
Last active January 11, 2021 01:59
Custom Select
<div class="__select_field">
<div class="__select">
<p class="__selected" data-selected="all-locations">All Locations</p>
<div class="__select--list">
<div>
<p data-value="all-locations">All Locations</p>
<p data-value="location-1">Location 1</p>
<p data-value="location-2">Location 2</p>
<p data-value="location-3">Location 3</p>
<p data-value="location-4">Location 4</p>
@bryanrsebastian
bryanrsebastian / Debounce
Created December 17, 2020 06:09
Use debounce function to make the resize event more optimized
var titleHeight = debounce( () => { //active the function every 250ms to improve website performance
var maxTitleHeight = Math.max.apply( null, $( '.__tag .__details h3' ).map( function () {
return $( this ).height();
} ).get() );
if( window.innerWidth > 548 ) {
$( '.__tag .__details h3' ).height( maxTitleHeight );
} else {
$( '.__tag .__details h3' ).height( 'auto' );
}