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
""" | |
Before your interview, write a program that lets two humans play a game of Tic Tac Toe | |
in a terminal. The program should let the players take turns to input their moves. The | |
program should report the outcome of the game. | |
During your interview, you will pair on adding support for a computer player to your | |
game. You can start with random moves and make the AI smarter if you have time. | |
--- |
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
function dumpTouchEvent(event: TouchEvent): string { | |
// Start with the basics | |
const result = { | |
type: event.type, | |
timeStamp: event.timeStamp, | |
isTrusted: event.isTrusted, | |
bubbles: event.bubbles, | |
cancelable: event.cancelable, | |
defaultPrevented: event.defaultPrevented, | |
eventPhase: event.eventPhase, |
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
async function getWikiImageURL(searchQuery) { | |
const PROXY = "https://cors-anywhere.herokuapp.com/"; | |
const WIKI_API_ENDPOINT = `${PROXY}https://en.wikipedia.org/w/api.php`; | |
// First fetch to get the page ID | |
let pageId; | |
try { | |
console.log("Trying request 1"); | |
const response1 = await fetch( | |
`${WIKI_API_ENDPOINT}?action=query&list=search&srsearch=${encodeURIComponent( |
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
/** | |
* An entity is just an ID. This is used to look up its associated | |
* Components. | |
*/ | |
export type Entity = number | |
/** | |
* A Component is a bundle of state. Each instance of a Component is | |
* associated with a single Entity. |
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
namespace P02 { | |
/** | |
* An entity is just an ID. This is used to look up its associated | |
* Components. | |
*/ | |
type Entity = number | |
/** |
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
type Entity = number | |
abstract class Component { } | |
abstract class System { | |
public abstract componentsRequired: Set<Function> | |
public abstract update(entities: Set<Entity>): void | |
public ecs: ECS | |
} | |
type ComponentClass<T extends Component> = new (...args: any[]) => T | |
class ComponentContainer { | |
private map = new Map<Function, Component>(); |
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
"""Compare preprocessed scruples to original titles. | |
Usage: | |
python -m sc.scripts.from_scruples | |
""" | |
import code # code.interact(local=dict(globals(), **locals())) | |
import json | |
import os | |
from typing import List, Tuple, Set, Dict, Any, Optional, NamedTuple, Iterator, Callable |
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
#!/bin/bash | |
# ______ ______ ______ ______ ______ | |
# /\ == \/\ __ \ /\ == \/\ ___\ /\ == \ | |
# \ \ _-/\ \ __ \\ \ _-/\ \ __\ \ \ __< | |
# \ \_\ \ \_\ \_\\ \_\ \ \_____\\ \_\ \_\ | |
# \/_/ \/_/\/_/ \/_/ \/_____/ \/_/ /_/ | |
# | |
# | |
# Script that turns a pdf from pixels into paper near you (well, near me). |
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://freesound.org/people/vacuumfan7072/sounds/396031/ | |
https://freesound.org/people/DSOADigital/sounds/362256/ | |
https://freesound.org/people/MichelleGrobler/sounds/410560/ | |
https://freesound.org/people/LukeSharples/sounds/209127/ | |
https://freesound.org/people/JoelAudio/sounds/135464/ | |
https://freesound.org/people/tim.kahn/sounds/140455/ | |
https://freesound.org/people/et_graham/sounds/366345/ | |
https://freesound.org/people/kristinhamby/sounds/382637/ | |
https://freesound.org/people/LiamG_SFX/sounds/334238/ | |
https://freesound.org/people/kolczok/sounds/198987/ |
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
def compress(bytes_path: str, compressed_path: str) -> None: | |
logging.info('Compressing "{}" to "{}"'.format( | |
bytes_path, compressed_path, | |
)) | |
with open(bytes_path, 'rb') as f_in: | |
with gzip.open(compressed_path, 'wb') as f_out: | |
shutil.copyfileobj(f_in, f_out) | |
logging.info('Removing "{}"'.format(bytes_path)) | |
os.remove(bytes_path) |
NewerOlder