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() { | |
const style = document.createElement("style"); | |
style.setAttribute("media", "screen") | |
document.head.appendChild(style); | |
const sheet = style.sheet; | |
sheet.insertRule(`img[alt=""], img[alt="Alt Text"], img:not([alt]):not([role*="presentation"]){border:2px dashed red;}`) | |
sheet.insertRule(`img[role*="presentation"], img[role*="none"]{border:2px solid blue;}`) | |
})(); |
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 expected = [ | |
'ArrowUp', | |
'ArrowDown', | |
'ArrowUp', | |
'ArrowDown', | |
'ArrowLeft', | |
'ArrowRight', | |
'ArrowLeft', | |
'ArrowRight', | |
'a', |
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
ng generate module common -m app | |
ng generate service common/authentication | |
ng generate guard common/authentication | |
ng generate module QuantityAdjustments -m app --routing | |
ng generate component quantity-adjustments/QuantityAdjustmentsItem -m quantity-adjustments --force --prefix=rpm --flat | |
ng generate component quantity-adjustments/QuantityAdjustmentsList -m quantity-adjustments --force --prefix=rpm --flat | |
ng generate component quantity-adjustments/QuantityAdjustments -m quantity-adjustments --force --prefix=rpm --flat | |
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
for i in $(find . -type d -name '.git'); | |
do dirname $i; | |
echo "$( | |
cd $(dirname $i); | |
git pull; | |
cd - | |
)"; | |
done; |
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 flatten = object => { | |
return Object.assign( {}, ...function _flatten( objectBit, path = '' ) { //spread the result into our return object | |
return [].concat( //concat everything into one level | |
...Object.keys( objectBit ).map( //iterate over object | |
key => typeof objectBit[ key ] === 'object' ? //check if there is a nested object | |
_flatten( objectBit[ key ], `${ path }/${ key }` ) : //call itself if there is | |
( { [ `${ path }/${ key }` ]: objectBit[ key ] } ) //append object with it’s path as key | |
) | |
) | |
}( object ) ); |
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 (app) { | |
"use strict"; | |
function format_nanp(num) { | |
return num | |
.replace(/[^0-9]/g, '') | |
.replace(/^\+?1?(\d{1,3})(\d{0,3})(\d{0,4})(.*)/, function replacer( | |
match, | |
p1, p2, p3, p4, offset, string) { | |
return `(${p1}) ${p2}-${p3}` + ((p4) ? ' ext. ' + p4 : ''); |
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 Bitmask(value) { | |
function parse(value){ | |
return Number(parseInt(value)||0); | |
} | |
return Object.create({}, { | |
_value: { | |
value: parse(value), | |
enumerable: false, | |
configurable: false, | |
writable: true |
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 ENUM(){ | |
return Object.create({}, { | |
add: { | |
value: function (name) { | |
name = name.replace(/\s/, '_').replace(/\W/, '').toUpperCase(); | |
var ptr = this; | |
Object.defineProperty(ptr, name, { | |
enumerable: true, | |
configurable: false, | |
writable: 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
# Colorize your script output like it's 1985 | |
clrd() [ $# -lt 3 ]&& echo "Usage: $0 COLOR BOLD message\n" || printf "\033[%d;%dm%s\033[0;0m" $2 $1 "${@:3}"} | |
# echo with feeling | |
bold() { local MSG=$@;echo -e $(clrd 33 1 ">") $(clrd 30 1 "$MSG"); } | |
# Make a repeating string of characters | |
make_str() { [[ -z $2 ]] && $2="*"; [[ -z "$1" || "$1" -lt 1 ]] && echo || { echo -n "$2"; make_str $(( $1-1 )) "$2"; }; } |
NewerOlder