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
| interface Thenable<a> { | |
| then<b>(cont: (_: a) => Thenable<b>): Thenable<b>; | |
| } | |
| /* | |
| run_slow_task.then((result) => { | |
| do_something(result).then((new_result) => { | |
| do_something_else(new_result) | |
| }) | |
| }) |
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
| import itertools | |
| def primes(): | |
| def sieve(numbers): | |
| try: | |
| n = next(numbers) | |
| yield n | |
| yield from sieve(filter(lambda m: m%n!=0, numbers)) | |
| except StopIteration: |
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
| #!/usr/bin/env python3 | |
| import sys | |
| import fileinput | |
| import re | |
| if sys.argv[2] == "merge": | |
| with fileinput.input(sys.argv[1], inplace=True) as f: | |
| for line in f: | |
| if line.startswith("Merge branch"): |
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
| venv/ | |
| *.pyc |
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 itertools import count, cycle | |
| for (n, d3, d5) in zip(count(0), cycle([True, False, False]), cycle([True, False, False, False, False])): | |
| print(("Fizz" if d3 else "")+("Buzz" if d5 else "") or str(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
| # Solve: | |
| # LETA | |
| # +TALL | |
| # ===== | |
| # CACHE | |
| for a in range(10): | |
| for e in range(10): | |
| for l in range(10): | |
| for t in range(10): |
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
| *.o |
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
| # https://www.facebook.com/groups/270834543757117/?creative_provider_id=admin_can_post_branded_content¬if_id=1607539332809717¬if_t=qp_notifs_pups_notification_to_mall_dogfood_1730789509&ref=notif | |
| N = 10 | |
| for i in range(N): | |
| print("He" * i) | |
| print("Ha" * i) | |
| print("Hi" * i) |
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
| # Maximum unattacked squares | |
| def attacked_from_square(r, c): | |
| attacked = set([]) | |
| for i in range(5): | |
| attacked.add((r,i)) | |
| attacked.add((i,c)) | |
| if 0<=r+i<5 and 0<=c+i<5: | |
| attacked.add((r+i,c+i)) | |
| if 0<=r+i<5 and 0<=c-i<5: |
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
| ################ | |
| known_domains = { | |
| "hotmail.com": [], | |
| "gmail.com": [], | |
| "yahoo.com": [], | |
| "mail.ru": [], | |
| } | |
| notfound = [] | |
| ################ |