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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
//yarn add compromise stemmer en-inflectors wink-lemmatizer wink-pos-tagger wink-porter2-stemmer | |
//the goal is to find a way to generate all possible forms of word starting with just one form: any_word -> part of speech + lemma -> inflection | |
let terms = ['design', 'designs', 'designed', 'designing', 'designer', 'designers', 'designate', 'designated', 'designator', 'designators', 'ox', 'oxen', 'index', 'indices', 'criteria']; | |
console.group('stemmer'); | |
console.time('stemmer'); | |
import {stemmer} from 'stemmer'; | |
console.timeLog('stemmer', 'loaded'); | |
(function tryStemmer() { |
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 toc = document.getElementById('table-of-contents'); | |
for (const x of document.querySelectorAll('h2, h3')) { | |
const id = x.innerText.replaceAll(/[^a-z0-9]/gi,''); | |
x.id = id; | |
const item = `<li><a href="#${id}">${x.innerText}</a></li>`; | |
switch (x.tagName.toLowerCase()) { | |
case "h2": toc.insertAdjacentHTML('beforeend', `${item}<ul></ul>`); break; | |
case "h3": [...toc.querySelectorAll('ul')]?.pop()?.insertAdjacentHTML('beforeend', item); 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
<script lang="ts"> | |
import { nextTick, onMounted, onUnmounted, ref } from 'vue' | |
export default { | |
expose: [], | |
async mounted() { | |
const firstEl = <Text>this.$el; | |
if (!firstEl.nextElementSibling) { | |
return; | |
} |
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
let typestr = ""; | |
for (const key in properties) { | |
if (Object.prototype.hasOwnProperty.call(properties, key)) { | |
const value = properties[key]; | |
typestr += key + ": "; | |
let t = <string> typeof value; | |
t = t === "undefined" ? "unknown" : t; | |
if(t === "object" && Array.isArray(value)) { | |
let tt = <string> typeof value[0]; | |
tt = tt === "undefined" ? "unknown" : tt; |
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
async function run() { | |
console.clear(); | |
await figma.currentPage.loadAsync(); | |
const dryRun = false; | |
const skipDevReady = true; | |
console.log(dryRun ? 'DRY RUN' : 'NORMAL RUN'); |