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
const prefix = "is-"; | |
const elements = document.querySelectorAll(<SELECTOR>); | |
elements?.forEach((element) => { | |
const classes = elements.className | |
.split(" ") | |
.filter((c) => !c.startsWith(prefix)); | |
elements.className = classes.join(" ").trim(); | |
}); |
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
const items = [ | |
{ | |
key: 'categoryA', | |
sequence: 1 | |
}, | |
{ | |
key: 'categoryB', | |
sequence: 2 | |
}, | |
{ |
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
// array-of-objects | |
const dataset = [ | |
{ | |
id: 1, | |
name: 'Foo', | |
timestamp: new Date() | |
}, | |
{ | |
id: 2, | |
name: 'Bar', |
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
function findByKey(obj, keyToFind) { | |
return Object.entries(obj) | |
.reduce((acc, [key, value]) => (key === keyToFind) | |
? acc.concat(value) | |
: (typeof value === 'object') | |
? acc.concat(findByKey(value, keyToFind)) | |
: acc | |
, []) | |
} |
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
const xmlData = ``; | |
function getCommaSeparatedUrls(xml) { | |
const parser = new DOMParser(); | |
const xmlDoc = parser.parseFromString(xml, 'text/xml'); | |
const sitemapNodes = xmlDoc.getElementsByTagName('loc'); | |
const urls = []; | |
for (let i = 0; i < sitemapNodes.length; i++) { | |
urls.push(sitemapNodes[i].textContent); |
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
name: Create Environment Variables | |
on: push | |
jobs: | |
dev-build: | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/develop' | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v2 | |
- name: Create develop env file |
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 { toRefs } from 'vue' | |
import { reactive } from '@vue/reactivity' | |
import { IFetch } from '@/interfaces' | |
export default function useFetch() { | |
const state: IFetch = reactive({ | |
data: null, | |
isLoading: false, | |
errorMessage: '', | |
isFinished: false, |
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
const webComponent = document.querySelector(<COMPONENT>); | |
const shadow = webComponent && webComponent.shadowRoot; | |
const frame = shadow && shadow.querySelector('iframe'); | |
if (frame) { | |
const sheet = new CSSStyleSheet; | |
sheet.replaceSync('iframe { height: 100vh !important; width: 100vw !important; }'); | |
shadow.adoptedStyleSheets = [sheet]; | |
} |
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
// src/scss/variables.scss | |
$body-font-family: 'Noto Sans', sans-serif; | |
@use 'vuetify' with ( | |
$body-font-family: $body-font-family, | |
$heading-font-family: $body-font-family | |
); |
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
name: Run Unit Tests and Lint Files | |
on: push | |
jobs: | |
testing: | |
name: "Automated tests" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- run: | | |
npm ci |
NewerOlder