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
def fire(age, expected_death, expected_retirement, savings, income, spending, rate): | |
import matplotlib.pyplot as plt | |
age *= 10 | |
expected_death *= 10 | |
expected_retirement *= 10 | |
remaining_tenths_of_a_year = int(expected_death-age) | |
ages = [] | |
savingses = [] | |
ages.append(age/10) | |
savingses.append(savings) |
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
["ABSORB","ADMETE","AGAM","AGEN","AGNARYD","AGNE","AINA","AKSDAL","AKURUM","AKUT","ALARM","ALEX","ALG","ALKALISK","ALLAK","ALLAMÅLA","ALSARP","ALSEDA","ALSTER","ALSVIK","ALVE","ALVINE","ALÄNG","AMALIA","AMON","AMORF","ANDREA","ANDRUP","ANDY","ANEBODA","ANEMON","ANITA","ANJA","ANNAMOA","ANNARS","ANNO","ANNONS","ANORDNA","ANRIK","ANSLUTA","ANSSI","ANTIFONI","ANTIK","ANTILOP","ANTONIUS","APA","APELSKÄR","ARHOLMA","ARILD","ARRAK","ARV","ARVINN","ASKER","ASPEKT","ASPELUND","ASPUDDEN","ASPVIK","ASTER","ASTRAKAN","ATNA","ATTEST","ATTITYD","AUKRA","BAGGE","BAGIS","BALK","BALSER","BAND","BAREN","BARNSLIG","BAROMETER","BASISK","BASTANT","BATIST","BEATA","BEDDINGE","BEHANDLA","BEHÖVD","BEKVÄM","BELLINGE","BENJAMIN","BENNO","BERGSBO","BERIT","BERNHARD","BERTA","BERTBY","BERTIL","BERYLL","BERÄTTA","BERÖM","BESKÅDA","BESTÅ","BETA","BEVARA","BIBBI","BIBY","BIGARRÅ","BIGUM","BILD","BILDAD","BILLSTA","BILLY","BISSA","BITIG","BJURSTA","BJURÖN","BJÄRNUM","BJÖRKEFALL","BJÖRKEN","BJÖRKUDDEN","BJÖRNHOLMEN","BLAD","BLADET","BLADHUL |
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
GET /api/reviews/11,22,38 | |
[ | |
{ | |
"itemID": 11, | |
"number": 3, | |
"average": 4.7 | |
}, | |
{ | |
"itemID": 22, | |
"number": 8, |
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
/** | |
* Definition for singly-linked list. | |
* function ListNode(val, next) { | |
* this.val = (val===undefined ? 0 : val) | |
* this.next = (next===undefined ? null : next) | |
* } | |
*/ | |
/** | |
* @param {ListNode} head | |
* @param {number} x |
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
// ==UserScript== | |
// @name Browse the reactjs docs with arrow keys | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match https://reactjs.org/docs/* | |
// @icon https://www.google.com/s2/favicons?domain=reactjs.org | |
// @grant none | |
// ==/UserScript== |
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 parser = new DOMParser(); | |
Promise.all( | |
[...document.querySelectorAll('.mw-category-group a')] | |
.map(a => { | |
return fetch(`https://en.wikipedia.org/w/index.php?title=${a.href.split('wiki/')[1]}&action=info`) | |
.then(r => r.text()).then(bodyText => parser.parseFromString(bodyText, 'text/html')) | |
.then(doc => { | |
const title = doc.querySelector('#mw-pageinfo-display-title td ~ td').textContent; | |
const views = doc.querySelector('.mw-pvi-month').textContent; | |
return `Title: ${title} Views: ${views}`; |
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
/** | |
* @param {character[][]} grid | |
* @return {number} | |
*/ | |
var numIslands = function(grid) { | |
var visited = grid.map(array => array.map(e => false)); | |
var counter = 0; | |
var visit = function(i, j) { | |
visited[i][j] = true; |
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
/* this is the first puzzle I've ever received from pramp. | |
I admit, I didn't know how to approach the problem until after I'd slept on it. | |
Here's how the challenge works: | |
Each letter of the alphabet is encoded as a number | |
A -> 1 | |
B -> 2 | |
C -> 3 | |
... | |
Z -> 26 |
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
function getPredictions(teamAbbreviation) { | |
// run this at https://projects.fivethirtyeight.com/2021-nba-predictions/games/ | |
// teamAbbreviation can be one of the following: | |
// 'DEN' 'PHX' 'LAC' 'UTA' | |
return new Promise((resolve) => { | |
document.getElementById('js-upcoming-expander').click(); | |
const afterTimeout = () => { | |
const selector = `#upcoming-days tr[data-team="${teamAbbreviation}"]`; | |
const toFraction = (e) => Number(e.textContent.replace('%', '')) / 100; |
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
// I used this at https://www.goodreads.com/series/40650-discworld | |
console.log(['title,author,rating,ratings,reviews,date,editions', ...[...document.querySelectorAll('.responsiveBook')].map((rb) => { | |
const title = rb.querySelector('.gr-h3 span[itemprop="name"]').textContent; | |
const author = rb.querySelector('span[itemprop="author"]').textContent; | |
const rating = rb.querySelector('.communityRating__starsWrapper ~ .gr-metaText').textContent; | |
const allTextContent = rb.textContent; | |
const matches = allTextContent.match(/(?<ratings>[\d,]+) Ratings[^\d\w]*((?<reviews>[\d,]+) Reviews)?[^\d\w]*(published (?<date>\d+))?[^\d\w]*((?<editions>\d+) editions)?/); | |
return { | |
title, |
OlderNewer