Skip to content

Instantly share code, notes, and snippets.

💭
status

Leo Balter leobalter

💭
status
Block or report user

Report or block leobalter

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ticks.js
var p = Promise.resolve(1).then(v => console.log(v);
console.log(0);
await import('foo');
console.log(2);
p.then(() => console.log(3);
View weakrefchecklist.txt
The WeakRef Constructor
https://tc39.github.io/proposal-weakrefs/#sec-weak-ref-constructor
- [ ] is the initial value of the WeakRef property of the global object.
- [ ] is designed to be subclassable. It may be used as the value in an extends clause of a class definition. Subclass constructors that intend to inherit the specified WeakRef behaviour must include a super call to the WeakRef constructor to create and initialize the subclass instance with the internal state necessary to support the WeakRef.prototype built-in methods.
WeakRef ( target )
https://tc39.github.io/proposal-weakrefs/#sec-weak-ref-target
1. [ ] If NewTarget is undefined, throw a TypeError exception.
View uniqBy.js
function uniqBy(iter, mapFn) {
var map = new Map();
for (let item of iter) {
let key = mapFn(item);
// Use the first given key identifier
if (map.has(key)) {
continue;
}
View set-array-typedarray.txt
```js
Object.setPrototypeOf(Array.prototype, new Int8Array(0));
const a = [];
a[0] = 4;
console.log(+a[0]);
```
---
`a[0] = 4;`
View 1.thenable-ns.js
// Status of today + dynamic import() proposal, await unwraps namespace objects.
//--- a.js
export let then = async () => {/* code */};
//--- b.js
import * as ns from 'a.js';
async function fn() {
await Promise.resolve(ns); // should unwrap the "thenable" namespace
View Spec bug diagram exercise.md

The "search" event

https://github.com/whatwg/html/issues/667

Some browsers feature non-standard attributes incremental and onsearch for the <input type=search> elements. This also implies the search event being fired.

  • Specified? no
  • Proposed? no.
    • This link shows a refusal to propose the idea and reasons for it.
  • Is it a good idea? no.
    • The refusal to proposal the idea bases on the fact it's already redundant with the oninput and onsubmit event handlers
View test262.pl
#!/usr/bin/env perl
use strict;
use warnings;
use Getopt::Long qw(GetOptions);
my $args = '';
GetOptions(
View gist:4ea72144711f597b34c30681fc447c89
yarn test-test262
yarn test-test262 v1.0.2
$ babel-node scripts/test262.js
............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
harness: Ran 0/181 (0.00%), Passed 0/0 (100%), Failed 0/0 (100%), Skipped 181/181 (100.00%)
intl402: Ran 0/44 (0.00%), Passed 0/0 (10
View gist:0e7e089d7fff55b27a9576649bb95ae1
[~/dev/test262-integrator] (master)⚡
npm test
> test262-integrator@1.0.0 test /Users/leo/dev/test262-integrator
> node test/test.js
......
Failed: test/built-ins/ArrayBuffer/prototype/byteLength/detached-buffer.js
Test262Error: No method available to detach an ArrayBuffer
View generate-stuff.py
op_list = [
("<", lambda a, b: a < b, "less-than"),
("<=", lambda a, b: a <= b, "less-than-or-equal"),
(">", lambda a, b: a > b, "greater-than"),
(">=", lambda a, b: a >= b, "greater-than-or-equal"),
]
# This is the hex representation of Number.MAX_VALUE.
max_value_digits = "0xfffffffffffff8" + "0" * 242
You can’t perform that action at this time.