Skip to content

Instantly share code, notes, and snippets.

@tassoevan
Last active December 11, 2018 13:51
Show Gist options
  • Save tassoevan/78b043b43f7fe7f18f7110ba148a5a52 to your computer and use it in GitHub Desktop.
Save tassoevan/78b043b43f7fe7f18f7110ba148a5a52 to your computer and use it in GitHub Desktop.
Rocket.Chat utils
function rocketchat_test_mode {
docker stop rocketchat_mongo
docker rm rocketchat_mongo
docker run --name=rocketchat_mongo -p 27017:27017 -d mongo:3.2 mongod --smallfiles --oplogSize 128 --storageEngine=mmapv1
TEST_MODE=true MONGO_URL=mongodb://localhost:27017/rocketchat meteor run
}
#meteor npm run chimp-test
(() => {
const document = window.document.implementation.createDocument('http://www.w3.org/2000/svg', 'svg');
const newSvg = document.documentElement;
newSvg.setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xlink', 'http://www.w3.org/1999/xlink');
newSvg.setAttribute('style', 'display: none');
Array.from(window.document.querySelector('#icon-add-reaction').parentElement.children)
.sort((iconA, iconB) => iconA.getAttribute('id').localeCompare(iconB.getAttribute('id')))
.map((icon) => icon.cloneNode(true))
.map((icon) => Array.from(icon.attributes)
.sort((attrA, attrB) => attrA.name.localeCompare(attrB.name))
.reduce((icon, attr) => {
icon.removeAttribute(attr.name);
icon.setAttribute(attr.name, attr.value);
return icon;
}, icon)
)
.forEach((icon) => {
newSvg.appendChild(document.createTextNode('\n '));
newSvg.appendChild(icon);
});
newSvg.appendChild(document.createTextNode('\n'));
console.log(newSvg.outerHTML);
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment