View post-no-sourced-attributes.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- 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 |
View counter.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const counter = async ({send, receive}) => { | |
let count = 0; | |
while (1) { | |
const [action, args] = await receive(); | |
switch (action) { | |
case 'inc': | |
count++; | |
break; |
View demo.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
View sequenced-async.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
View tag-hasher.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
View BlockParser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { |
View formula-block-editor.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { registerBlockType } = wp.blocks; | |
const { TextareaControl } = wp.components; | |
const { createElement: el } = wp.element; | |
const attributes = { | |
formula: { type: 'string' }, | |
rendered: { | |
type: 'string', | |
source: 'attribute', | |
selector: 'img', |
View Main.elm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main exposing (main) | |
import Browser as B | |
import Browser.Navigation as BN | |
import Html as H | |
import Html.Attributes as HA | |
import Html.Events as HE | |
import Url as U | |
View Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu | |
WORKDIR /tmp | |
ENV PACKAGES="\ | |
composer \ | |
curl \ | |
git \ | |
imagemagick \ | |
locales-all \ |
View Block.elm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
port module Main exposing (Flags, Model, Msg(..), init, main, subscriptions, update, view) | |
import Browser | |
import Html exposing (Html, button, div, input, text) | |
import Html.Attributes exposing (type_) | |
import Html.Events exposing (onClick, onInput) | |
port setAttributes : Flags -> Cmd msg | |
port getAttributes : (Flags -> msg) -> Sub msg |
NewerOlder