Skip to content

Instantly share code, notes, and snippets.

View zetlen's full-sized avatar

James Zetlen zetlen

View GitHub Profile
@zetlen
zetlen / AUDIT.md
Last active December 28, 2022 17:09
Site quality audit for arkexchange.co.uk

Overall

This is a good website. It's not terribly heavy, it doesn't have a lot of slow rendering, and it has clear UX. Any recommendations below are for performance and UI enhancement, and are at most high priority rather than critical. Still, there are improvements to make that will yield much better performance and usability for not much effort.

Sitewide

The site is very competently built and served in most ways. The origin server (Apache on Ubuntu) is reasonably fast. Response times are acceptable. And the site behaves well on mobile devices.

Lighthouse

import React from 'react';
import { useParams } from 'react-router-dom';
import gql from 'graphql-tag';
import { useQuery } from '@apollo/react-hooks';
import Gallery from '@magento/venia-ui/lib/components/Gallery';
const COMPARE_QUERY = gql`
query compareProducts($skus: [String]) {
products(filter: { sku: { in: $skus } }, pageSize: 2) {
items {
@zetlen
zetlen / codepencil.markdown
Created October 28, 2019 19:14
codepencil
@zetlen
zetlen / CORRIGENDA.md
Last active May 14, 2019 21:50
CORRIGENDA
  • After the git clone, run cd pwa-studio
  • The admin password is admin
  • If yarn run watch:venia causes a "certificate.cert missing" error, run rm –rf ~/Library/Application\ Support/devcert && yarn run watch:venia
  • blossom-hill.svg is here: https://adobe.ly/2WH35Hm
  • Step 2.3: The Gallery component is located at /packages/venia-concept/src/components/Gallery.
  • If the Gallery stylesheet is not applying: Ctrl-C to cancel the dev mode, git pull && yarn run watch:venia
  • Step 2.5: Set the grid-template-column to 1fr auto, not auto auto.
@zetlen
zetlen / example.spec.js
Last active July 7, 2018 18:06
Repro: jest --watch hangs when moduleNameMapper maps to a missing file
const me = require('missing');
test('which never runs', () => {
expect(me).not.toBe('working');
});
@zetlen
zetlen / keybase.md
Created October 1, 2017 12:26
keybase.md

Keybase proof

I hereby claim:

  • I am zetlen on github.
  • I am zetlen (https://keybase.io/zetlen) on keybase.
  • I have a public key ASAsldXCUyP8aFbCknefCY0QiebTXTF5EmFvcvfXWR-JIQo

To claim this, I am signing this object:

@zetlen
zetlen / n5json.js
Created June 24, 2017 22:07
workaround for npm5 64k stream pipe bug
/**
* Convenience function to extract and parse JSON from npm5 responses.
*
* As of this writing, npm5 doesn't behave when piped to a non-TTY. It truncates output at 64kb.
* [Until this issue is resolved]{@link https://github.com/npm/npm/issues/17331}, we must
* simulate a real TTY to extract full JSON responses from NPM programmatically. This function
* uses [pty.js]{@link https://github.com/chjj/pty.js} to simulate a TTY, runs any NPM command
* with the `--json` flag, and returns a Promise for the parsed JSON of the response.
*
* @param {string} cmd - The npm command to run, such as `ls` or `info`.
@zetlen
zetlen / logging.js
Last active January 27, 2017 20:34
fiddle logging utils
window.FiddleLog = (function() {
function identity(arg) {
return arg;
}
function h(tagname, contents) {
var tag = document.createElement(tagname);
if (contents) tag.appendChild(document.createTextNode(contents));
return tag;
}
function styleroll() {
$(window).bind("load resize scroll",function(){
windowWidth2 = jQuery(window).width();
var maxInRow = [];
if (windowWidth2 > 767)
{
maxInRow.length = 0;
maxInRow.push(12);
### Keybase proof
I hereby claim:
* I am zetlen on github.
* I am zetlen (https://keybase.io/zetlen) on keybase.
* I have a public key whose fingerprint is DD1D 8801 710F 581A 63F6 C40B 3D82 F00E 8A3A 88B1
To claim this, I am signing this object: