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
use serde::de::{Deserialize, Deserializer, MapAccess, Visitor}; | |
use serde_json::value::RawValue; | |
use std::collections::HashMap; | |
use std::fmt; | |
use std::marker::PhantomData; | |
#[derive(Debug)] | |
struct TestA<'a> { | |
a: i32, | |
rest: HashMap<&'a str, &'a RawValue>, |
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
const http = require("http"); | |
const vm = require("vm"); | |
const fs = require("fs"); | |
function scheduleLoop(schedule) { | |
function loop(sum = 0) { | |
schedule(() => loop(doSomeWork(sum))); | |
} | |
schedule(loop); | |
} |
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
/** | |
* Print object if running with --js-flag="--allow-natives-syntax" | |
*/ | |
const __debugPrint = (() => { | |
try { | |
return new Function("x", "%DebugPrint(x)"); | |
} catch (e) { | |
return () => void 0; | |
} | |
})(); |
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
#!/usr/bin/env bash | |
# check for CHROME_PATH env or just default | |
cmd=${CHROME_PATH:-$HOME/chromium/src/out/Default/Chromium.app/Contents/MacOS/Chromium} | |
if [ -z "$1" ] | |
then | |
echo "Usage: `basename $0` [url]" | |
exit 1 | |
fi |
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
< DebugPrint: 0x4738baeff9: [JS_OBJECT_TYPE] in OldSpace | |
--- | |
> DebugPrint: 0x47a334ac31: [JS_OBJECT_TYPE] in OldSpace | |
7,15c7,15 | |
< #slice: 0x00479ca7bfc1 <JSFunction n.slice (sfi = 0x47a98760d9)> (const data field 1) | |
< #sliceInner: 0x00479ca7c001 <JSFunction n.sliceInner (sfi = 0x47a9876131)> (const data field 2) | |
< #copy: 0x00479ca7c041 <JSFunction n.copy (sfi = 0x47a9876189)> (const data field 3) | |
< #write: 0x00479ca7c081 <JSFunction n.write (sfi = 0x47a98761e1)> (const data field 4) properties[0] | |
< #writeJs: 0x00479ca7c0f1 <JSFunction n.writeJs (sfi = 0x47a9876241)> (const data field 5) properties[1] | |
< #writeRaw: 0x00479ca7c131 <JSFunction n.writeRaw (sfi = 0x47a9876299)> (const data field 6) properties[2] |
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
const { spawnChrome } = require("chrome-debugging-client"); | |
const { sleep } = require("race-cancellation"); | |
const fs = require("fs"); | |
const DEVTOOLS_CATEGORIES = [ | |
"-*", | |
"devtools.timeline", | |
"viz", | |
"benchmark", | |
"blink", |
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
use serde::de::DeserializeSeed; | |
use serde::de::Error; | |
use serde::de::SeqAccess; | |
use serde::de::Visitor; | |
use serde::Deserialize; | |
use serde::Deserializer; | |
use std::convert::From; | |
use std::fmt; | |
use std::fmt::Display; | |
use std::marker::PhantomData; |
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
#[derive(Debug, Clone, Copy)] | |
enum MyRef<'a> { | |
String(&'a str), | |
Bytes(&'a [u8]), | |
} | |
impl<'a> Into<&'a str> for MyRef<'a> { | |
fn into(self) -> &'a str { | |
if let MyRef::String(s) = self { | |
s |
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
struct Path<'a> { | |
path: &'a str, | |
} | |
impl<'a> Path<'a> { | |
fn new(path: &str) -> Path { | |
Path { path } | |
} | |
fn query(&self) -> &'a str { |
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
#[derive(Debug, Clone)] | |
struct SomeTuple<'a>(&'a str, &'a [u8]); | |
fn main() { | |
let mut owned = String::new(); | |
owned.push_str("Hello"); | |
owned.push_str(" World"); | |
owned.push('!'); | |
let strref: &str = &owned; |