-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
259 lines (235 loc) · 11.9 KB
/
Copy pathindex.html
File metadata and controls
259 lines (235 loc) · 11.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>~/.projects — jeffrey chen</title>
<meta name="description" content="Jeffrey Chen's web projects, listed in a vi buffer. Click a name or type its number to open.">
<style>
:root{
--bg:#0b0b0b; --fg:#d6d6d6; --dim:#6a6a6a; --faint:#3a3a3a;
--hi-bg:#d6d6d6; --hi-fg:#0b0b0b; --accent:#ffffff;
--gutw:2ch; --namew:17ch;
}
*{margin:0;padding:0;box-sizing:border-box}
html,body{height:100%}
body{
background:var(--bg);color:var(--fg);
font-family:"SF Mono",ui-monospace,"DejaVu Sans Mono",Menlo,Consolas,"Liberation Mono",monospace;
font-size:15px;line-height:1.6;
-webkit-font-smoothing:antialiased;
text-shadow:0 0 1px rgba(255,255,255,.12);
overflow:hidden;
}
body::after{
content:"";position:fixed;inset:0;pointer-events:none;z-index:20;opacity:.5;
background:repeating-linear-gradient(0deg,rgba(0,0,0,0) 0 2px,rgba(0,0,0,.25) 2px 3px);
mix-blend-mode:multiply;
}
.screen{display:flex;flex-direction:column;height:100vh;padding:14px 0 0}
.buf{flex:1 1 auto;overflow-y:auto;padding:0 16px;scrollbar-width:none}
.buf::-webkit-scrollbar{display:none}
.line{white-space:pre;overflow:hidden;height:1.6em}
.comment{color:var(--dim)}
.tilde{color:var(--faint)}
a.proj{display:block;color:var(--fg);text-decoration:none;white-space:pre;height:1.6em;overflow:hidden;outline:none;cursor:pointer}
a.proj .gutter{display:inline-block;width:var(--gutw);text-align:right;padding-right:1ch;color:var(--dim)}
a.proj .cur{display:inline-block;width:1ch}
a.proj .name{display:inline-block;width:var(--namew)}
a.proj .dots{color:var(--faint)}
a.proj .desc{color:var(--dim)}
/* cursorline (active / hover / focus): inverted like a vi selection */
a.proj.active{background:var(--hi-bg);color:var(--hi-fg)}
a.proj.active .gutter,a.proj.active .dots,a.proj.active .desc{color:var(--hi-fg)}
a.proj.active .name{color:var(--hi-fg);font-weight:600}
/* blinking block cursor before the active line's name */
a.proj.active .cur{background:var(--hi-fg);animation:blink 1.05s steps(1) infinite}
@keyframes blink{50%{background:transparent}}
@media (prefers-reduced-motion:reduce){a.proj.active .cur{animation:none}}
.status{flex:0 0 auto;background:var(--hi-bg);color:var(--hi-fg);
display:flex;justify-content:space-between;padding:1px 10px;font-weight:600;text-shadow:none;white-space:pre}
.cmd{flex:0 0 auto;height:1.7em;padding:0 12px;color:var(--fg);white-space:pre;overflow:hidden}
.cmd .tgt{color:var(--accent)}
@media (max-width:560px){ body{font-size:12.5px} a.proj .desc,.comment .opt{display:none} }
/* ---- boot splash: a shell types `vim .projects`, then a CRT power-on into the buffer ---- */
#splash{position:fixed;inset:0;z-index:50;background:var(--bg);color:var(--fg);
padding:14px 16px;overflow:hidden;text-shadow:0 0 1px rgba(255,255,255,.12)}
#splash pre{margin:0;white-space:pre-wrap;font:inherit}
#splash .bcur{display:inline-block;width:1ch;background:var(--fg);animation:scblink 1.05s steps(1) infinite}
@keyframes scblink{50%{background:transparent}}
</style>
<noscript><style>#splash{display:none!important}</style></noscript>
</head>
<body>
<div id="splash"><pre id="sh"></pre></div>
<div class="screen">
<div class="buf" id="buf">
<div class="line comment">" ~/.projects</div>
<div class="line comment">" jeffrey chen — things i've built.<span class="opt"> click a name, or type a number, then ⏎</span></div>
<div class="line"> </div>
<!-- Add a project = add one <a> line below. Ordinals, gutter width, name column,
and the hints all auto-compute from the list; nothing else to touch. Newest first. -->
<a class="proj" href="https://jcoder121.github.io/cc_scraper/"><span class="gutter"></span><span class="cur"> </span><span class="name">cc_scraper</span><span class="dots"> ...... </span><span class="desc">ccbrew, a morning digest of claude code projects</span></a>
<a class="proj" href="https://jcoder121.github.io/claude_code_nano/"><span class="gutter"></span><span class="cur"> </span><span class="name">claude_code_nano</span><span class="dots"> ...... </span><span class="desc">build your own Claude Code, a guided project</span></a>
<a class="proj" href="https://jcoder121.github.io/chirp/"><span class="gutter"></span><span class="cur"> </span><span class="name">chirp</span><span class="dots"> ...... </span><span class="desc">local, private dictation for macOS</span></a>
<a class="proj" href="https://jcoder121.github.io/ascii-visualizer/"><span class="gutter"></span><span class="cur"> </span><span class="name">ascii-visualizer</span><span class="dots"> ...... </span><span class="desc">sound rendered as ascii</span></a>
<a class="proj" href="https://jcoder121.github.io/craps/"><span class="gutter"></span><span class="cur"> </span><span class="name">craps</span><span class="dots"> ...... </span><span class="desc">a live craps table</span></a>
<a class="proj" href="https://jcoder121.github.io/twenty_four/"><span class="gutter"></span><span class="cur"> </span><span class="name">twenty-four</span><span class="dots"> ...... </span><span class="desc">a 24-game solver & web terminal</span></a>
<a class="proj" href="https://jcoder121.github.io/low-poly-worlds/"><span class="gutter"></span><span class="cur"> </span><span class="name">low-poly-worlds</span><span class="dots"> ...... </span><span class="desc">wander miniature 3d worlds</span></a>
<div class="line"> </div>
<div id="tildes"></div>
</div>
<div class="status">
<span id="st-left">~/.projects</span>
<span id="st-right">NORMAL utf-8 1,1 All</span>
</div>
<div class="cmd" id="cmd"></div>
</div>
<script>
(function(){
var buf = document.getElementById('buf');
var cmd = document.getElementById('cmd');
var stRight= document.getElementById('st-right');
var projs = Array.prototype.slice.call(document.querySelectorAll('a.proj'));
var lines = Array.prototype.slice.call(document.querySelectorAll('#buf .line, #buf a.proj'));
var N = projs.length;
var idx=0, pending='', pTimer=null, lastKey='';
var LH = 1.6 * parseFloat(getComputedStyle(document.body).fontSize);
// ---- data-driven layout: numbering + column widths (scales to any N) ----
lines.forEach(function(el,i){ el.dataset.row = i+1; });
var maxName = 0;
projs.forEach(function(p,i){
p.querySelector('.gutter').textContent = (i+1);
maxName = Math.max(maxName, p.querySelector('.name').textContent.length);
});
var root = document.documentElement.style;
root.setProperty('--gutw', (String(N).length) + 'ch');
root.setProperty('--namew', (maxName + 1) + 'ch');
function baseCmd(){
cmd.innerHTML = N ? ('type <b>1–'+N+'</b> or <b>j</b>/<b>k</b> then <b>⏎</b> — or click — to open a project')
: '" no projects"';
}
function target(p){ return p.getAttribute('href').replace(/^https?:\/\//,'').replace(/\/$/,''); }
function pos(){
if(buf.scrollHeight <= buf.clientHeight + 1) return 'All';
if(buf.scrollTop <= 0) return 'Top';
if(buf.scrollTop + buf.clientHeight >= buf.scrollHeight - 1) return 'Bot';
return Math.round(buf.scrollTop / (buf.scrollHeight - buf.clientHeight) * 100) + '%';
}
function status(){
var row = N ? projs[idx].dataset.row : 1;
stRight.textContent = 'NORMAL utf-8 ' + row + ',1 ' + pos();
}
function setActive(i, scroll){
if(!N) return;
projs[idx] && projs[idx].classList.remove('active');
idx = Math.max(0, Math.min(N-1, i));
var p = projs[idx];
p.classList.add('active');
if(scroll) p.scrollIntoView({block:'nearest'});
cmd.innerHTML = ':e <span class="tgt">' + target(p) + '</span>';
status();
}
function open(i){ if(projs[i]) window.location.href = projs[i].getAttribute('href'); }
// ---- multi-digit "open project N" (scales past 9) ----
function couldExtend(pfx){
for(var n=1;n<=N;n++){ var s=''+n; if(s.length>pfx.length && s.slice(0,pfx.length)===pfx) return true; }
return false;
}
function resolvePending(){
clearTimeout(pTimer); pTimer=null;
if(!pending) return;
var n = parseInt(pending,10), pv = pending; pending='';
if(n>=1 && n<=N){ open(n-1); }
else { cmd.textContent = 'E486: no project '+pv; setTimeout(baseCmd, 1300); }
}
document.addEventListener('keydown', function(e){
var k = e.key;
if(/^[0-9]$/.test(k)){
pending += k;
cmd.innerHTML = 'open → <span class="tgt">'+pending+'</span>';
clearTimeout(pTimer);
if(couldExtend(pending)) pTimer = setTimeout(resolvePending, 700);
else resolvePending();
lastKey=k; e.preventDefault(); return;
}
if(k==='j' || k==='ArrowDown'){ pending=''; setActive(idx+1,true); }
else if(k==='k' || k==='ArrowUp'){ pending=''; setActive(idx-1,true); }
else if(k==='G'){ pending=''; setActive(N-1,true); }
else if(k==='g'){ if(lastKey==='g'){ setActive(0,true); } }
else if(k==='Enter'){ if(pending) resolvePending(); else open(idx); }
else if(k==='l' || k===' '){ open(idx); }
else if(k==='Escape'){ pending=''; baseCmd(); }
else { lastKey=k; return; }
lastKey=k; e.preventDefault();
});
projs.forEach(function(p,i){
p.addEventListener('mouseenter', function(){ setActive(i,false); });
p.addEventListener('focus', function(){ setActive(i,false); });
});
// ---- fill leftover rows with tildes (only when content is shorter than the buffer) ----
function fillTildes(){
var host = document.getElementById('tildes');
host.innerHTML = '';
var used = 0;
Array.prototype.forEach.call(buf.children, function(c){ if(c.id!=='tildes') used += c.getBoundingClientRect().height; });
var n = Math.max(0, Math.floor((buf.clientHeight - used) / LH));
var s = '';
for(var i=0;i<n;i++) s += '<div class="line tilde">~</div>';
host.innerHTML = s;
status();
}
buf.addEventListener('scroll', status);
window.addEventListener('resize', fillTildes);
fillTildes();
if(N) setActive(0,false);
baseCmd(); // show the hint until the user interacts
})();
</script>
<script>
/* ---- boot splash: `$ vim .projects` → smooth cross-dissolve into the buffer. ~2s, every visit, no skip. ---- */
(function(){
var splash = document.getElementById('splash');
var sh = document.getElementById('sh');
if(!splash || !sh) return;
var reduce = window.matchMedia && matchMedia('(prefers-reduced-motion: reduce)').matches;
var out = '';
function paint(cursor){
sh.innerHTML = out.replace(/&/g,'&').replace(/</g,'<') + (cursor ? '<span class="bcur"> </span>' : '');
}
function sleep(ms){ return new Promise(function(r){ setTimeout(r, ms); }); }
function put(s){ out += s; paint(true); }
async function type(s){
for(var i=0;i<s.length;i++){ out += s[i]; paint(true); await sleep(reduce?0:(22 + Math.random()*12)); }
}
async function run(){
put('Last login: Sat Jul 19 21:40:12 on ttys001\n');
await sleep(reduce?0:100);
put('jeffrey@jcoder ~ % ');
await type('ls -a | grep projects'); put('\n');
await sleep(reduce?0:80);
put('.projects\n');
await sleep(reduce?0:140);
put('jeffrey@jcoder ~ % ');
await type('vim .projects');
await sleep(reduce?0:160);
paint(false); // drop the cursor, as if <Enter>
await boot();
if(splash.parentNode) splash.remove();
window.dispatchEvent(new Event('resize')); // re-measure the buffer now that it's visible
}
// smooth cross-dissolve: the shell text fades out (lifting a touch) as the buffer resolves in
async function boot(){
if(reduce){ splash.style.display='none'; return; }
await splash.animate(
[{opacity:1, transform:'translateY(0)'},
{opacity:0, transform:'translateY(-6px)'}],
{duration:360, easing:'ease', fill:'forwards'}
).finished;
splash.style.display='none';
}
if(document.readyState==='loading') document.addEventListener('DOMContentLoaded', run); else run();
})();
</script>
</body>
</html>