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
| // Turn on styles for print | |
| document.querySelectorAll('*[media=screen]').forEach(e => e.media = 'all'); | |
| // Remove noisy answer indicators | |
| document.querySelectorAll('.answer_indicator').forEach(e => e.style.display = 'none') | |
| // Hide non-helpful quiz help instructions | |
| document.querySelector('.quiz-header').style.display = 'none'; | |
| // Hide unhelpful quiz submission details |
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
| // These embedded links have full transcripts but print to pdf can't get at the content. Opening into a dedicated non-iframe window | |
| // and clearing the fixed height, removes scrollbars and allowing print to pdf to work as expected | |
| function openAllFrames() { | |
| var iframes = Array.from(document.querySelectorAll('#content-wrapper iframe')); | |
| iframes.forEach(function(f) { | |
| window.open(f.src, "_blank"); | |
| }); | |
| } |
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 dumpPow(b, e) { | |
| const steps = []; | |
| console.log(`Raise ${b} to ${e}`); | |
| for(let j = 0; j <= e; j++) { | |
| const v = Math.pow(b, j); | |
| const len = v.toString().length; | |
| steps.push({ |
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
| // ==UserScript== | |
| // @name QuizletPrint | |
| // @namespace http://tampermonkey.net/ | |
| // @version 0.1 | |
| // @description Cleanup for quizlet print | |
| // @author John Lewin | |
| // @match https://quizlet.com/* | |
| // @grant none | |
| // ==/UserScript== |
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
| // Extracts the content of textNode children, skipping descendant elements | |
| function getTextContent(e) { | |
| return [...e.childNodes] // has childNodes inside, including text ones | |
| .filter(child => child.nodeType === 3) // get only text nodes | |
| .filter(child => child.textContent.trim()) // eliminate empty text | |
| .map(textNode => textNode.textContent) // extract text content | |
| .join('').trim(); | |
| } | |
| // Selects either the .answer_html, .answer_text, or textContent of the given element |
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
| var lastNode = null; | |
| var video = document.createElement('iframe'); | |
| video.setAttribute('name','jlFrame'); | |
| video.style = `display: block; | |
| width: 1900px; | |
| float: right; | |
| position: absolute; | |
| right: 0px; | |
| min-height: 100vh; | |
| top: 0px; |
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
| // Drop undesired items | |
| var removeList = ['Nespresso', 'Vertuo', 'Delonghi', 'De’Longhi', "De'longhi", 'Gevi', 'Calphalon', 'Ascaso', 'Mr ', 'Mr.', 'Krups', 'Keurig','Chefman','Conqueco', 'CBTL', 'Mattina', 'Terra', 'Smeg', 'EspressoWorks', 'Arlime', 'Bambino']; | |
| // Remove matching results (and ads) | |
| var links = Array.from(document.querySelectorAll('a')); | |
| links.filter(l => l.href.includes('bing.com') || | |
| (l.href.includes('/item/detail') && | |
| removeList.some(r => l.title.toLowerCase().includes(r.toLowerCase())))) | |
| .forEach(e => e.parentElement.removeChild(e)); |
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
| document.querySelectorAll(".screenreader-only").forEach(e => e.remove()); | |
| document.querySelectorAll('#grades_summary tr.student_assignment').forEach(r => { | |
| if (r.cells[3].innerText === r.cells[4].innerText) { | |
| r.style.display = 'none'; | |
| } | |
| }); |
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
| FOR /R %a IN (*.tif) DO magick convert "%~a" -quality 100 "%~dpna.jpg" |
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
| // As described in https://stackoverflow.com/q/26162902/84369 | |
| public ActionResult Index() | |
| { | |
| var sketches = db.Sketches.Include(p => p.Board); | |
| // Serializer settings | |
| var settings = new JsonSerializerSettings | |
| { | |
| ContractResolver = new CustomResolver(), | |
| PreserveReferencesHandling = PreserveReferencesHandling.None, |
NewerOlder