Skip to content

Instantly share code, notes, and snippets.

View jakub-g's full-sized avatar

jakub-g jakub-g

  • Antibes, France
  • 16:37 (UTC +02:00)
View GitHub Profile
@jakub-g
jakub-g / legacy-browser-detection-ua-sniffing.js
Created December 21, 2020 11:26
legacy-browser-detection-ua-sniffing.js
(function() {
var isIE = typeof document.documentMode !== 'undefined'
var chromeVersion = navigator.userAgent.match(/Chrome\/(\d+)/) || undefined
chromeVersion = chromeVersion && parseInt(chromeVersion[1])
var firefoxVersion = navigator.userAgent.match(/Firefox\/(\d+)/) || undefined
firefoxVersion = firefoxVersion && parseInt(firefoxVersion[1])
@jakub-g
jakub-g / dynamic-polyfilling.js
Created December 20, 2020 13:43
dynamic-polyfilling.js
polyfillIfNeeded().then(() => {
// we (ab)use synchronous `require`, which is not standard JS (but is provided by webpack)
require('./app.js').start()
})
function polyfillIfNeeded(callback) {
if (browserSupportsAllFeatures()) {
return Promise.resolve()
} else {
@jakub-g
jakub-g / README.md
Last active November 3, 2020 18:08
.vscode/settings.json to ignore derived folders in vscode which make it dog slow when huge
@jakub-g
jakub-g / README.md
Last active November 3, 2020 17:58
git-branches-sorted-by-date-print-last-commit-message.sh

Description

  • prints all local branches, one per line
  • sorted by most recently updated (last commit date); rebased = updated
  • shows last commit date + branch name + (different color) last commit message

Usage:

$ branches # prints all local branches (long output but it's still fast)
@jakub-g
jakub-g / wpt-wishlist.md
Last active September 30, 2020 13:26
WebPageTest wishlist

1. Re-run the test equivalent which allows changing config

Sometimes I have very elaborate test config which I want to reuse, but slightly change one thing (e.g. add one param to URL). I can easily re-run the test with exact same config, but it's not easy to slightly change config and re-run. You need to re-create the config from scratch by checking multiple checkboxes, and hoping you come up with same exact set of params as before

2. Possibility to redefine the "median run" definition

It's apparently possible to override medianMetric param to tell WPT how to choose the median run. It would be nice to use a custom metric for that (say the first perf entry marked with performance.mark('WptEndMetric')). Maybe it's already possible?

// app.js
import { criticalHelper } from './utils.js'
let foo = criticalHelper();
// utils.js
import { nestedHelper } from './nested_helper.js'
export function criticalHelper() {/*...*/}
export function otherHelper(str) {
// nestedHelper recursively depends on 5k of code
@jakub-g
jakub-g / README.md
Last active June 2, 2020 15:11
Deprecation Dailymotion postMessage API

Context

If you landed on this page, you probably found a message like this in your logs:

This page is using deprecated Dailymotion postMessage API communication format that will be soon removed.
Please update your code. See https://gist.github.com/jakub-g/89613ccf35a98577ab9c8b9f20955eab for details.

Two possibilities

@jakub-g
jakub-g / loggers.txt
Created May 29, 2020 13:22
Filter out annoying loggers Chrome DevTools
-cookie -sourcemap -corb -cors
@jakub-g
jakub-g / _1_index.md
Last active May 16, 2020 12:58
Trójka LP3 1998 Kazik