Skip to content

Instantly share code, notes, and snippets.

View artlung's full-sized avatar
💭
🤖

Joe Crawford artlung

💭
🤖
View GitHub Profile
/**
* Given an array of objects representing bears in a forest, each with a
* name and hunger level, return the names of all bears whose hunger
* level is above the forest average, sorted alphabetically.
*
* @param bears{name: string, hunger: number}[]
* @returns {string[]}
*/
function hungryBears(bears) {
// Was happy to reacquaint myself with [],reduce and "".localeCompare
@artlung
artlung / rsvp.html.twig
Last active January 6, 2026 15:48
rsvp.html.twig
<div class="h-entry" id="{{ rsvp.id }}">
<p class="p-summary">
{% include 'rsvp_author_tag.html.twig' %}
RSVPs <span class="p-rsvp">{{ rsvp.yes_no_maybe }}</span>
to <a href="{{ event.url }}" class="u-in-reply-to">{{ event.name }}</a>
({{ event.date }})
</p>
<time class="dt-published" datetime="{{ rsvp.published_datetime }}"></time>
<a class="u-url" href="{{ rsvp.url }}"></a>
</div>
/**
*
* Replaces sequences of repeated numeric characters in a string with the length of that sequence.
*
* @param $inputString string A string of numeric characters
* @param $numberToReplaceWithLengthsOf int A single digit (0-9)
*
*/
function replaceRepeats(string $inputString, int $numberToReplaceWithLengthsOf): string
{
/* style.css | https://test-lprry.statichost.eu/assets/css/style.css */
.snaps-vertical img {
/* width: 215px; */
width: clamp(215px, 100%, 300px);
transition: 300ms transform;
height: auto;
}
@artlung
artlung / -artlung-transitions.scss
Created December 3, 2025 23:13
Transitions on artlung.com as of 2025-12-03
@view-transition {
navigation: auto;
}
/* Customize the default animation behavior */
// TODO:
// view transition name
// view transition class
1 REM ARTLUNG START
3 CALL CLEAR
5 CALL CHAR(33, "000000FFFFFFFFFF")
7 CALL VCHAR(11, 1, 33)
11 CALL VCHAR(11, 2, 33)
15 CALL VCHAR(11, 3, 33)
19 CALL VCHAR(11, 4, 33)
23 CALL VCHAR(11, 5, 33)
27 CALL VCHAR(11, 6, 33)
31 CALL VCHAR(11, 7, 33)
@artlung
artlung / .htaccess
Created July 17, 2025 19:47
.htaccess llm blocking
# https://serverfault.com/questions/1162651/blocking-bots-with-apache-htaccess
RewriteCond %{HTTP_USER_AGENT} ^.*(AdsBot-Google|Amazonbot|anthropic-ai|Applebot|Applebot-Extended|AwarioRssBot|AwarioSmartBot|Bytespider|CCBot|ChatGPT|ChatGPT-User|Claude-Web|ClaudeBot|cohere-ai|DataForSeoBot|Diffbot|GPTBot|ImagesiftBot|magpie-rawler|omgili|Omgilibot|peer39_crawler|PerplexityBot|YouBot|AhrefsBot|Barkrowler|SemrushBot|DotBot).*$ [NC]
# https://www.jwz.org/blog/2025/05/user-agent-blocking/#comment-259200
RewriteRule .* - [F,L]
@artlung
artlung / TextEdit.html
Created July 3, 2025 16:35
TextEdit.html, a TextEdit document saved as HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="2575.6">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
@artlung
artlung / 1.json
Last active May 30, 2025 17:19
extracting video from Internet Archive @indieweb account?
{
"uid": "R:4d57aef70195e0e067aa-S:00b052d05399b263887c-P:1-K:h-T:1748573396188",
"version": "1s5",
"session_context": {
"session_key": "guest",
"created": "2025-05-30T02:49:56Z",
"client_characterization": {
"characterized_by": "not_asserted_or_authenticated",
"preferred_client_ip": null,
"client_ip": "76.167.245.116:sra",
@artlung
artlung / artlung_author_tag.html.twig
Created April 18, 2025 15:27
Likes Twig Templates by Joe Crawford (from https://artlung.com/likes/
<a href="https://artlung.com" class="p-author h-card">
Joe Crawford
<img src="https://artlung.com/blog/wp-content/uploads/2023/02/[email protected]"
class="u-photo" alt=""
style="display: none;"
/>
</a>