Skip to content

Instantly share code, notes, and snippets.

// TextMeasurement.cpp
//
// Originally taken from Cameron McCormack's text_measurement.cpp
// https://gist.github.com/heycam/942f621ff9def88af92ddc3ec2d59a03
//
// ACME Browser Corporation is writing a brand new browser engine! One of the
// main responsibilities of a browser is to display text to the user, and this
// text must be wrapped to the width of the browser window so that the user
// is not scrolling back and forth all the time.
//
@grorg
grorg / Emoji.plist
Last active March 22, 2021 18:38
Use text substitution to make typing emoji easy on OS X.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!--
Text expansion shortcuts for a bunch of emoji.
e.g. ";poo" -> 💩
Not all emoji are included, but I tried to come up with obvious names. There
are also a few in-jokes, sorry.
Cheat sheet: https://gist.github.com/grorg/4773372
<style>
div {
width: 400px;
height: 400px;
overflow: -webkit-paged-x;
}
</style>
<div>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore
magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
<!DOCTYPE html>
<meta charset="utf-8">
<title>WebGPU Hello Triangles</title>
<meta name="assert" content="WebGPU correctly renders a green canvas.">
<link rel="match" href="simple-triangle-strip-expected.html">
<p>Pass if square canvas below is completely green.</p>
<canvas width="400" height="400"></canvas>
<script>
const shaderCode = `
#include <metal_stdlib>
diff --git a/Scripts/rollup.js b/Scripts/rollup.js
index 50cc5f5..18cc404 100644
--- a/Scripts/rollup.js
+++ b/Scripts/rollup.js
@@ -1,162 +1,163 @@
-export * from "../Source/Node.js";
-export * from "../Source/Type.js";
-export * from "../Source/ReferenceType.js";
-export * from "../Source/Value.js";
-export * from "../Source/Expression.js";
@grorg
grorg / gist:6732841
Last active November 30, 2018 18:52
Why does animating left paint more often than translateX?
As asked by John on Twitter: https://twitter.com/johnallsopp/status/383461909640384512
"wow. Animate change to left via CSS, ~500 paint/reflow events. Animate translateX - 16!"
Answering here because it's a long response and I'm too slack to have a
blog/tumble/plus/facebook/myspace.
NOTE: This answer is out of date. See comment below.
The easy answer is that changing left causes relayout, which triggers a repaint, while
diff --git a/Source/WebCore/platform/graphics/mac/WebLayer.mm b/Source/WebCore/platform/graphics/mac/WebLayer.mm
index 1103d37e62d..808804b2f85 100644
--- a/Source/WebCore/platform/graphics/mac/WebLayer.mm
+++ b/Source/WebCore/platform/graphics/mac/WebLayer.mm
@@ -39,8 +39,6 @@
#import "WebCoreThread.h"
#endif
-using namespace WebCore;
-
@grorg
grorg / GoT Deaths.md
Last active July 1, 2016 02:11
Notable deaths on Game of Thrones

Notable Deaths on Game of Thrones

As of 1 July 2016

Mostly Westeros, but a few others at the end. Note that I'm only considering the TV series here, and that I'm not trying to be super precise (i.e. there are certainly errors and omissions).

I just tried to come up with a list when I realised that all the 5 Kings were

@grorg
grorg / blockerList.json
Created August 6, 2015 00:15
Block Taboola and Outbrain
[
{
"action": {
"type": "block"
},
"trigger": {
"description": "That 'content you may like' crap.",
"url-filter": "^[a-zA-Z][a-zA-Z0-9+-.]*:/+([^/]+\\.)?taboola\\.com"
}
},