const mockTimers = () => {
const globalTimerFn = window.setTimeout;
const runAllTimers = () => (window.setTimeout = (fn) => fn());
const restoreAllTimers = () => (window.setTimeout = globalTimerFn);
return {runAllTimers, restoreAllTimers};
};
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Example: | |
// | |
// Include a link anywhere in the document: | |
// <a data-lightbox-button href='#' id="lightbox-1">lightbox 1</a> | |
// | |
// Then include the lightbox itself at the end of your <body> content: | |
// <div data-lightbox-overlay data-lightbox-1> | |
// <div class='lightbox-content' aria-labelledby="lightbox-heading-1" role="dialog"> | |
// <header> | |
// <h2 id="lightbox-heading-1">Lightbox Heading</h2> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
// Packages: | |
// | |
// - package control | |
// - babel | |
// - bracket highlighter | |
// - color highlighter | |
// - git blame | |
// - gitignored file exluder | |
// - jsprettier | |
// - sass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from "react" | |
import { withLastLocation } from "react-router-last-location" | |
import PropTypes from "prop-types" | |
class PageHeader extends Component { | |
constructor(props) { | |
super(props) | |
this.headerRef = React.createRef() | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react" | |
import { withLastLocation } from "react-router-last-location" | |
import PropTypes from "prop-types" | |
class AccessibleHeader extends React.Component { | |
constructor(props) { | |
super(props) | |
this.headerRef = React.createRef() | |
this.state = { tabIndex: null } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react" | |
import { Helmet } from "react-helmet" | |
import PropTypes from "prop-types" | |
export default function SetMeta({ title, description }) => ( | |
<Helmet titleTemplate="My Site | %s"> | |
<title itemProp="name" lang="en">{title}</title> | |
<meta name="description" content={description} /> | |
</Helmet> | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const dom = { | |
// Attribute manipulation | |
getAttr: (element, attr) => element.getAttribute(attr), | |
setAttr: (element, attr, value) => element.setAttribute(attr, value), | |
removeAttr: (element, attr) => element.removeAttribute(attr), | |
toggleAttr: (element, attr, forceCondition) => element.toggleAttribute(attr, forceCondition), | |
hasAttr: (element, attr) => element.hasAttribute(attr), | |
// Element selection | |
find: (selector, parent = document) => parent.querySelector(selector), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { terser } from "rollup-plugin-terser" | |
import path from "path" | |
import resolve from "rollup-plugin-node-resolve" | |
import babel from "rollup-plugin-babel" | |
import glob from "glob" | |
const scriptPattern = path.resolve(__dirname, "_scripts/**/!(_)*.js") | |
const inputs = glob.sync(scriptPattern).reduce((files, input) => { | |
const parts = input.split("/") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: 2 | |
jobs: | |
build: | |
working_directory: ~/repo-working-dir | |
docker: | |
- image: circleci/ruby:2.6.5-node-browsers | |
steps: | |
- checkout | |
- save_cache: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -o nounset | |
set -o errexit | |
set -o pipefail | |
git config user.name "$USER_NAME" | |
git config user.email "$USER_EMAIL" | |
# Add github to known_hosts to enable push from CI |
OlderNewer