-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
1322 lines (1179 loc) · 54.3 KB
/
Copy pathindex.html
File metadata and controls
1322 lines (1179 loc) · 54.3 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
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html>
<head>
<title>Robin Saxifrage | Sr. Software Developer</title>
<!--
This is the result of a few evenings' work, I certainly wouldn't claim everything in here
is top notch.
-->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Merriweather+Sans:wght@400;700&family=Merriweather:wght@400;700&display=swap" rel="stylesheet">
<meta name="viewport" content="width=device-width">
<meta charset="utf-8"/>
<style>
* {
box-sizing: border-box;
margin: 0rem;
padding: 0rem;
}
html, body {
min-height: 100vh;
background-color: #141414;
color: #e0e0e0;
font-family: 'Merriweather', serif;
overflow-x: hidden;
}
button {
background-color: #373737;
color: #e0e0e0;
border: none;
outline: none;
cursor: pointer;
font-weight: bold;
}
h1, h2, h3 {
margin-bottom: 1rem;
}
b {
color: #e0e0e0;
}
ul {
padding-left: 2rem;
margin: 1rem 0rem;
}
ul li {
font-size: 0.9rem;
margin-bottom: 1rem;
}
button {
font-size: 1rem;
line-height: 1.25rem;
border-radius: 2px;
width: 1.5rem;
height: 1.5rem;
margin: 0.5rem 0.25rem;
background-color: #373737;
}
button.active {
background-color: #646464;
}
.secondary {
color: #999999;
}
.footnote {
font-size: 0.7rem;
}
.footnote:not(.no-margin):last-child {
margin-top: 1.5rem;
}
.footnote:not(.no-margin):first-child {
margin-bottom: 1.5rem;
}
.smaller-text {
font-size: 0.9rem;
}
.smallest-text {
font-size: 0.7rem;
}
[data-insert]:not(.inserted) {
filter: blur(4px);
}
.swarm-anim {
position: absolute;
z-index: 1;
top: 0rem;
left: 0rem;
pointer-events: none;
overflow: visible;
}
.main-container {
width: 70rem;
margin: 0px auto;
padding-top: 4rem;
}
.content-panel {
position: relative;
z-index: 2;
display: inline-block;
vertical-align: top;
width: calc(100% - 8rem);
margin: 2rem;
border: 1px solid #333333;
background-color: #202020;
}
.content-panel.secondary-content {
width: calc(50% - 10rem);
padding: 1rem;
font-size: 0.8rem;
}
.content-panel.intro-content {
width: 34rem;
padding: 1.5rem;
}
.content-panel.body-content-a {
width: calc(60% - 4rem);
padding: 2rem;
}
.content-panel.body-content-b {
width: calc(40% - 4rem);
padding: 2rem;
}
.content-panel.body-content-c {
width: calc(70% - 4rem);
padding: 2rem;
}
.content-tabs {
background-color: #161616;
padding: 0px 1.5rem;
}
.content-tabs > div {
display: inline-block;
vertical-align: top;
padding: 0.5rem;
margin-right: 1rem;
cursor: pointer;
font-weight: bold;
}
.content-tabs > div.active {
position: relative;
background-color: #373737;
z-index: 2;
}
.main-content-area {
position: relative;
border: 1px dashed #202020;
overflow: hidden;
}
.tab-content {
position: relative;
left: 0px;
transition: 0.3s left;
}
.tab-content:not(.active) {
position: absolute;
width: 100%;
top: 2.25rem;
left: 100%;
}
.badge-analogues div {
display: inline-block;
vertical-align: top;
margin-right: 1rem;
margin-top: 0.5rem;
font-size: 0.65rem;
border-radius: 4px;
overflow: hidden;
padding-left: 6px;
letter-spacing: 1px;
background-color: #141414;
color: #999999;
font-family: 'Merriweather Sans', sans-serif;
}
.badge-analogues span {
display: inline-block;
vertical-align: top;
margin-left: 3px;
padding-left: 3px;
padding-right: 6px;
color: #fafafa;
}
.badge-analogues div.type-a span {
background-color: #6e40aa;
}
.badge-analogues div.type-b span {
background-color: #fe4b83;
}
.badge-analogues div.type-c span {
background-color: #b99727;
}
.badge-analogues div.type-d span {
background-color: #23abd8;
}
.badge-analogues div.type-e span {
background-color: #34a343;
}
.chart-container {
text-align: center;
}
.chart {
overflow: visible;
display: inline-block;
vertical-align: top;
}
.chart-controls {
margin-top: 1rem;
border-top: 1px solid #373737;
text-align: right;
}
.chart-controls button {
position: relative;
top: -1px;
margin-top: 0rem;
border-top-left-radius: 0px;
border-top-right-radius: 0px;
font-size: 0.6rem;
}
.chart-inards {
position: relative;
overflow: hidden;
}
.chart-inards pre {
font-size: 10px;
text-align: left;
background-color: #161616;
padding: 3px;
overflow: scroll;
width: calc(100% + 30px);
height: calc(100% + 30px);
}
.chart text {
fill: #e0e0e0;
font-size: 10px;
font-family: 'Merriweather Sans', sans-serif;
}
.chart circle,
.chart path,
.chart line.stock {
fill: none;
stroke: #333333;
stroke-dasharray: 4px;
stroke-width: 2px;
}
.default-trace-target {
position: absolute;
top: 4rem;
left: 50%;
transform: translateX(-50%);
height: 4rem;
width: 50%;
}
.desktop-warning {
display: none !important;
}
@media screen and (max-width: 1000px) {
html,
body {
width: 100%;
}
.main-container {
width: 100%;
padding-top: 6rem;
}
.content-panel {
width: 100% !important;
margin-left: 0px;
margin-right: 0px;
border-left: none;
border-right: none;
}
.content-tabs {
padding: 0rem 0.5rem;
}
.desktop-warning {
display: inline-block !important;
}
}
</style>
</head>
<body>
<div data-mount-target="swarm-anim"></div>
<main class="main-container">
<div class="default-trace-target" data-swarm-default="true"></div>
<div class="content-panel intro-content" data-swarm-target="true">
<h1>Hi, I'm Robin 👋</h1>
<h3 class="secondary">Sr. Software Developer</h3>
<div class="badge-analogues">
<div class="type-a">location <span>british columbia, canada</span></div>
<div class="type-b">opportunity search <span>active</span></div>
<div class="type-e desktop-warning">best viewed on <span>desktop</span></div>
</div>
</div>
<div class="main-content-area">
<div class="content-tabs" data-swarm-target="true">
<div aria-role="button" class="active">Competency</div>
<div aria-role="button">Experience</div>
<div aria-role="button">Objective</div>
</div>
<div class="tab-content active">
<div class="content-panel body-content-a" data-swarm-target="true">
<div class="footnote secondary"><b>Sec. 1.</b> General Competency</div>
A breadth of experience
<span class="secondary">
across different domains, teams, and technical contexts has given
me a holistic understanding of many aspects of the software discipline.
</span>
<br/>
<br/>
<span class="secondary">
I bring to my teams a
</span>
measured focus on good practice and delivery of value
<span class="secondary">
and contributions towards a
</span>
supportive, constructive team culture.
<br/>
<br/>
<span class="secondary">
I emphasize
</span>
consciously finding a suitable approach
<span class="secondary">
to technical problems, human-factor constraints, and the SDLC in general.
</span>
<br/>
<br/>
<span class="secondary">
My professional ethos is to actively seek out feedback on, and continually improve,
</span>
my technical and management decision making,
<span class="secondary">
while finding every opportunity possible to
</span>
help my teammates on their roads to software expertise.
</div><div class="content-panel body-content-b" data-swarm-target="true">
<div class="chart-area" data-mount-target="competency-chart"></div>
<div class="footnote secondary"><b>Fig. 1. a)</b> Software Competency Self-Assessment</div>
</div>
<div dir="rtl">
<div dir="ltr" class="content-panel body-content-a" data-swarm-target="true">
<div class="footnote secondary"><b>Sec. 2.</b> The Tech</div>
<span class="secondary">Having operated in </span>
many stacks and architectures
<span class="secondary">, and with languages at most </span>
levels of abstraction
<span class="secondary">,
onboarding onto a particular set of software development tools has become
an opportunity I look forward to.
</span>
<br/>
<br/>
<span class="secondary">
I have experience with
</span>
<ul>
<li>
Service and application development
<span class="secondary">
In a wide variety of languages and frameworks
</span>
</li>
<li>
Async and sync microservice architectures
<span class="secondary">
orchestrated internally via Kafka, Redis, and HTTP
</span>
</li>
<li>
Infrastructure and DevOps implementation
<span class="secondary">
using Docker, Terraform, with Kubernetes or PaaS within various cloud providers,
paired various CI/CD providers and monitoring stacks
</span>
</li>
<li>
Most commonly used integration protocols
<span class="secondary">
including HTTP REST, GraphQL, RPC, and WebSockets
</span>
</li>
<li>
Modern frontend technologies
<span class="secondary">
such as the IndexedDB, SharedWorkers, ServiceWorkers, WebGL,
event-based architectures with BroadcastChannels, as well as Rust WASM
</span>
</li>
<li>
ML-based systems
<span class="secondary">
and the challenges of model selection, data sourcing, and QA/QC within that context
</span>
</li>
</ul>
</div><div dir="ltr" class="content-panel body-content-b" data-swarm-target="true">
<div class="chart-area" data-mount-target="language-chart"></div>
<div class="footnote secondary"><b>Fig. 2. a)</b> Language Familiarity</div>
</div>
</div>
</div>
<div class="tab-content">
<div class="content-panel body-content-c" data-swarm-target="true">
<div class="footnote secondary no-margin"><b>Sec. 4.</b> Professional Experience</div>
</div>
<div class="content-panel body-content-a smaller-text" data-swarm-target="true">
<h3>Consultant - Application Architect III</h3>
<div class="badge-analogues">
<div class="type-e">where <span>Ministry of Agriculture</span></div>
<div class="type-c">when <span>2023 to Current</span></div>
</div>
<br/>
Outcome:
<span class="secondary">
Modern cloud infrastructure and DevOps workflow adoptions in enterprise, extensive improvements to data management solutions
</span>
<br/>
<br/>
Stack:
<span class="secondary">
Python, PHP, Java, Docker, PostgreSQL, Redis, Terraform, Azure, AWS, Enterprise On-Prem
</span>
<ul class="secondary">
<li>
Trailblazed migration of applications to modernized cloud infrastructures, supported by best-practice operational workflows
</li>
<li>
Eliminated technical debt across codebases, deployments, and systems integrations
</li>
<li>
Adapted open source tools for data management and publication to client needs
</li>
<li>
Provided long-term operational support as well as staff training and mentorship
</li>
</ul>
</div><div class="content-panel body-content-b" data-swarm-target="true">
<div class="footnote secondary no-margin"><b>Sec. 4. a)</b> Supplementary Experience</div>
<ul>
<li class="smallest-text">
Game Development in <span class="secondary">Unity, Unreal Engine, OpenGL, and WebGL</span>
</li>
<li class="smallest-text">
Embedded systems and robotics <span class="secondary">development in C++, Rust, and Python</span>
</li>
<li class="smallest-text">
<span class="secondary">Functional toy library developments including</span>
vDOMs, ORMs, and full-stack web frameworks
</li>
<li class="smallest-text">
<span class="secondary">Functional toy ML model developments including</span>
token stream sequencizers and object classifiers
</li>
</ul>
</div>
<div class="content-panel body-content-a smaller-text" data-swarm-target="true">
<h3>Lead Frontend Developer</h3>
<div class="badge-analogues">
<div class="type-e">where <span>ehsAI</span></div>
<div class="type-c">when <span>2020 to 2022</span></div>
</div>
<br/>
Outcome:
<span class="secondary">
AI powered extraction of action items from regulatory documents, through several steps of human review
</span>
<br/>
<br/>
Stack:
<span class="secondary">
TypeScript, Golang, Python, SCSS, MongoDB, PostgreSQL, Kafka, Docker, Helm, Kubernetes, Terraform, Grafana, AWS
</span>
<ul class="secondary">
<li>Delivered extremely high value with limited engineering resources</li>
<li>
Architected and evolved an application frontend comparable to a word processor
capable of rich presentation of meaning and high data-scale
</li>
<li>
Engineered a purpose-built frontend architecture including multi-threading,
event-based orchestration, and on-disk state management to enable the above
</li>
<li>
Managed and mentored back- and frontend developers at a variety of skill levels
</li>
<li>
Extensively contributed to the design and implementation of a complex backend business logic pipeline with numerous deep learning components, and its supporting asynchronous microservice architecture
</li>
<li>
Managed various full-stack projects involving interdisciplinary teams
</li>
<li>
Designed and implemented novel algorithms and heuristics
</li>
</ul>
</div>
<div class="content-panel body-content-a smaller-text" data-swarm-target="true">
<h3>Software Developer, Consultant, and Vendor</h3>
<div class="badge-analogues">
<div class="type-e">where <span>self-employed</span></div>
<div class="type-c">when <span>2018 to 2020</span></div>
</div>
<br/>
Outcome:
<span class="secondary">
Various line of business software solutions, e-commerce platform applications, e-commerce and traditional online presences
</span>
<br/>
<br/>
Stack:
<span class="secondary">
Python, JavaScript, Swift, Rust, C++, C#, Tensorflow, Keras, LESS, PostgreSQL, Redis, RabbitMQ, Docker, Kubernetes, Google Cloud
</span>
<ul class="secondary">
<li>
Engineered requirements specifications for, and lead implementations of, several full-stack software solutions
</li>
<li>
Contributed to and directed the creation of features across various domains
</li>
<li>
Worked extensively with legacy systems and codebases
</li>
<li>
Managed and mentored small teams of intermediate level full-stack developers
</li>
</ul>
</div>
<div class="content-panel body-content-a smaller-text" data-swarm-target="true">
<h3>Technical Operations Officer</h3>
<div class="badge-analogues">
<div class="type-e">where <span>BC Legislature</span></div>
<div class="type-c">when <span>2017 to 2018</span></div>
</div>
<br/>
Outcome:
<span class="secondary">
Improved public access to official records, internal production tooling improvements
</span>
<br/>
<br/>
Stack:
<span class="secondary">
C#, Java, Python, JavaScript, CoffeeScript, XSLT, MySQL, MariaDB, On-Prem
</span>
<ul class="secondary">
<li>
Centrally contributed to the design and implementation of a secure and productive publishing system for various official publications
</li>
<li>
Collaboratively designed and implemented a public-facing content search portal and transcript-video alignment for the proceedings of the Legislature
</li>
<li>
Conceived and implemented several internal line of business full-stack software solutions to improve productivity
</li>
<li>
Provided mentorship to software development interns
</li>
<li>
Received multiple Parliament-wide individual and team awards for achieving impact and delivering value
</li>
</ul>
</div>
<div class="content-panel body-content-a smaller-text" data-swarm-target="true">
<h3>BSc. Computer Science</h3>
<div class="badge-analogues">
<div class="type-a">status <span>incomplete</span></div>
<div class="type-e">where <span>University of Victoria</span></div>
<div class="type-c">when <span>2014 to 2017</span></div>
</div>
<br/>
Outcome:
<span class="secondary">
Completed up to a 400 level, then moved on to pursue industry opportunity
</span>
</div>
<div class="content-panel body-content-a smaller-text" data-swarm-target="true">
<h3>Software Developer and Tutor</h3>
<div class="badge-analogues">
<div class="type-e">where <span>self-employed</span></div>
<div class="type-c">when <span>2012 to 2016</span></div>
</div>
<br/>
Outcome:
<span class="secondary">
Various minor paid and personal projects
</span>
<br/>
<br/>
Stack:
<span class="secondary">
C, C++, Java, Python, JavaScript, CSS
</span>
</div>
</div>
<div class="tab-content">
<div class="content-panel body-content-c" data-swarm-target="true">
<div class="footnote secondary"><b>Sec. 3.</b> Opportunity Alignment</div>
<br/>
I'm looking for opportunities
<span class="secondary">
that offer difficult technical challenges, on well-structured teams,
in an environment where innovation is encouraged.
</span>
<br/>
<br/>
<span class="secondary">
In recent years I've developed deep expertise in building and maintaining
</span>
complex, high performance back- and frontend systems.
<span class="secondary">
I've worked on and lead teams that are asked to go above and beyond their
resources, and done so very successfully.
</span>
<br/><br/>
<span class="secondary">
I'm now searching for an organization seeking to solve
</span>
novel challenges
<span class="secondary">
that values
</span>
holding robust engineering discussions, enabling mentorship, and building healthy team culture.
</div>
</div>
</div>
<div class="content-panel secondary-content" data-swarm-target="true">
<h3>Contact</h3>
<span class="secondary" data-insert="email">thisisme@email.com</span> / <span class="secondary" data-insert="phone">555-555-555</span>
</div>
</main>
<script src="https://cdn.jsdelivr.net/npm/d3@7.6.1/dist/d3.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/preact/dist/preact.min.js"></script>
<script id="module-sys-dummy">
// Quack quack.
window.require = () => preact;
window.exports = window.preactHooks = {};
</script>
<script src="https://cdn.jsdelivr.net/npm/preact@10.11.2/hooks/dist/hooks.js"></script>
<script id="swarm-anim-script">{
const { Fragment, render, h } = preact;
const { useState, useMemo, useEffect, useRef } = preactHooks;
const rand = (min, max) => min + (Math.random() * (max - min));
const mag = vec => Math.sqrt(Math.pow(vec.x, 2) + Math.pow(vec.y, 2));
//
// Left this at the top because you're probably looking for how the "swarm" works.
// It's an SVG vDOM using Preact, agents each have position; velocity; and a unique
// max speed, acceleration, and changing radial offset against target positions.
//
// They are targeted to the 4 corners of the currently hovered element in a cycle,
// if there is one.
//
const createSwarmAgent = position => ({
x: position.x, y: position.y,
vX: 0, vY: 0,
vM: rand(3, 6), a: rand(0.2, 0.4),
oR: rand(0, Math.PI * 2),
oD: rand(25, 50),
vD: 0
});
const updateSwarmAgent = (agent, realTargetPosition) => {
const offsetTargetPosition = {
x: realTargetPosition.x + (Math.sin(agent.oR) * agent.oD),
y: realTargetPosition.y + (Math.cos(agent.oR) * agent.oD)
};
const delta = {
x: offsetTargetPosition.x - agent.x,
y: offsetTargetPosition.y - agent.y
};
const deltaMag = mag(delta);
const modVelocity = (scalarD, scalarV) => {
const effectiveAcceleration = agent.a * (
scalarD >= 0 == scalarV >= 0 ?
// Slow acceleration by 50% when approaching and near target.
Math.max(Math.min(100, Math.abs(scalarD)) / 100, 0.5)
:
1
);
return (
scalarD > 0 ?
Math.min(agent.vM, scalarV + effectiveAcceleration)
:
Math.max(-agent.vM, scalarV - effectiveAcceleration)
);
};
const updatedAgent = {
...agent,
oD: agent.oD + agent.vD,
oR: agent.oR + 0.01,
vD: agent.vD + ((Math.random() - 0.5) * 0.001),
vX: modVelocity(delta.x, agent.vX),
vY: modVelocity(delta.y, agent.vY),
x: agent.x + agent.vX,
y: agent.y + agent.vY
};
const nearTarget = deltaMag < 20;
return [updatedAgent, nearTarget];
};
const useTargeting = () => {
const [target, setTarget] = useState(null);
useEffect(() => {
const handleTargetEnter = event => setTarget(event.target);
const handleTargetLeave = () => setTarget(null);
const targets = document.querySelectorAll('[data-swarm-target="true"]');
for (const target of targets) {
target.addEventListener('mouseenter', handleTargetEnter);
target.addEventListener('mouseleave', handleTargetLeave);
}
return () => {
for (const target of targets) {
target.removeEventListener('mouseenter', handleTargetEnter);
target.removeEventListener('mouseleave', handleTargetLeave);
}
};
}, []);
const defaultTarget = useMemo(() => (
document.querySelector('[data-swarm-default="true"]')
), []);
return [target, defaultTarget];
}
const useViewport = () => {
const [mouse, setMouse] = useState({ x: 0, y: 0 });
const [viewport, setViewport] = useState({ w: window.innerWidth, h: window.innerHeight });
useEffect(() => {
const handleMove = event => {
const mouse = { x: event.pageX, y: event.pageY };
setMouse(mouse);
};
const handleResize = () => {
setViewport({ w: window.innerWidth, h: window.innerHeight });
};
window.addEventListener('mousemove', handleMove);
window.addEventListener('resize', handleResize);
handleResize();
return () => {
window.removeEventListener('mousemove', handleMove);
window.removeEventListener('resize', handleResize);
};
}, []);
return [viewport, mouse];
};
const useSwarm = initialSize => {
const [viewport, mouse] = useViewport();
const [target, defaultTarget] = useTargeting();
const [swarm, setSwarm] = useState(
new Array(initialSize).fill(0).map(() => createSwarmAgent({
x: viewport.w / 2,
y: viewport.h / 2
}))
);
const targetRef = useRef();
targetRef.current = viewport.w < 1000 ? defaultTarget : target;
const mouseRef = useRef();
mouseRef.current = mouse;
const setSize = newSize => {
setSwarm(swarm => [
...swarm.slice(0, newSize),
...(
newSize > swarm.length ?
new Array(newSize - swarm.length).fill(0).map(() => createSwarmAgent(mouse))
:
[]
)
]);
};
useEffect(() => {
let targetCycleStep = 0;
const tickSwarm = () => {
const targetElement = targetRef.current;
const mouse = mouseRef.current;
let target = mouse;
if (targetElement) {
const bounds = targetElement.getBoundingClientRect();
target = (
targetCycleStep == 0 ?
{ y: bounds.top + window.scrollY, x: bounds.left } :
targetCycleStep == 1 ?
{ y: bounds.top + window.scrollY, x: bounds.left + bounds.width } :
targetCycleStep == 2 ?
{ y: bounds.top + bounds.height + window.scrollY, x: bounds.left + bounds.width } :
{ y: bounds.top + bounds.height + window.scrollY, x: bounds.left }
);
}
let anyAgentNearTarget = false;
setSwarm(swarm => (
swarm.map(agent => {
const [updatedAgent, nearTarget] = updateSwarmAgent(agent, target);
if (nearTarget) anyAgentNearTarget = true;
return updatedAgent;
})
));
if (targetElement && anyAgentNearTarget) {
targetCycleStep = (targetCycleStep + 1) % 4;
}
};
const tick = window.setInterval(tickSwarm, 25);
return () => window.clearInterval(tick);
}, []);
return [swarm, viewport, setSize];
};
const SwarmAnimation = () => {
const [swarm, viewport, setSize] = useSwarm(8);
return (
h('div', {
class: 'swarm-anim-container'
}, [
h('svg', {
class: 'swarm-anim',
viewBox: '0 0 1 1',
preserveAspectRatio: 'none',
style: {
width: viewport.w + 'px',
height: viewport.h + 'px'
}
}, (
swarm.map((agent, k) => (
h('rect', {
key: k,
x: agent.x / viewport.w,
y: agent.y / viewport.h,
fill: d3.interpolateRainbow(k / 5),
width: 4 / viewport.w,
height: 4 / viewport.h
})
)
)))
])
);
};
render(h(SwarmAnimation), document.querySelector('[data-mount-target="swarm-anim"]'));
}</script>
<script id="tabs-script">{
const tabControls = document.querySelectorAll('.content-tabs > div');
const tabContents = document.querySelectorAll('.tab-content');
const switcher = k => () => {
for (let i = 0; i < tabContents.length; i++) {
tabContents[i].classList.remove('active');
tabControls[i].classList.remove('active');
}
tabContents[k].classList.add('active');
tabControls[k].classList.add('active');
};
for (let i = 0; i < tabControls.length; i++) {
tabControls[i].addEventListener('click', switcher(i));
}
}</script>
<script id="content-insertion-script">{
const insertable = {
email: [115, 112, 99, 106, 111, 116, 98, 121, 106, 103, 115, 98, 104, 102, 65, 109, 106, 119, 102, 47, 100, 98],
phone: [56, 56, 57, 46, 57, 57, 52, 46, 55, 56, 50, 54]
};
let inserted = false;
const performInsertions = () => {
if (inserted) return;
inserted = true;
setTimeout(() => {
const targets = document.querySelectorAll('[data-insert]');
for (const target of targets) {
target.innerText = insertable[target.getAttribute('data-insert')].map(c => String.fromCharCode(c - 1)).join('')
target.classList.add('inserted');
}
}, 1000);
window.removeEventListener('scroll', performInsertions);
};
window.addEventListener('scroll', performInsertions);
}</script>
<script id="chart-scripts">{
const { Fragment, render, h } = preact;
const { useState, useMemo, useEffect, useRef } = preactHooks;
const TAU = Math.PI * 2;
const GREY = '#999999';
const code = src => {
const leadingWs = /^\s+/.exec(src);
const indent = leadingWs ? leadingWs[0].length : 0;
const highlight = k => (_, m) => ['🗿', k, m, '🗿'].join('');
const color = m => (
m == 5 ? GREY : d3.rgb(d3.interpolateRainbow(m / 5))
);
return (
'<span style="color: ' + GREY + '">// see #chart-scripts</span>\n\n' +
src.substring(indent)
.replace(new RegExp('\n' + new Array(indent).fill(' ').join(''), 'g'), '\n')
.replace(/(?<![a-z])([0-9\.]+)/g, highlight(0))
.replace(/(["'].*?['"])/g, highlight(2))
.replace(/(const|let|null|return|new|Math)/g, highlight(1))
.replace(/(\w+)(?=\()/g, highlight(3))
.replace(/(?<=[a-z]\.)(\w+)/g, highlight(4))
.replace(/(\w+)(?=:\s)/g, highlight(4))
.replace(/(\(|\)|\[|\]|\{|\}|=>|;|\*|\+|\-|\/|,)/g, highlight(5))
.replace(/🗿([0-9]{0,1})/g, (_, m) => [
m.length ?