Into a terminal: npx https://gist.github.com/Lcfvs/4b1523653bfe54605b82113170299f61
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function(n,t,r,u,e,c,o){return t=String.fromCharCode,r=function(n,u){return u=c.length,n.replace(/./g,function(n){return c.indexOf(n).toString(u)}).replace(r.n,function(n){return t(parseInt(n,u))})},u=function(n,e){return e=function(n,t){return t=[],r.f(n)[r.a]("")[r.i](function(n,u,e){return!(1&u)&&t[r.j](e[u][r.b](0)*r.d+e[u+1][r.b](0))}),t}(n),function(n){return n[r.a]("")[r.h](function(n){return n[r.b](0)})}(r(""))[r.c]()[r.i](function(n,t){return t=n,e=function(n,t){return 1&(n[r.k](function(n,t){return t>n?n:t},0)^n[r.k](function(n,t){return n>t?n:t},0)^t)&&n[r.c](),n}(e,n)[r.h](function(u){return t=((u^n)-t+r.e)%r.e})}),r.g(e,t),u},r.t=n,e=r.constructor,c="",r.n=/.{2}/g,o=e("e",r(" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ((d, s = d.createElement('style')) => (s.textContent = '.contenu {left: unset}') && d.body.appendChild(s))(document) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const Async = async function(){}.constructor | |
| const AsyncGenerator = async function*(){}.constructor | |
| const Generator = function(){}.constructor | |
| const isAsync = fn => fn instanceof Async | |
| const isAsyncGenerator = fn => fn instanceof AsyncGenerator | |
| const isGenerator = fn => fn instanceof Generator |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as etched from 'https://unpkg.com/@etchedjs/etched@latest/etched.min.js' | |
| const emitter = etched.model({ | |
| set event (value) { | |
| console.log('event `event` emitted on `emitter` with value', value) | |
| } | |
| }) | |
| const emitter2 = etched.model(emitter, { | |
| set event (value) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function* controller (end) { | |
| while (end !== (yield)) {} | |
| } | |
| const end = Symbol() | |
| const it = controller(end) | |
| console.log(it.next()) // { value: undefined, done: false } | |
| console.log(it.next(end)) // { value: undefined, done: true } -> aborted |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function* controller (end) { | |
| let progress = 0 | |
| while (1) { | |
| const value = yield progress | |
| if (value === end) { | |
| break | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fileToURI = async file => new Promise((onload, onerror) => | |
| Object.assign(new FileReader(), { onload, onerror }) | |
| .readAsDataURL(file)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { resolve, text } from './fetcher.js' | |
| const fetchText = event => resolve(event, [ | |
| fetch, | |
| text, | |
| data => console.log({ data }) | |
| ]) | |
| document.querySelector('form') | |
| .addEventListener('submit', fetchText) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as fetcher from './text-fetcher.js' | |
| const fetchText = event => fetcher.resolver.resolve(event) | |
| document.querySelector('form') | |
| .addEventListener('submit', fetchText) | |
| document.querySelector('a') | |
| .addEventListener('click', fetchText) |