Skip to content

Instantly share code, notes, and snippets.

View dg's full-sized avatar
🏠
Working from home

David Grudl dg

🏠
Working from home
View GitHub Profile
@dg
dg / classes.php
Created August 11, 2023 11:11
Why NEON is better than YAML for dependency injection configuration
<?php
class FooSettings
{
public function __construct(
public readonly int $id,
public readonly string $name,
) {
}
}
@dg
dg / html.regex
Last active April 9, 2025 23:22
Regular expression for parsing HTML
~
(?(DEFINE)
(?<entity>
&
(
[a-z][a-z0-9]+ # named entity
|
\#\d+ # decimal number
|
@dg
dg / gist:72bc9f585a068d2e9c4edc5ae4c6d9ee
Created October 6, 2024 01:19
gpt-4o-canmore system prompt
## canmore
// # The `canmore` tool creates and updates text documents that render to the user on a space next to the conversation (referred to as the "canvas").
// Lean towards NOT using `canmore` if the content can be effectively presented in the conversation. Creating content with `canmore` can be unsettling for users as it changes the UI.
// ## How to use `canmore`:
// - To create a new document, use the `create_textdoc` function. Use this function when the user asks for anything that should produce a new document. Also use this when deriving a new document from an existing one.