Skip to content

Instantly share code, notes, and snippets.

View btucker's full-sized avatar
👋

Ben Tucker btucker

👋
View GitHub Profile
@btucker
btucker / code.html
Created December 29, 2025 22:49
claude-code-transcripts local 56e5f88c-6e43-464b-b415-5b29cbae20c2
<!DOCTYPE html>
<html lang="en">
<head>
<script>window.DATA_GIST_ID = "61e520bb9dea7beae31cd9d494284256";</script>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Claude Code transcript - Code</title>
<link rel="stylesheet" href="styles.css">
</head>
@btucker
btucker / code-data.json
Created December 29, 2025 22:49
claude-code-transcripts local 56e5f88c-6e43-464b-b415-5b29cbae20c2 (data)
This file has been truncated, but you can view the full file.
{"fileData": {"/tmp/http-proxy-server/spec.md": {"file_path": "/tmp/http-proxy-server/spec.md", "rel_path": "http-proxy-server/spec.md", "content": "# HTTP Proxy Server Specification\n\n## Overview\nBuild a uvicorn-based HTTP proxy server that proxies requests to simonwillison.net, adding custom headers for identification and performance monitoring.\n\n## Requirements\n\n### Core Functionality\n- [x] Accept HTTP requests on localhost:8000\n- [x] Proxy all requests to simonwillison.net at the same path\n- [x] Preserve HTTP method (GET, POST, etc.)\n- [x] Preserve request headers (except Host)\n- [x] Preserve request body for POST/PUT/PATCH requests\n- [x] Return proxied response with original status code and headers\n\n### Headers\n- [x] Add `x-proxied-by: uvicorn` header to proxied response\n- [x] Add `x-response-time-microseconds` header with the time taken to proxy the request (in microseconds)\n- [x] Measure only the upstream request time, not the whole request cycle\n\n### Implementation\n- [x] Use httpx
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>forEach vs. map</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>

I need a way to write WebSocket client code that runs on a server in Node.js.

What it must do: Exactly what this browser-based app does, only running on a server, without the UI stuff.

https://github.com/scripting/1999client/blob/master/code.js#L133

It would make so much sense if Node implemented exactly the browser API for WebSockets, native. So much of Node works that way. But this is one of those times when it doesn't.

There are a few toolkits that do WebSockets on the server. But there isn't simple clean sample code that I've been able to convert to this application. I tried! :-)

@btucker
btucker / gist:d0b737170fbb759a129d
Created May 22, 2014 12:08
Overriding humanization of a particular ActiveRecord column
def self.human_attribute_name(col, options={})
col = case col.to_s
when "address"
"email address"
else
col
end
super(col, options)
end

Keybase proof

I hereby claim:

  • I am btucker on github.
  • I am btucker (https://keybase.io/btucker) on keybase.
  • I have a public key whose fingerprint is FDE0 4E59 2DFA C6FC 37DC 08B2 D671 1E5F E0CE 45FB

To claim this, I am signing this object:

@btucker
btucker / gist:5909226
Created July 2, 2013 13:18
Two rows per item in angular.
<table>
<tr><td>Number</td><td>Price</td><tr>
<tbody ng-repeat="order in orders">
<tr><td>{{order.description}}</td></tr>
<tr>
<td>{{order.number}}</td>
<td>{{order.price}}</td>
</tr>
</tbody>
</table>
@btucker
btucker / _.md
Created May 5, 2013 18:06
interactive areas
@btucker
btucker / gist:4506704
Last active December 10, 2015 23:08
dscourse <-> CANLEAD LTI
<form action='http://example.com/shiva/lti/receive.php' encType='application/x-www-form-urlencoded'>
<input name="oauth_consumer_key" type="hidden" value="key" />
<input name="oauth_signature_method" type="hidden" value="HMAC-SHA1" />
<input name="oauth_timestamp" type="hidden" value="1357860362" />
<input name="oauth_nonce" type="hidden" value="bwXOUxuuT2FV2VZ8EIbPqu7TwVetdgXigF30JmoPXrs" />
<input name="oauth_version" type="hidden" value="1.0" />
<input name="context_id" type="hidden" value="13" />
<input name="context_title" type="hidden" value=" Middle School Math (Master)" />
<input name="launch_presentation_return_url" type="hidden" value="http://uva-canlead.dev/modules/13" />
<input name="lis_person_contact_email_primary" type="hidden" value="ben@btucker.net" />