An example of creating custom blocks from a TailPress theme using Laravel Mix.
Example of a block in your webpack.mix.js file:
mix.js('/resources/blocks/example/block.js', '/blocks/example/block.build.js').react();
import pandas as pd | |
df = pd.read_csv('large_file.csv') | |
n = 49000 # Max number of rows you want each chunk to have | |
chunks = [df[i:i+n].copy() for i in range(0,df.shape[0],n)] | |
k = 1 | |
for chunk in chunks: | |
chunk.to_csv('data/chunk_{}.csv'.format(k), index=False) |
/** | |
* Little JS snippet to automatically update the WooCommerce single product page URL with the needed parameters for the active variations' selection. | |
* | |
* Each time the user changes the variation selection, the URL is updated with the new parameters, so on hard refresh the selected variation is displayed. | |
* | |
* Also, fast way to get the direct URL to the selected variation. | |
* | |
* Paste it into your browser console and run it. Or use it in your theme/plugins. | |
* | |
* @see https://stackoverflow.com/a/73138077/13765033 |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Title of the document</title> | |
</head> | |
<body> | |
<img loading="lazy" data-lazy | |
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkqAcAAIUAgUW0RjgAAAAASUVORK5CYII=" |
//Woocommerce Checkout JS events | |
$( document.body ).trigger( 'init_checkout' ); | |
$( document.body ).trigger( 'payment_method_selected' ); | |
$( document.body ).trigger( 'update_checkout' ); | |
$( document.body ).trigger( 'updated_checkout' ); | |
$( document.body ).trigger( 'checkout_error' ); | |
//Woocommerce cart page JS events | |
$( document.body ).trigger( 'wc_cart_emptied' ); | |
$( document.body ).trigger( 'update_checkout' ); |
<?php | |
//====================================================================== | |
// Add post state to the projects page | |
//====================================================================== | |
add_filter( 'display_post_states', 'ecs_add_post_state', 10, 2 ); | |
function ecs_add_post_state( $post_states, $post ) { |
var touchstartX = 0; | |
var touchstartY = 0; | |
var touchendX = 0; | |
var touchendY = 0; | |
var gesuredZone = document.getElementById('gesuredZone'); | |
gesuredZone.addEventListener('touchstart', function(event) { | |
touchstartX = event.screenX; | |
touchstartY = event.screenY; |
<html> | |
<head> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> | |
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script> | |
<script> | |
$(function() { | |
$(".video").click(function () { | |
var theModal = $(this).data("target"), | |
videoSRC = $(this).attr("data-video"), |
<?PHP | |
/** | |
* Spintax - A helper class to process Spintax strings. | |
*/ | |
class Spintax | |
{ | |
/** | |
* Set seed to make the spinner predictable. | |
*/ |
<?php | |
//Display Fields | |
add_action( 'woocommerce_product_after_variable_attributes', 'variable_fields', 10, 3 ); | |
//JS to add fields for new variations | |
add_action( 'woocommerce_product_after_variable_attributes_js', 'variable_fields_js' ); | |
//Save variation fields | |
add_action( 'woocommerce_process_product_meta_variable', 'save_variable_fields', 10, 1 ); | |
/** |