Skip to content

Instantly share code, notes, and snippets.

View mziemer21's full-sized avatar

Matt Ziemer mziemer21

  • Pinterest
  • San Francisco, CA
View GitHub Profile
@tomhicks
tomhicks / plink-plonk.js
Last active March 18, 2024 02:23
Listen to your web pages
@addyosmani
addyosmani / bytecode.md
Last active May 28, 2022 22:40
Thoughts on precompiling JS bytecode for delivery through a server/CDN

Some quick thoughts on https://twitter.com/dan_abramov/status/884892244817346560. It's not ignorant at all to ask how browser vendors approach performance. On the V8 side we've discussed bytecode precompilation challenges a few times this year. Here's my recollection of where we stand on the idea:

JavaScript engines like V8 have to work on multiple architectures. Every version of V8 is different. The architectures we target are different. A precompiled bytecode solution would require a system (e.g the server or a CDN) to generate bytecode builds for every target architecture, every version of V8 supported and every version of the JavaScript libraries or bundles bytecode is being generated for. This is because we would need to make sure every user accessing a page using that bytecode can still get the final JS successfully executed.

Consider that if a cross-browser solution to this problem was desired, the above would need to be applied to JavaScriptCore, SpiderMonkey and Chakra as well. It would need to ca

@gcanti
gcanti / HOC.js
Created September 14, 2016 09:24
/* @flow */
import React from 'react'
import ReactDOM from 'react-dom'
type FunctionComponent<A> = (props: A) => ?React$Element<any>;
type ClassComponent<D, A, S> = Class<React$Component<D, A, S>>;
type Component<A> = FunctionComponent<A> | ClassComponent<any, A, any>;
@marcysutton
marcysutton / enzyme-test.js
Last active August 23, 2021 08:20
React A11y Testing
import {expect} from 'chai';
import App from '../app/components/App';
import a11yHelper from "./a11yHelper";
describe('Accessibility', function () {
this.timeout(10000);
it('Has no errors', function () {
let config = {};

Turning Off Github Issues

My friend Michael Jackson turned off github issues on one of his smaller projects. It got me thinking...

Maintainers getting burned out is a problem. Not just for the users of a project but the mental health of the maintainer. It's a big deal for both parties. Consumers want great tools, maintainers want to create them, but maintainers don't want to be L1 tech support, that's why they

@fdecampredon
fdecampredon / Container.js
Last active August 27, 2017 17:04
redux-relay
import React from 'react';
import { container } from 'redux-relay';
@container({
variablesFromState: (state) => ({myVariable: state.myState})
fragments: {
Relay.QL`
viewer {
@paulirish
paulirish / what-forces-layout.md
Last active April 24, 2024 12:47
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@nkbt
nkbt / .eslintrc.js
Last active April 23, 2024 03:19
Strict ESLint config for React, ES6 (based on Airbnb Code style)
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"plugins": ["react"],
"ecmaFeatures": {
@ejoubaud
ejoubaud / simulate_keypress.js
Last active April 9, 2024 18:38
Simulate keypress that works in Google nav in Chrome
// Based on http://stackoverflow.com/a/10520017/1307721 and http://stackoverflow.com/a/16022728/1307721
Podium = {};
Podium.keydown = function(k) {
var oEvent = document.createEvent('KeyboardEvent');
// Chromium Hack
Object.defineProperty(oEvent, 'keyCode', {
get : function() {
@addyosmani
addyosmani / README.md
Last active April 2, 2024 20:18 — forked from 140bytes/LICENSE.txt
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version