This is inspired by A half-hour to learn Rust and Zig in 30 minutes.
Your first Go program as a classical "Hello World" is pretty simple:
First we create a workspace for our project:
<artifacts_info> | |
The assistant can create and reference artifacts during conversations. Artifacts are for substantial, self-contained content that users might modify or reuse, displayed in a separate UI window for clarity. | |
# Good artifacts are... | |
- Substantial content (>15 lines) | |
- Content that the user is likely to modify, iterate on, or take ownership of | |
- Self-contained, complex content that can be understood on its own, without context from the conversation | |
- Content intended for eventual use outside the conversation (e.g., reports, emails, presentations) | |
- Content likely to be referenced or reused multiple times |
This is inspired by A half-hour to learn Rust and Zig in 30 minutes.
Your first Go program as a classical "Hello World" is pretty simple:
First we create a workspace for our project:
/** | |
* Write JSX, but make sure you have `import html from 'htm/preact'` in your files. | |
* Run them through this horrid attrocity and get JSX support with basically no overhead. | |
*/ | |
export function transformJsxToHtm(code) { | |
const tokenizer = /(^|)(?:<\/([a-z$_][a-z0-9_.-:]*)>|<([a-z$_][a-z0-9_.-:]*)(\s+[a-z0-9._-]+(?:=(?:".*?"|'.*?'|\{.+?\}))?)*(\s*\/\s*)?>|<(\/?)>)/gi; | |
let out='', index=0, token; | |
let depth = 0; | |
let stacks = []; | |
let shouldPop = false; |
This is side-document providing details for some highlighted changes in 2.5.0. For a full list of changes, see the full release note.
Rollup 0.48 introduces a few changes to the options
object, because the current options are confusingly different between the CLI and the options exported by your config file.
entry
is now input
sourceMap
and sourceMapFile
are now sourcemap
and sourcemapFile
(note casing)moduleName
is now name
useStrict
is now strict
The dest
and format
options are now grouped together as a single output: { file, format, ... }
object. output
can also be an array of { file, format, ... }
objects, in which case it behaves similarly to the current targets
. Other output options — exports
, paths
and so on — can be added to the output
object (though they will fall back to their top-level namesakes, if unspecified).
[ Update 2025-03-24: Commenting is disabled permanently. Previous comments are archived at web.archive.org. ]
Most of the terminal emulators auto-detect when a URL appears onscreen and allow to conveniently open them (e.g. via Ctrl+click or Cmd+click, or the right click menu).
It was, however, not possible until now for arbitrary text to point to URLs, just as on webpages.
#! /usr/bin/env bash | |
# Usage: git-io URL [CODE] | |
# | |
# Turns a github.com URL | |
# into a git.io URL | |
URL="$1" | |
CODE="$2" |
Can't share the complete code because the app's closed source and still in stealth mode, but here's how I'm using React Router and Redux in a large app with server rendering and code splitting on routes.
addReducers()
callback available to the getComponents()
method of
each React Router route. Each route is responsible for adding any Redux
reducers it needs when it's loaded. (This isn't really necessary on the