Skip to content

Instantly share code, notes, and snippets.

View EdwardIrby's full-sized avatar

Edward Irby EdwardIrby

View GitHub Profile
@EdwardIrby
EdwardIrby / .env.example
Last active December 31, 2023 16:05
Docker Playwright Storybook setup
CONTAINER_NAME=monorepo
ENTRYPOINT=yarn
STORYBOOK_PORT=6006
TAG=v1.40.0-jammy
@EdwardIrby
EdwardIrby / LICENSE
Last active April 22, 2019 00:43
yarn-completion
MIT License
Copyright (c) 2016 Luke Childs, 2017 Ulysse Buonomo, 2019 Edward Irby
Copyright for portions of yarn-completion are held by Edward irby (2019) as
part of project zsh-better-npm-completion. All other copyright for project
yarn-completion held by Luke Childs (2016) and Ulysse Buonomo (2017).
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@EdwardIrby
EdwardIrby / framgenScript.js
Created April 10, 2019 23:12
alternative to createTemplate
/**
* @param {(ShadowRoot|HTMLElement)} shadowRoot
* @param {...string} strings
*/
export const createFragment = (root, ...strings) => {
removeChildren(root);
const range = document.createRange();
range.setStart(root, 0);
return range.createContextualFragment(
[...strings]
@EdwardIrby
EdwardIrby / withBundle.js
Created March 19, 2019 09:09
@dxworks/rite puppeteer helper
/* eslint-disable no-shadow */
import multiEntry from 'rollup-plugin-multi-entry';
import path from 'path';
import resolve from 'rollup-plugin-node-resolve';
const rollup = require('rollup');
export const withBundle = async (...entries) => {
const inputOptions = {
input: entries.length > 1
@EdwardIrby
EdwardIrby / tokens.js
Created March 8, 2019 06:41
Tokens.js a small utility function to make writing custom props a bit easier in js.
/**
* @param {...{}} objs - object containing camelCased style properties or css custom properties
* @returns {<{'--prop': 'value'}>} containing prefixed css custom properties to be inlined.
* @example Simple
* <Textblock style={tokens({
* lineHeight: 1.2,
* fontSize: rem(47.78),
* })} />
* @example Conditional Example
* <Textblock style={tokens(
@EdwardIrby
EdwardIrby / Textblock.css
Last active March 6, 2019 21:34
Textblock Component Example
.Textblock {
display: var(--display);
}
@EdwardIrby
EdwardIrby / App.jsx
Created March 5, 2018 01:06
Pulling the ShadowDom Component all together
class App extends React.Component {
constructor(props){
super(props);
this.state = {
value: props.value,
}
this.handleChange = this.handleChange.bind(this);
}
handleChange(e) {
const { value } = e.target;
@EdwardIrby
EdwardIrby / LightDomUsage.jsx
Created March 5, 2018 01:01
Light Dom FACE
export const LightDomUsage = (props) => {
return (
<ShadowDom lightDom={
() => (
<Fragment>
<span>I'm some light dom </span>
<span slot='span' className='text'>I'm some slottedlight dom </span>
</Fragment>
)
}>
@EdwardIrby
EdwardIrby / UsingShadowDom.jsx
Last active March 5, 2018 17:53
Any child wrapped by ShadowDom
export const BasicUsage = (props) => {
const { text } = props;
return (
<ShadowDom className={ className}>
<span>{ children }</span>
</ShadowDom>
)
}
@EdwardIrby
EdwardIrby / ShadowDom.js
Created March 5, 2018 00:53
A little Web Component in my React
import React, { Component, Fragment, Children } from 'react';
import { render, unmountComponentAtNode } from 'react-dom';
import PropTypes from 'prop-types';
export class ShadowDom extends Component {
constructor(props){
super(props)
this.getTargetRef = this.getTargetRef.bind(this);
}
componentDidMount() {