Skip to content

Instantly share code, notes, and snippets.

View samesteban's full-sized avatar

Sam Esteban samesteban

View GitHub Profile
@samesteban
samesteban / rtwp_filter_wordcount_acf.php
Created October 22, 2021 22:08 — forked from ihorduchenko/rtwp_filter_wordcount_acf.php
Hooking into WP Reading time plugin - Advanced custom fields (ACF) + Flexible content (rtwp_filter_wordcount filter)
function up_the_count( $count ) {
global $post;
$id = $post->ID;
$post_type = get_post_type($id);
switch ($post_type) {
case 'post':
if ( have_rows( 'content', $id ) ):
while ( have_rows( 'content', $id ) ) : the_row();
if ( get_row_layout() == 'paragraph_section' ):
$count += count( preg_split( '/\s+/', get_sub_field( 'paragraph' ) ) );
@samesteban
samesteban / vite-testing-config.md
Created January 16, 2024 15:56 — forked from Klerith/vite-testing-config.md
Vite + Jest + React Testing Library - Configuraciones a seguir

Instalación y configuracion de Jest + React Testing Library

En proyectos de React + Vite

  1. Instalaciones:
yarn add --dev jest babel-jest @babel/preset-env @babel/preset-react 
yarn add --dev @testing-library/react @types/jest jest-environment-jsdom
  1. Opcional: Si usamos Fetch API en el proyecto:
@samesteban
samesteban / templateSlice.js
Created January 23, 2024 14:09 — forked from Klerith/templateSlice.js
Cascaron para crear Redux Slices rápidamente
import { createSlice } from '@reduxjs/toolkit';
export const templateSlice = createSlice({
name: 'name',
initialState: {
counter: 10
},
reducers: {
increment: (state, /* action */ ) => {
//! https://react-redux.js.org/tutorials/quick-start