Skip to content

Instantly share code, notes, and snippets.

View bjankord's full-sized avatar
🎵
Chillin'

Brett Jankord bjankord

🎵
Chillin'
View GitHub Profile
@bjankord
bjankord / postcss-ast.js
Created December 2, 2022 18:51
POSTCSS Find background CSS declarations that use /p/assets/images/1x1.png
const uniqueValue = [
"/p/assets/images/1x1.png"
];
const plugin = () => ({
postcssPlugin: 'postcss-reverse-props',
Once(root) {
// Transform CSS AST here
root.walkRules(rule => {
// Transform each rule here
@bjankord
bjankord / webp-support.js
Created November 6, 2012 22:09
Test for WebP Support
var img = new Image(),
supported = false;
img.src ="data:image/webp;base64,UklGRkYAAABXRUJQVlA4IDoAAABwAgCdASoEAAQAAYcIhYWIhYSIiQIADAzdrBLeABAAAAEAAAEAAPKn5Nn/0v8//Zxn/6H3QAAAAAA=";
img.onload = function() { supported = true; }
img.onerror = function(e) {}
window.onload = function() {
if (supported) {
document.getElementsByTagName('html')[0].className += ' webp';
@bjankord
bjankord / index.js
Created January 14, 2019 18:34
axe-core + puppeteer set up
const util = require('util');
const puppeteer = require('puppeteer');
const axe = require('axe-core');
const urls = [
'https://engineering.cerner.com/terra-ui/#/home/terra-ui/index',
'https://engineering.cerner.com/terra-ui/#/getting-started/terra-ui/what-is-terra',
];
const results = [];
@bjankord
bjankord / gist:4240280
Created December 8, 2012 13:28
JS IE Detection with conditional comments
var ieCheck = document.createElement('div');
ieCheck.innerHTML = '<!--[if lt IE 7]>IE6<![endif]--><!--[if IE 7]>IE7<![endif]--><!--[if IE 8]>IE8<![endif]--><!--[if IE 9]>IE9<![endif]-->';
if (ieCheck.innerHTML === 'IE6') {
alert('IE6 or lower');
} else if (ieCheck.innerHTML === 'IE7') {
alert('IE7');
} else if (ieCheck.innerHTML === 'IE8') {
alert('IE8');
@bjankord
bjankord / viewed-all-files script
Created July 30, 2019 17:32
Viewed All Files script
// Checkes all "Viewed" checkboxes
var x = document.querySelectorAll('.js-reviewed-checkbox'), i = 0;
for (i = 0; i < x.length; i++) {
x[i].click();
}
@bjankord
bjankord / find-and-replace-script.js
Last active July 12, 2019 11:19
Changelog find and replace script
#!/usr/bin/env node
/* eslint-disable no-console */
/* eslint import/no-extraneous-dependencies: ["error", {"devDependencies": true}] */
const fs = require('fs');
const path = require('path');
const packagePaths = require('../peer-dependency-generator/getPackagePaths');
const findAndReplace = require('../peer-dependency-generator/findAndReplace');
// Generate the markdown to display peerDependencies information for each package
packagePaths.forEach((packagePath) => {
var nav = document.querySelector('.nav__toggle');
var toggleState = function (elem, one, two) {
var elem = document.querySelector(elem);
elem.setAttribute('data-state', elem.getAttribute('data-state') === one ? two : one);
};
nav.onclick = function (e) {
toggleState('.nav ul', 'closed', 'open');
e.preventDefault();
};
@bjankord
bjankord / datepicker-popup.jsx
Created April 9, 2019 10:28
datepicker-popup
{calendar && <Popup
attachmentBehavior="flip"
contentAttachment={'top center'}
isArrowDisplayed={true}
isOpen={(this.state.open && !this.props.disabled)}
targetAttachment={'bottom center'}
targetRef={() => this.datePickerContainer}
contentHeight="auto"
contentWidth="auto"
>
add src/icons/0001_plus_a.svg themeable
search src/icons/0002_magnifyingGlass_a.svg themeable
commit src/icons/0003_check_a.svg themeable
reload src/icons/0152_circleArrow_a.svg themeable deprecated
checkmark src/icons/0003_check_a.svg themeable
success src/icons/0003_check_i_heavyCircleGreen.svg
success_low_light src/icons/LL_0003_check_i_heavyCircleGreen.svg
success_inverse src/icons/0003_check_i_heavyCircleWhite.svg
success_inverse_low_light src/icons/LL_0003_check_i_heavyCircleWhite.svg
available src/icons/0003_check_i_heavyCircleGreen.svg
@bjankord
bjankord / lerna-updated-output.md
Created March 26, 2019 15:36
terra-base terra-i18n major version bump

terra-core|update-base-and-i18n-packages ⇒ lerna updated lerna info version 2.11.0 lerna info versioning independent lerna info ignore [ 'DEPENDENCIES.md', 'terra-i18n-plugin', '*.tgz' ] lerna info Checking for updated packages... lerna info Comparing with terra-responsive-element@4.5.0. lerna info Checking for prereleased packages... lerna info result

  • terra-base
  • terra-i18n