Skip to content

Instantly share code, notes, and snippets.

@cawa-93
cawa-93 / clearURL.js
Created January 29, 2019 13:42
Clear URL
/**
* @example
* const url = 'https://example.com/?query=val'
* const clearURL = new URL(url).clear('query').toString()
*/
URL.prototype.clear = function (...params) {
params.forEach(param => {
this.searchParams.delete(param)
})
return this
@cawa-93
cawa-93 / createObject.js
Last active February 4, 2020 11:55
Тестирование работы V8 — https://habr.com/ru/post/486162/
module.exports = function(keys) {
for (let key of keys) this[key] = 42;
}
@cawa-93
cawa-93 / dist_index-407b6fe0.js
Created November 30, 2020 10:39
reexport-test
export { B as ButtonComponent } from './main.js';
function IconComponent() {
console.log('This is IconComponent');
}
function HeavyComponent() {
console.log('This is HeavyComponent');
}
@cawa-93
cawa-93 / MapWithLimit.ts
Created June 16, 2021 09:08
Implementation of JavaScript `Map` with `size` limit
export class MapWithLimit<K = any, V = any> extends Map<K, V> {
readonly #limit: number
constructor(limit = 10, entries?: readonly (readonly [K, V])[] | null) {
super(entries);
this.#limit = limit;
}
set(key: K, value: V): this {
if (this.size + 1 > this.#limit) {
@cawa-93
cawa-93 / index.html
Created June 23, 2021 08:23
Reproducion for Electron issue #29319
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'">
<meta http-equiv="X-Content-Security-Policy" content="default-src 'self'; script-src 'self'">
<title>Electron Issue #29319</title>
</head>
<body>
@cawa-93
cawa-93 / index.html
Created September 13, 2021 20:18
Electron Media Session Api test case
<!-- Empty -->
@cawa-93
cawa-93 / index.html
Last active September 20, 2021 14:15
Electron Window Controls Overlay Issue
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
<style>
body {
background: white;
-webkit-app-region: drag;
}
@cawa-93
cawa-93 / index.html
Created February 1, 2022 12:29
Electron repro: Devtools TypeError
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'">
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
@cawa-93
cawa-93 / index.html
Created January 28, 2022 16:28
Reproduction for: USB package crash electron webview
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
<title>Hello World!</title>
</head>
<body>
@cawa-93
cawa-93 / index.html
Created December 17, 2022 19:28
BrowserWindow initial state is hidden
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'">
<link href="./styles.css" rel="stylesheet">
<title>Hello World!</title>
</head>
<body>