Skip to content

Instantly share code, notes, and snippets.

Avatar

Bert Belder piscisaureus

  • Amsterdam
View GitHub Profile
View wtfwin.webm
This file has been truncated, but you can view the full file.
View build.sh
#!/bin/sh
# This script generates multi-size .ico files from the highly stylized "simple"
# Deno logos, designed by HashRock.
# The complication stems from the fact the the dimensions of the original .png
# files is 252x252 pixels. Naively rescaling these images to 256x256 or any
# other power of 2 produces ugly artifacts.
# Note that the output of the black-and-white logo transformation isn't
View import-redirect.js
const resources = {
"/": file("text/html")`
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<script type="module" src="main.js"></script>
</head>
<body>
<p>Open developer tools. There will be nothing to see here.</p>
View v8_callbacks_special_cases.txt
// Capture - remove by function pointer and data
void AddGCPrologueCallback(GCCallbackWithData callback, void* data = nullptr, GCType gc_type_filter = kGCTypeAll);
void RemoveGCPrologueCallback(GCCallbackWithData, void* data = nullptr);
void AddGCEpilogueCallback(GCCallbackWithData callback, void* data = nullptr, GCType gc_type_filter = kGCTypeAll);
void RemoveGCEpilogueCallback(GCCallbackWithData callback, void* data = nullptr);
void AddMicrotasksCompletedCallback(MicrotasksCompletedCallbackWithData callback, void* data = nullptr);
void RemoveMicrotasksCompletedCallback(MicrotasksCompletedCallbackWithData callback, void* data = nullptr) = 0;
View stack_frames_by_size.txt
First number is the size (in bytes) of the stack frame. The largest frames are on top.
+ 60480 0x000000B1E05AD690 frame #77: 0x00007ff6b6e7fd44 deno.exe`union core::result::Result<swc_ecma_ast::module::ModuleItem, swc_common::errors::diagnostic_builder::DiagnosticBuilder> swc_ecma_parser::parser::Parser<swc_ecma_parser::parser::input::Capturing<swc_ecma_parser::lexer::Lexer<swc_common::input::SourceFileInput>>>::parse_stmt_like<swc_ecma_parser::parser::input::Capturing<swc_ecma_parser::lexer::Lexer<swc_common::input::SourceFileInput>>,swc_ecma_ast::module::ModuleItem>(self=0x000000b1e05b00d0, include_decl=true, top_level=true) at stmt.rs:82
+ 60480 0x000000B1E055F110 frame #48: 0x00007ff6b6e7f784 deno.exe`union core::result::Result<swc_ecma_ast::stmt::Stmt, swc_common::errors::diagnostic_builder::DiagnosticBuilder> swc_ecma_parser::parser::Parser<swc_ecma_parser::parser::input::Capturing<swc_ecma_parser::lexer::Lexer<swc_common::input::SourceFileInput>>>::parse_stmt_like<swc_ecma_parser::parser::input:
View gist:748866df4ac001d631d5f16d5260dbae
D:\deno2\tests>..\target\debug\deno -A --reload main.js
Compile file:///D:/deno2/tests/subdir/mod2.ts
Compile file:///D:/deno2/tests/subdir/mismatch_ext.ts
Compile file:///D:/deno2/tests/subdir/mod1.ts
Download https://raw.githubusercontent.com/denoland/deno/v0.0.1/package.json
error: Uncaught Error: An error
► file:///D:/deno2/tests/subdir/throws.js:5:7
5 throw new Error("An error");
^
View import.js
async function try_import(url) {
let status;
try {
await import(url);
status = "OK";
} catch (err) {
status = err.name;
}
status = status.padEnd(12);
return status + url;
View gist:7ca55b153a1b3f8085c6ae49c4e6c837
So here's the things to consider:
* Do not preallocate a read buffer per socket.
Either use polling or use a shared buffer pool.
* Avoid statefulnews, e.g:
- In windows, you can't use multiple completion ports with a handle.
- On unix, a socket is either in blocking or non-blocking mode
This creates problems when you want to share a handle with other processes
or between threads. For example, you might want to switch stdout to
non-blocking, but if stdout was inherited and shared with the parent
process, the parent process might not expect this and crash or malfunction.
View op_dispatcher.rs
use std::collections::HashMap;
use std::sync::Mutex;
#[macro_use]
extern crate lazy_static;
struct CoreOp {} // Placeholder.
struct FlatBuffer {} // Placeholder.
struct PinnedBuf {} // Placeholder.
View handle_scope_mock.rs
use std::cell::Cell;
use std::marker::PhantomData;
// Dummy placeholders representing raw v8 objects.
struct V8Isolate {}
struct V8HandleScope {}
// Scope that controls access to the Isolate and active HandleScope.
struct Scope<'a, S, P> {
parent: Option<&'a mut P>,
You can’t perform that action at this time.