Skip to content

Instantly share code, notes, and snippets.

View shgysk8zer0's full-sized avatar
💭
I may be slow to respond.

Chris Zuber shgysk8zer0

💭
I may be slow to respond.
View GitHub Profile
@shgysk8zer0
shgysk8zer0 / gist.js
Last active December 2, 2021 00:02
A demo of <github-gist> usage (See https://codepen.io/shgysk8zer0/full/jOGEJRj)
const protectedData = new WeakMap();
function render(target) {
const { user, gist, file, height, width } = target;
const { shadow } = protectedData.get(target);
const iframe = document.createElement('iframe');
const script = document.createElement('script');
const link = document.createElement('link');
const src = new URL(`/${user}/${gist}.js`, 'https://gist.github.com');
const controller = new AbortController();