Skip to content

Instantly share code, notes, and snippets.

View birtles's full-sized avatar

Brian Birtles birtles

View GitHub Profile
@birtles
birtles / TrustedMarkdown.astro
Last active December 14, 2023 06:16
Resolve relative image paths in Astro markdown files
---
import { getTrustedMarkdownProcessor } from '@utils/markdown';
export type Props = {
content: string;
path?: string;
};
const html = await (await getTrustedMarkdownProcessor()).process({
path: Astro.props.path,
@birtles
birtles / misc-at-top.patch
Created December 2, 2020 08:20
Patch to display common misc labels at the top
diff --git a/src/popup.ts b/src/popup.ts
index ca9d850..1272482 100644
--- a/src/popup.ts
+++ b/src/popup.ts
@@ -449,6 +449,39 @@ function renderDefinitions(entry: WordResult, options: PopupOptions) {
if (entry.s.length === 1) {
definitionsDiv.append(renderSense(entry.s[0], options));
} else {
+ // Extract any misc labels that apply to the whole set of definitions
+ let commonMisc = entry.s[0].misc;
@birtles
birtles / misc-in-group.patch
Created December 2, 2020 08:08
Patch for applying misc labels to group headings
diff --git a/src/popup.ts b/src/popup.ts
index ca9d850..12b70da 100644
--- a/src/popup.ts
+++ b/src/popup.ts
@@ -1,4 +1,8 @@
-import { KanjiResult, NameTranslation } from '@birchill/hikibiki-data';
+import {
+ KanjiResult,
+ MiscType,
+ NameTranslation,
@birtles
birtles / opacity.html
Created January 30, 2019 00:59
Opacity test case
<!doctype html>
<meta charset=utf-8>
<style>
div {
width: 200px;
height: 200px;
background: orange;
}
</style>
<div id=div></div>
<!doctype html>
<meta charset=utf-8>
<title>Notes example</title>
<script src="https://unpkg.com/react@%5E16.5.0/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@%5E16.5.0/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/prop-types@%5E15.6/prop-types.js"></script>
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
<style>
:root {
--yellow-background: hsl(54, 100%, 90.2%);
@birtles
birtles / web-ext submit.svg
Created March 20, 2018 01:29
web-ext submit dependencies
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@birtles
birtles / return-promises.patch
Created February 16, 2018 07:08
Patch to return Promise objects from Animation playback methods
# HG changeset patch
# Parent 994a8d6eccbcdc6106794705bd77e3ac5f031be2
diff --git a/dom/animation/Animation.cpp b/dom/animation/Animation.cpp
--- a/dom/animation/Animation.cpp
+++ b/dom/animation/Animation.cpp
@@ -391,11 +391,11 @@ Animation::SetPlaybackRate(double aPlayb
}
// https://drafts.csswg.org/web-animations/#seamlessly-update-the-playback-rate
@birtles
birtles / updatePlaybackRate.diff
Created February 8, 2018 06:15
Folded diff of playback rate changes
diff --git a/web-animations-1/Overview.bs b/web-animations-1/Overview.bs
index 6cd09d76d..6f866485a 100644
--- a/web-animations-1/Overview.bs
+++ b/web-animations-1/Overview.bs
@@ -305,7 +305,7 @@ elem.getAnimations().filter(
)
).forEach(animation =&gt; {
animation.currentTime = 0;
- animation.playbackRate = 0.5;
+ animation.updatePlaybackRate(0.5);
This file has been truncated, but you can view the full file.
/* automatically generated by rust-bindgen */
pub use self::root::*;
pub use self::root::mozilla::*;
pub use self::root::mozilla::css::*;
pub use self::root::mozilla::dom::*;
use atomic_refcell::AtomicRefCell;
use data::ElementData;
pub type ServoUnsafeCell<T> = ::std::cell::UnsafeCell<T>;
pub type ServoCell<T> = ::std::cell::Cell<T>;
@birtles
birtles / timing-interface-changes.diff
Created January 12, 2018 07:53
WIP Patch to change Web Animation timing interfaces in Gecko
# HG changeset patch
# Parent 95a3304b348929f76b694b27a64b1528f6dd3d35
diff --git a/dom/animation/Animation.h b/dom/animation/Animation.h
--- a/dom/animation/Animation.h
+++ b/dom/animation/Animation.h
@@ -15,6 +15,7 @@
#include "mozilla/EffectCompositor.h" // For EffectCompositor::CascadeLevel
#include "mozilla/LinkedList.h"
#include "mozilla/TimeStamp.h" // for TimeStamp, TimeDuration