~/code/most/most-subject/perf subject-class* 19s
❯ node ./filter-map-reduce.js
filter -> map -> reduce 1000000 integers
-----------------------------------------------
most 14.20 op/s ± 0.83% (68 samples)
xstream 21.91 op/s ± 1.90% (29 samples)
rx 5 4.68 op/s ± 1.12% (16 samples)
-----------------------------------------------
Discover gists
This file contains 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
<!doctype html> | |
<html> | |
<head> | |
<script src="shadow-root.js"></script> | |
</head> | |
<div> | |
<div slot="main"> | |
I'm some projected content. | |
</div> | |
<shadow-root> |
This file contains 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
# .config/fish/config.fish | |
function setenv; set -gx $argv; end | |
source ~/.env |
This file contains 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 SimpleHTTPServer | |
class CORSHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): | |
def send_head(self): | |
"""Common code for GET and HEAD commands. | |
This sends the response code and MIME headers. | |
Return value is either a file object (which has to be copied | |
to the outputfile by the caller unless the command was HEAD, | |
and must be closed by the caller under all circumstances), or |
This file contains 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
$URI = "/catalog-service/api/consumer/resourceViews/?withExtendedData=$($WithExtendedData)&withOperations=$($WithOperations)&managedOnly=$($ManagedOnly)&`$orderby=name asc&limit=$($Limit)&page=$($page)&`$filter=resourceType/id eq 'Infrastructure.Machine' or resourceType/id eq 'Infrastructure.Virtual' or resourceType/id eq 'Infrastructure.Cloud' or resourceType/id eq 'Infrastructure.Physical'" | |
$EscapedURI = [uri]::EscapeUriString($URI) | |
$Response = Invoke-vRARestMethod -Method GET -URI $EscapedURI -Verbose:$VerbosePreference |
This file contains 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 { h, Component } from 'preact'; | |
import Markup from 'preact-markup'; | |
import register from './preact-custom-element'; | |
// just a proxy component: WC -> Preact -> WC | |
const A = () => <x-b foo="initial foo from <x-a>" />; | |
// stateful component that can re-render | |
class B extends Component { | |
render(props, state) { |
This file contains 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
type HTMLElementPrototype = HTMLElement extends { prototype: infer Prototype } | |
? Prototype | |
: never; | |
declare namespace h { | |
namespace JSX { | |
interface Element {} | |
type LibraryManagedAttributes<E, _> = E extends { | |
prototype: infer Prototype; | |
} |
This file contains 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 fetch from 'node-fetch'; | |
export async function requestSnapshot(url, data) { | |
const response = await fetch('https://little-paper-d118.bkardell.workers.dev', { | |
method: 'POST', | |
mode: 'no-cors', | |
headers: {url: url} | |
}); |
This file contains 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
/* JSON XPath search */ (await import('https://unpkg.com/espath')).default(window.dataLayer, '//string') | |
/* cookie to object */ Object.fromEntries(document.cookie.split('; ').map(entry => entry.split('='))) | |
/* cookie to object */ (await import('https://v2.crocdn.com/_plugins/cookie-to-object.js')).default() | |
/* css elements search */ document.querySelectorAll ('*') | |
/* xpath element search */ (await import('https://unpkg.com/queryxpath/queryxpath.es.js')).queryXPathAll ('//*') |
This file contains 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 camelToKebab(string) { | |
const tag = document.createElement('span') | |
tag.dataset[string] = true | |
return tag.attributes[0].name.split(/^data-/)[1] | |
} |
NewerOlder