node gutenberg-package-activity.mjs path/to/gutenbergWhen run without a path it will default to the current directory.
| <?php | |
| // Ensure you load the HTML API | |
| // - require_once __DIR__ . '/wp-load.php'; | |
| // - Manual requires | |
| // - PHP extension | |
| // - any other approach | |
| // Extracts the first table in the HTML, if one is found. | |
| // Usage: cat water-report.html | php table-to-csv.php |
| <?php | |
| /** | |
| * Place this file into a WordPress directory with a proper config and run. | |
| * It doesn't need the config, but it needs to load all of the HTML API and | |
| * Token Map modules. This can be done by replacing the `require_once` with | |
| * a `require_once` for each of the appropriate files. | |
| * | |
| * - With no arguments it prints the sample HTML. | |
| * - If the last argument is a dash (-), it reads the HTML from stdin. |
| import codecs | |
| import sys | |
| def prepend_bom(filename): | |
| with open( filename, 'r+b' ) as csv: | |
| existing = csv.read() | |
| if b'\xef\xbb\xbf' == existing[0:3]: | |
| print("Byte-order mark already present: leaving file as-is.") | |
| return |
| <!-- wp:paragraph {"content":"This paragraph has \u003cem\u003e\u003cstrong\u003eno sourced attributes\u003c/strong\u003e\u003c/em\u003e. It's content is fully stored inside the JSON attributes \u003cem\u003eand\u003c/em\u003e it still contains the rendered HTML useful for rendering it with no server is available."} --> | |
| <p>This paragraph has <em><strong>no sourced attributes</strong></em>. It's content is fully stored inside the JSON attributes <em>and</em> it still contains the rendered HTML useful for rendering it with no server is available.</p> | |
| <!-- /wp:paragraph --> | |
| <!-- wp:image {"url":"https://wordpress.org/files/2022/08/theme-styles.png","caption":"Image captions are usually sourced from the \u003ccode\u003efigcaption\u003c/code\u003e element.","width":650,"height":406,"sizeSlug":"large","linkDestination":"none"} --> | |
| <figure class="wp-block-image size-large is-resized"><img src="https://wordpress.org/files/2022/08/theme-styles.png" alt="" width="650" height="406"/><figcaption class="wp-element-captio |
| export const counter = async ({send, receive}) => { | |
| let count = 0; | |
| while (1) { | |
| const [action, args] = await receive(); | |
| switch (action) { | |
| case 'inc': | |
| count++; | |
| break; |
| const { spawn, send } = require('./process.js') | |
| const counter = spawn( async (receive) => { | |
| let count = 0; | |
| while (1) { | |
| const message = await receive(); | |
| if (message === 'inc') { | |
| console.log(++count); |
| import { MessageChannel, MessagePort } from 'worker_threads'; | |
| type ServerDescription<K extends string> = { | |
| [type in K]: (...args: unknown[]) => unknown; | |
| } | |
| type ServerHandler<M extends ServerDescription<keyof M>, S> = <T extends keyof M>(msg: T, state: S) => [ReturnType<M[T]>, S] | Promise<[ReturnType<M[T]>, S]>; | |
| class GenericServer<M extends ServerDescription<keyof M>, S = undefined> { | |
| count = 0; |
| import java.io.UnsupportedEncodingException; | |
| import java.net.URLEncoder; | |
| import java.text.Normalizer; | |
| import java.util.Locale; | |
| class TagHasher { | |
| public static String tagHash(String tagName) { | |
| try { | |
| String normalized = Normalizer.normalize(tagName, Normalizer.Form.NFC); | |
| String lowercased = normalized.toLowerCase(Locale.ENGLISH); |
| import java.util.ArrayList; | |
| import java.util.Stack; | |
| import java.util.regex.Matcher; | |
| import java.util.regex.Pattern; | |
| import com.google.gson.JsonElement; | |
| import com.google.gson.JsonObject; | |
| import com.google.gson.JsonParser; | |
| class BlockParser { |