First check the python downloads page to view the current releases
$ open https://www.python.org/downloads/
This produces the list of ALL available pyenv versions
$ pyenv install --list
...
pypy3-dev
# Q: what are all the shortest paths from a single node to all other nodes? | |
""" | |
Example: All shortest paths from id:0 to all other nodes | |
{0: [[]], | |
1: [[1]], | |
2: [[2]], | |
3: [[1, 3], [2, 3]], | |
4: [[1, 3, 4], [2, 3, 4]], | |
5: [[1, 3, 4, 5], [2, 3, 4, 5]], |
# These are SP500 prices for practicing sliding window and array problems. | |
# Q: What date was the largest adjusted close price? | |
# Q: What was the longest period of open prices between $3000.00 and $4000.00? | |
# Q: What was the longest period of increasing open prices? | |
# Q: What is the most profitable period to buy at the open and sell at the close? | |
# Q: What is the highest average close price in any 6 month consecutive window of time? | |
headers = ["Date","Open","High","Low","Close","Adj Close"] | |
data = [ |
import random | |
def is_terminal(token): | |
return token[0] != "_" | |
def expand(grammer, tokens): | |
result = [] | |
for token in tokens: | |
if is_terminal(token): | |
result.append(token) |
/* Formatting dates */ | |
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString | |
// leave locale undefined (varies according to default locale) | |
new Date().toLocaleDateString(undefined, { | |
year: "numeric", | |
month: "2-digit", | |
day: "2-digit", | |
}) | |
/* document event: keydown */ |
// answer comes from: https://stackoverflow.com/questions/32553158/detect-click-outside-react-component/54292872#54292872 | |
// this adds typescript and I've used this for a form | |
/* | |
Custom Hook | |
*/ | |
function useOuterClick(callback: any) { | |
const innerRef = useRef() as React.MutableRefObject<HTMLInputElement>; | |
const callbackRef = useRef() as React.MutableRefObject<HTMLInputElement>; |
First check the python downloads page to view the current releases
$ open https://www.python.org/downloads/
This produces the list of ALL available pyenv versions
$ pyenv install --list
...
pypy3-dev
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Open Weather API</title> | |
<style type="text/css"> | |
pre { | |
background-color: #f1f1f1; | |
padding: 5px; | |
margin: 5px; | |
border-radius: 5px; |
// This is an example of Optional Chaining | |
const adventurer = { | |
name: 'Alice', | |
cat: { | |
name: 'Dinah' | |
} | |
}; | |
const dogName = adventurer.dog?.name; | |
console.log(dogName); |
// js goes here | |
console.log("hello js") |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Hello onsubmit</title> | |
</head> | |
<body> | |
<h1>Hello onsubmit</h1> | |
<form onsubmit="handleForm()"> | |
<input type="text" name="todo" autocomplete="off"> | |
<button type="submit">Create Todo</button> |