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 cssTree = require("[email protected]"); | |
function getSelectorParent(selector) { | |
const selectorAst = cssTree.parse(selector, { context: 'selector' }); | |
// solution #1 | |
selectorAst.children.prevUntil(selectorAst.children.tail, (node, item, list) => { | |
list.remove(item); | |
return node.type === 'Combinator' || node.type === 'WhiteSpace'; | |
}); |
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 (context, trackingId, options) { | |
const history = context.history; | |
const doc = document; | |
const nav = navigator || {}; | |
const storage = localStorage; | |
const encode = encodeURIComponent; | |
const pushState = history.pushState; | |
const typeException = 'exception'; | |
const generateId = () => Math.random().toString(36); | |
const getId = () => { |
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
server { | |
root /Users/peterbe/dev/MOZILLA/BALROG/balrog-ui/dist; | |
server_name balrog.prod; | |
proxy_set_header Host $host; | |
location ^~ /api/ { | |
proxy_pass http://127.0.0.1:9000; | |
break; | |
} |
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 OnBlurComponent({ onBlur }) { | |
const handleBlur = (e) => { | |
const currentTarget = e.currentTarget; | |
// Check the newly focused element in the next tick of the event loop | |
setTimeout(() => { | |
// Check if the new activeElement is a child of the original container | |
if (!currentTarget.contains(document.activeElement)) { | |
// You can invoke a callback or add custom logic here | |
onBlur(); |
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 python | |
# encoding: utf-8 | |
"""Convert caption files to different formats | |
One or more caption files will be converted to the specified output format, saved next to the input file | |
Requires the pycaption library from PBS: https://pypi.python.org/pypi/pycaption/ | |
""" | |
from __future__ import absolute_import, print_function, unicode_literals |