Skip to content

Instantly share code, notes, and snippets.

View chearon's full-sized avatar
🌴
On vacation

Caleb Hearon chearon

🌴
On vacation
View GitHub Profile
@chearon
chearon / browser-padding-words.md
Created October 24, 2021 02:25
Behavior of browsers when padding is on break characters

Padding and breaks

Padding is on a break and contains text

Padding-left Padding-right
Browsers do All browsers assign padding-left to the word after it All browsers assign padding-right to the word before it, but Safari does not consider the padding when measuring for fit and neither does Chrome when it’s **not **the last break
I do After Before
@chearon
chearon / vue-component-perf-stats.js
Last active April 23, 2019 02:03
Calculate average component render and patch times from a Chrome profile
// 1. Set Vue.config.performance = true
// 2. Record a profile while doing something
// 3. Save the profile to your disk
// 4. curl -s https://gist.githubusercontent.com/chearon/57f03295853896be90a1f9e7d00b086c/raw/vue-component-perf-stats.js | node - -- filename
const {createReadStream} = require('fs');
const readline = require('readline');
const input = createReadStream(process.argv[process.argv.length - 1]);
const rl = readline.createInterface({input});
@chearon
chearon / vuex-nested-getters.diff
Created August 20, 2018 20:12
Nested getters in Vuex
diff --git a/src/store.js b/src/store.js
index b5b083c..e5686f4 100644
--- a/src/store.js
+++ b/src/store.js
@@ -222,21 +222,37 @@ function resetStore (store, hot) {
resetStoreVM(store, state, hot)
}
+function registerModuleGetters (store, getters, path, module, computed) {
+ module.forEachGetter((_getter, key) => {
@chearon
chearon / freeze_prop.js
Created May 25, 2018 23:31
Test frozen props vs unfrozen
const Vue = require('vue');
bigarray = [];
for (let i = 0; i < 30000; ++i) {
bigarray.push({a: Math.random(), b: Math.random(), c: Math.random(), d: Math.random(), e: Math.random(), f: Math.random(), g: Math.random(), h: Math.random(), i: Math.random()});
}
let freeze = false;
/**
@chearon
chearon / tmux.conf
Last active September 27, 2022 16:47
tmux with true color, fish, solarized theme
#### COLOUR (Solarized 256)
# default statusbar colors
set -g status-bg colour235 #base02
set -g status-fg colour136 #yellow
set -g status-attr default
# default window title colors
set-window-option -g window-status-fg colour244 #base0
set-window-option -g window-status-bg default
@chearon
chearon / arraymut.js
Last active December 21, 2017 19:38
Array mutation comparison
const a = [];
let target = [];
function noop(){};
for (let i = 0; i < 500000; ++i) a.push(Math.random());
console.time("push(...)");
target.push(...a);
function fish_prompt --description 'Write out the prompt'
set -l color_cwd
set -l suffix
switch $USER
case root toor
if set -q fish_color_cwd_root
set color_cwd $fish_color_cwd_root
else
set color_cwd $fish_color_cwd
end
@chearon
chearon / config.fish
Created December 2, 2017 21:53
Fish config file
bass source $HOME/.cargo/env
From 95101a024258be3b058763fa00b526168e21df28 Mon Sep 17 00:00:00 2001
From: Caleb Hearon <caleb@chearon.net>
Date: Wed, 11 Oct 2017 14:24:49 -0400
Subject: [PATCH] fix bug #762873 - commas in family names for ct
---
pango/pangocoretext-fontmap.c | 58 +++++++++++++++++++++++++++----------------
1 file changed, 36 insertions(+), 22 deletions(-)
diff --git a/pango/pangocoretext-fontmap.c b/pango/pangocoretext-fontmap.c
#include <pango/pangocairo.h>
int
main(int argc, char **argv)
{
cairo_t *cr;
char *filename;
cairo_status_t status;
cairo_surface_t *surface;