Skip to content

Instantly share code, notes, and snippets.

@patiboh
patiboh / classloom.js
Created March 11, 2026 07:37 — forked from matthiask/classloom.js
ProseMirror/Tiptap extension for adding classes to nodes, marks and inline text
/**
* ClassLoom Extension
*
* Adds CSS class management to ProseMirror nodes and marks.
* Works with any node type (paragraphs, tables, lists, etc.) and any mark type (italic, bold, etc.).
*
* Features:
* - Multiple class groups targeting different node/mark types
* - Combinable groups (multiple classes from same group)
* - Special "text" type: creates one separate mark per group (allows combining multiple text class groups)
@patiboh
patiboh / what-forces-layout.md
Created July 14, 2024 22:25 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@patiboh
patiboh / SPACE_INVADERS.md
Last active September 13, 2022 15:58
Emoji Space Invaders

Space Invaders

Running the program

To run the program you can run server locally using python. Once you have python installed, run the following command at the project root:

python -m http.server --bind 127.0.0.1
@patiboh
patiboh / wp-add-preview-column.php
Created June 28, 2018 22:08
WP - Add preview thumbnail to custom post (with ACF)
<?php
/**
* Add preview thumbnail to custom posts lists
* @param array $columns columns array
*/
function add_preview_column($columns){
array_splice($columns, 1, 0, array('preview' => __('Preview', 'scwp')));
return $columns;
}
add_filter('manage_posts_columns', __NAMESPACE__ . '\\add_preview_column', 2);
@patiboh
patiboh / yarn-clean-cache.bash
Created March 13, 2018 21:09
Yarn - Clean cache
rm -rf node_modules && rm yarn.lock && yarn cache clean
@patiboh
patiboh / system-fonts.css
Last active November 3, 2019 10:39
CSS/Fonts - System font stack
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
"Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
sans-serif;
}
@patiboh
patiboh / lessive-maison.md
Last active March 25, 2023 17:44
Recipe / Home - Lessive maison

Lessive maison

Ingrédients [FR]

  • 2 litres d'eau filtrée
  • 150 gr de savon de Marseille râpé
  • 150 gr de cristaux de soude : dégraisse, détache et adoucit l'eau (attention ne pas confondre avec la soude caustique très dangereuse)
  • 6 cuillères à soupe de bicarbonate de soude : neutralise les acides et les odeurs, adoucit l'eau.
  • 1 cuillère à café d'huile essentielle (ici lavandin et citron ) : désinfecte et parfume.

ASI - Automatic Semicolon Insertion in Javascript

Spec : http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf

NOTE: when we say "a semicolon is (not) inserted" : it means, "a semicolon is (not) automatically inserted by the parser using the ASI rules"

Writing Javascript without semicolons implies understanding how the Javascript parser applies ASI rules..

ASI Rules

@patiboh
patiboh / grunt-debug.md
Last active May 26, 2018 22:20
Grunt / Debug - Make grunt talk
grunt [task] --verbose --debug [--force] --stack
@patiboh
patiboh / mixins.scss
Last active March 26, 2021 10:17
SASS - Utility mixins
//== Layout
//
@mixin full_width {
position: relative;
left: 0;
right: 0;
width: 100%;
}
@mixin centered-content {