I hereby claim:
- I am reaktivo on github.
- I am reaktivo (https://keybase.io/reaktivo) on keybase.
- I have a public key ASD6Xr0LWA8Dlst6eZuQaf75ida3MJemmd4euN5btm7VDAo
To claim this, I am signing this object:
| function intercept<T extends {}>( | |
| obj: T, | |
| callback: (path: string) => void, | |
| path: string[] = [] | |
| ): T { | |
| function isPlainObject(obj: unknown) { | |
| return Object.prototype.toString.call(obj) === '[object Object]'; | |
| } | |
| const proxy = new Proxy(obj, { |
| module.exports = function(fileInfo, api, options) { | |
| // transform `fileInfo.source` here | |
| // ... | |
| console.log(fileInfo); | |
| return fileInfo.source; | |
| }; |
| import * as os from 'os'; | |
| import * as std from 'std'; | |
| function mapToFetchResponse(fullResponse) { | |
| const { | |
| responseHeaders, | |
| status, | |
| response, | |
| } = fullResponse; |
| [...document.querySelectorAll("*")].forEach((a)=>{a.style.color = a.style.background = color="#"+(~~(Math.random()*(1<<24))).toString(16); (/img|svg|video/i).test(a.tagName) && (a.style.visibility = 'hidden')}) |
| <!doctype html> | |
| <main /> | |
| <script type="module"> | |
| import { html, render } from 'https://unpkg.com/htm/preact/standalone.module.js'; | |
| const App = () => { | |
| return html`<h1>Hello world</h1>`; | |
| } | |
| // Generate unique IDs for use as pseudo-private/protected names. | |
| // Similar in concept to | |
| // <http://wiki.ecmascript.org/doku.php?id=strawman:names>. | |
| // | |
| // The goals of this function are twofold: | |
| // | |
| // * Provide a way to generate a string guaranteed to be unique when compared | |
| // to other strings generated by this function. | |
| // * Make the string complex enough that it is highly unlikely to be | |
| // accidentally duplicated by hand (this is key if you're using `id` |
| export function cacheFn<T>(fn: T): T { | |
| const cache = {}; | |
| return (...args) => { | |
| const key = JSON.stringify(args); | |
| return (cache[key] = cache[key] || fn(...args)); | |
| }; | |
| } |
| import { createClient, EntryCollection, ContentTypeLink, Entry, Sys } from 'contentful'; | |
| type FlatEntry<T> = { | |
| id: Sys['id']; | |
| contentType: ContentTypeLink['id']; | |
| } & T; | |
| type ValueOf<T> = T[keyof T]; | |
| function flatten<T>(contentfulValue: Entry<T> | ValueOf<T>) { |
I hereby claim:
To claim this, I am signing this object:
| // Run this with node 8 | |
| // npx node@8 ./index.js | |
| const arr = [ | |
| { i: 1 }, | |
| { i: 2 }, | |
| { i: 3 }, | |
| { i: 4 }, | |
| { i: undefined }, | |
| { i: undefined }, | |
| { i: undefined }, |