Skip to content

Instantly share code, notes, and snippets.

View lesliedoherty's full-sized avatar
🐈
Contribution Model Cat

Leslie Doherty lesliedoherty

🐈
Contribution Model Cat
View GitHub Profile
@lesliedoherty
lesliedoherty / pairs.js
Last active June 17, 2021 13:52
Return number of pairs in an array using hash and Array.reduce
const findPairs = (array) => {
let hash = {};
array.forEach(i => hash[i] ? hash[i] += 1 : hash[i] = 1);
return Object.values(hash).reduce((total, value) => total + Math.floor(value/2), 0);
}
@lesliedoherty
lesliedoherty / Bookmarklet for Identifying Heading Order on a web page
Created May 24, 2021 18:18
Use this as a bookmark in your browser to visually find all heading and heading order for SEO and A11y
javascript:if(window.a11yHeadings)window.a11yHeadings.run()%3Belse%7B(function()%7Bvar link%3Ddocument.createElement(%27link%27)%3Blink.rel%3D%27stylesheet%27%3Blink.type%3D%27text/css%27%3Blink.href%3D%27https://accessibility-bookmarklets.org/build/styles.css%27%3Bdocument.getElementsByTagName(%27head%27)%5B0%5D.appendChild(link)%3Bvar script%3Ddocument.createElement(%27script%27)%3Bscript.type%3D%27text/javascript%27%3Bscript.src%3D%27https://accessibility-bookmarklets.org/build/headings.js%27%3Bdocument.getElementsByTagName(%27head%27)%5B0%5D.appendChild(script)%3B%7D)()%3B%7D
{
"metadata": {
"url": "https://tableau.com/about/contact",
"visits": 4159,
"violations": 55,
"passes": 363,
"incomplete": 36,
"inapplicable": 31
},
"result": {
@lesliedoherty
lesliedoherty / wcag2_1.csv
Last active June 24, 2024 13:15
WCAG 2.1 Guidelines in CSV
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 2.
Error,summary,sufficient techniques situation A,sufficient techniques situation B,sufficient techniques situation C,sufficient techniques situation D,sufficient techniques situation E,sufficient techniques situation F,Failures,Advisory Techniques
1.1.1 Non-text ContentLevel A,"All non-text content that is presented to the user has a text alternative that serves the equivalent purpose, except for the situations listed below. Show Hide full descriptionControls, Input: If non-text content is a control or accepts user input, then it has a name that describes its purpose. (Refer to Success Criterion 4.1.2 for additional requirements for controls and content that accepts user input.)Time-Based Media: If non-text content is time-based media, then text alternatives at least provide descriptive identification of the non-text content. (Refer to Guideline 1.2 for additional requirements for media.)Test: If non-text content is a test or exercise that would be invalid if presented in text, then text alternatives at least
@lesliedoherty
lesliedoherty / swipeURL.js
Created January 9, 2017 22:53
A quick prototype to answer a question about URL changes on swipe events
window.addEventListener('load', function(){
var swipeURLHandler = {
init: function (targetID, nextURL, prevURL) {
if (nextURL !== null) {
this.nextURL = nextURL.getAttribute('href');
} else {
this.nextURL = '#';
}
@lesliedoherty
lesliedoherty / LESS Flexbox mixin
Created January 7, 2017 21:28
A LESS version of the bourbon flexbox mixins
// Flexbox mixin to help with vendor prefixes.
// The spec: http://www.w3.org/TR/css3-flexbox
// Flexbox display
// flex or inline-flex
.flex-display(@display: flex) {
display: ~"-webkit-@{display}";
display: ~"-moz-@{display}";
display: ~"-ms-@{display}box"; // IE10 uses -ms-flexbox
display: ~"-ms-@{display}"; // IE11
@lesliedoherty
lesliedoherty / gist:e7a6201c54697e9576f7
Created October 4, 2015 16:36 — forked from BrettBukowski/gist:3bed4b58276e5596e74f
Perfect vertical+horizontal centering (in SCSS + Bourbon)
// Perfect vertical+horizontal centering.
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
@include prefixer(box-align, center, webkit moz ms spec);
-ms-flex-align: center;
@include prefixer(align-items, center, webkit spec);