You can inject an arbitrary JS file from a GitHub gist in place of another JS file on a web page using Charles proxy.
Map the remote path to the gist raw content path:
Tools -> Map Remote
Then update the Content-Type header from plain text to text/javascript
so you don't get CORB errors.
Tools -> Rewrite...