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 ifIn(array) { | |
| console.group(`ifIn======`); | |
| let i = 0; | |
| while (i < array.length) { | |
| if (i++ in array) { | |
| console.log(`${i - 1} is in the array`); | |
| } | |
| } | |
| console.groupEnd(); |
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
| /** Evaluates an array, makes the key lowercasee and makes the value an object with original keyname | |
| * @param {Array} iterable=[] an array of arrays:[[key,val],[key,val]] | |
| * @returns Array | |
| */ | |
| function LowercaseIterable(iterable = []) { | |
| if (iterable.length === 0) return []; | |
| const newIterable = iterable.map(([key, val]) => { | |
| const entry = [ | |
| key.toLowerCase(), |
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
| /** | |
| * @typedef SpeakerDefaults | |
| * @type {object} | |
| * @property {string} voiceURI voice that the browser uses | |
| * @property {Number} volume loudness. Between 0 and 1.0 | |
| * @property {Number} rate speed at which words are spoken. Between 0 and 2. | |
| * @property {Number} pitch Between 0 and 2 | |
| * @property {string} lang ISO language | |
| */ |
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
| /** queryCSSBySelector | |
| * queries the CSSOM and DOM looking for rulesets containing a particular partial or whole CSS selector | |
| * @param {string} selector - The CSS selector to search for | |
| * @param {object} [HTMLElement=document] - the node where the search begins | |
| * @returns {Map<String,CSSRule>} Map where the key is a string and the value is the complete CSS Rule | |
| */ | |
| function queryCSSBySelector(selector, root = document) { | |
| const styleSheets = Object.assign({},root.styleSheets, root.adoptedStyleSheets); // get all the stylesheets | |
| const results = new Map(); // set up the variable that'll store our result |
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
| body { | |
| --bgColor: #111; | |
| --textColor:rgb(201, 208, 221) ; | |
| --infoColor: rgba(201, 208, 221, .7) ; | |
| --titleColor: rgb(133,153,187); | |
| --linkColor: rgb(57,114,198); | |
| --buttonBGColor: #444547; | |
| --buttonColor: rgb(201,228,221); | |
| --buttonBGColorHover: #72829e; | |
| --itemBGColor: #272524; |
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
| /* Courtesy of Jake Albaugh: https://twitter.com/jake_albaugh/status/1118611365508337665 */ | |
| const bars = ["▁", "▂", "▃", "▄", "▅", "▆", "▇", "█"]; | |
| const ctx = new AudioContext(); | |
| const analyser = ctx.createAnalyser(); | |
| analyser.fftSize = 32; | |
| const uIntArray = new Uint8Array(16); | |
| navigator.mediaDevices.getUserMedia({ audio: true }).then(stream => { | |
| ctx.createMediaStreamSource(stream).connect(analyser); | |
| updateUrl(); |
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 collatz(n, steps = []) { | |
| if (isNaN(n)) return NaN; | |
| if (steps.length === 0) steps.push(n); | |
| const isEven = n%2 === 0; | |
| const newInt = isEven ? n / 2 : (3 * n) + 1; | |
| steps.push(newInt); | |
| return newInt !== 1 ? collatz(newInt, steps) : steps; |
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 os, shutil, sys, getopt, fnmatch, json | |
| from os.path import join | |
| from HTMLParser import HTMLParser | |
| from pyth.plugins.rtf15.reader import Rtf15Reader | |
| from pyth.plugins.xhtml.writer import XHTMLWriter | |
| from bs4 import BeautifulSoup | |
| # constants | |
| DEFAULT_DICTIONARY = { | |
| 'chronoNumber': '', |
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
| const verbAspects = ['simple', 'continuous', 'perfect', 'perfectContinuous']; | |
| const verbTenses = ['past', 'present', 'future']; | |
| const verbMoods = ['indicative', 'imperative', 'subjunctive']; | |
| const moods = { | |
| indicative: { | |
| present: { |