made with esnextbin
This file contains hidden or 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 tape from 'tape'; | |
import jsdom from 'jsdom-global'; | |
export function test (description, fn, { html } = {}) { | |
tape(description, t => { | |
const cleanup = jsdom(html); | |
fn(t); | |
cleanup(); | |
}); | |
} |
This file contains hidden or 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 { expect } from 'chai'; | |
describe('dom', () => { | |
before(function () { | |
this.jsdom = require('jsdom-global')() | |
}) | |
after(function () { | |
this.jsdom() |
This file contains hidden or 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
// Copyright © John Leitch 2010 [email protected] | |
var destination = null; | |
var useClone = false; | |
var cloneSource = null; | |
var cloneDelay = 1000; | |
function hookInputs() { | |
var frame = document.getElementById('overlayFrame'); | |
var keyPressScript = |
This file contains hidden or 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
~'foo'.indexOf('oo'); |
This file contains hidden or 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
/** | |
* Return data attribute value from a given element. Falls back to `getAttribute()` in older browsers. | |
* @example | |
* let value = getDataAttributeValue(element, 'component-name'); | |
* @example | |
* let value = getDataAttributeValue(element, 'componentName'); | |
*/ | |
export default function getDataAttributeValue(element, dataName, defaultDataValue = '') { | |
const datasetSupported = element.dataset !== undefined; |
This file contains hidden or 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
/** | |
* Returns an array of elements with a matching data attribute name. | |
* @example | |
* let value = getElementsByDataAttribute('component-name'); | |
*/ | |
export default function getElementsByDataAttribute(name) { | |
var elements = document.querySelectorAll(`[data-${name}]`); | |
return Array.prototype.slice.call(elements); | |
}; |
This file contains hidden or 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 Uninstall-NpmPackagesInDirectory { | |
Param ( | |
# Optional path to node_modules directory | |
[String]$pathToNodeModules = (Get-Item -Path ".\node_modules").FullName | |
) | |
# Loop over each folder in the directory | |
ForEach ($dep in Get-ChildItem -Path $pathToNodeModules | ? { $_.FullName -notmatch ".bin" }) { | |
# Uninstall the package | |
iex "npm uninstall $dep" |
This file contains hidden or 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 Uninstall-NpmPackages { | |
Param ( | |
# Optional path to package.json | |
[String]$pathToPackage = $(Resolve-Path "package.json") | |
) | |
# Read the json content | |
$json = (Get-Content $pathToPackage) -join "`n" | ConvertFrom-Json | |
# Loop over each package in devDependencies |
This file contains hidden or 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
Execute a function by specifying its name as a string. | |
----- | |
A [Pen](http://codepen.io/anon/pen/AgCDt) by [Anonasaurus Rex](http://codepen.io/anon) on [CodePen](http://codepen.io/). | |
[License](http://codepen.io/anon/pen/AgCDt/license). |