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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<title></title> | |
<link rel="stylesheet" href="style.css" /> | |
<script data-require="jquery" data-semver="2.1.3" src="http://code.jquery.com/jquery-2.1.3.min.js"></script> | |
<script src="script.js"></script> | |
</head> |
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
package main | |
import ( | |
"golang.org/x/tour/wc" | |
"strings" | |
) | |
func WordCount(s string) map[string]int { | |
m := make(map[string]int) | |
for _,k := range strings.Fields(s) { |
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
div.container { | |
width: 100%; | |
height: 100%; | |
background-color: white; | |
color: white; | |
display: flex; | |
align-items: center; | |
justify-content: center; | |
} |
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
div.container { | |
width: 100%; | |
height: 100%; | |
background-color: white; | |
color: white; | |
display: flex; | |
align-items: center; | |
justify-content: center; | |
} |
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
// Use hacker news API as example | |
async function getData() { | |
const ids = await (await fetch('https://hacker-news.firebaseio.com/v0/topstories.json')).json() | |
const data = Promise.all( | |
ids.map(async (i) => await (await fetch(`https://hacker-news.firebaseio.com/v0/item/${i}.json?print=pretty`)).json()) | |
) | |
return data | |
} | |
getData() |
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
sum([max(*row) - min(*row) for row in [[int(i) for i in row.split('\t')] for row in data.split('\n')]]) | |
sum(sum(x/y for y in sorted(row) for x in row if x > y and not x % y) for row in [[int(i) for i in row.split('\t')] for row in data.split('\n')]) |
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
from asyncio import Future as AsyncioFuture | |
from concurrent.futures import Future as ConcurrentFuture | |
from typing import TypeAlias | |
Future: TypeAlias = AsyncioFuture | ConcurrentFuture | |
def chain_future(first_future: Future, second_future: Future, transform_result=None): | |
if first_future.done(): | |
exception = first_future.exception() |