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
{ "countries": [ {"name": "China", "country": "CN", "population": 1403500365, "longitude": 105.0, "latitude": 35.0}, {"name": "India", "country": "IN", "population": 1366417754, "longitude": 79.0, "latitude": 22.0}, {"name": "United States", "country": "US", "population": 331002651, "longitude": -98.0, "latitude": 38.0}, {"name": "Indonesia", "country": "ID", "population": 273523615, "longitude": 113.0, "latitude": -6.0}, {"name":"Pakistan", "country": "PK", "population": 225199937, "longitude": 70.0, "latitude": 30.0}, {"name": "Brazil", "country": "BR", "population": 213429863, "longitude": -53.0, "latitude": -10.0}, {"name": "Nigeria", "country": "NG", "population": 206139587, "longitude": 8.0, "latitude": 9.0}, {"name":"Bangladesh", "country": "BD", "population": 164689383, "longitude": 90.0, "latitude": 24.0}, {"name": "Russia", "country": "RU", "population": 145872256, "longitude": 100.0, "latitude": 60.0}, {"name": "Mexico", "country": "MX", "population": 128932753, "longitude": -102.0, "latitude": 23. |
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
[ | |
{ | |
"pattern": "h1~div:first-of-type .button[data-type=\"submit\"]:not(.disabled)", | |
"description": "Selects an element with class 'button' and data attribute 'data-type' set to 'submit', that is also not 'disabled', which is a descendant of the first element of type 'div' that comes after an 'h1' element.", | |
"elementName": "", | |
"classes": [ | |
"button" | |
], | |
"example": "\t<h1>Title</h1>\r\n\t<div>\r\n\t\t<button class=\"button\" data-type=\"submit\">Submit</button>\r\n\t</div>\r\n\t<div>\r\n\t\t<button class=\"button\" data-type=\"cancel\">Cancel</button>\r\n\t</div>\r\n\t<div>\r\n\t\t<button class=\"button\" data-type=\"submit\" disabled>Disabled</button>\r\n\t</div>", | |
"note": "" |
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
if (document.location.href.includes("dr.dk")) { | |
// Reading (bad) news can be hard. | |
// This script you should run in the console and then hover over headlines to get a new random headline. | |
// Simply copy it | |
// Open developer toolbar (press F12) | |
// In the "console" paste the script, press ENTER | |
// Enjoy! Simply hover over a headline to get a new random text :-) | |
// Try reading it seeing the photo together with the new random text | |
// THIS VERSION is for https://www.dr.dk | |
// |
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
/** | |
* A class for basic geometric calculations. | |
*/ | |
export default class Geometry { | |
static PI = 3.141592653589793; | |
static circleArea(radius) { | |
if (radius < 0) { | |
throw new Error("Radius cannot be negative"); |
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 all = Array.from(document.querySelectorAll('*')); | |
setInterval(() => { | |
all[Math.floor(Math.random()*all.length)].scrollIntoView({behavior: "smooth", block: "end", inline: "nearest"}) | |
}, 800) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
export screen2svg = (eleSvg, x, y) => { | |
const point = eleSvg.createSVGPoint(); | |
point.x = x; | |
point.y = y; | |
return point.matrixTransform(eleSvg.getScreenCTM().inverse()); | |
} |
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
var tags = Array.from(document.querySelectorAll('*')).filter(ele => !/^(a|script|iframe|title|meta|head|body|style|html|link|svg|path|g|button|img|picture|ol|ul|source|nav)$/ig.exec(ele.tagName)); | |
var temp = tags.reduce((sum, curr) => { | |
const tag = curr.tagName; | |
const len = curr.textContent.length; | |
if (sum[tag]) { | |
sum[tag].len += len; | |
sum[tag].count++; | |
} else { | |
sum[tag] = { len, count:1}; | |
} |
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
// Reading (bad) news can be hard. | |
// This script you should run in the console and then hover over headlines to get a new random headline. | |
// Simply copy it | |
// Open developer toolbar (press F12) | |
// In the "console" paste the script, press ENTER | |
// Enjoy! Simply hover over a headline to get a new random text :-) | |
// Try reading it seeing the photo together with the new random text | |
// THIS VERSION is for https://www.dr.dk | |
// | |
var HEADLINE_SELECTOR = '.dre-title-text, .dre-teaser-title__text, #dr-frontpage__top-spot #text' |
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 workLocation = { longitude: 10.21377573, latitude: 56.15343598 }; // DOKK1 | |
const currentLocation = await Location.current(); | |
const distanceToWork = calcCrow( | |
currentLocation.latitude, | |
currentLocation.longitude, | |
workLocation.latitude, | |
workLocation.longitude | |
).toFixed(1); | |
const notification = new Notification(); |
NewerOlder