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
from beartype import beartype | |
class MyInt(int): | |
... | |
def process_int_without(bar: int): | |
print(f"process_int_without({bar} [type={type(bar)}])") | |
def process_myint_without(bar: MyInt): | |
print(f"process_myint_without({bar} [type={type(bar)}])") |
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
export class WsClient { | |
#socket: WebSocket | |
#listeners: { | |
open: ((event: Event) => any)[] | |
close: ((event: CloseEvent) => any)[] | |
error: ((event: Event) => any)[] | |
message: ((event: MessageEvent) => any)[] | |
} = { | |
open: [], | |
close: [], |
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
export class WsClient { | |
#socket: WebSocket | |
#listeners: { | |
open: ((event: Event) => any)[] | |
close: ((event: CloseEvent) => any)[] | |
error: ((event: Event) => any)[] | |
message: ((event: MessageEvent) => any)[] | |
} = { | |
open: [], | |
close: [], |
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
#!/usr/bin/env python3.7 | |
import iterm2 | |
import asyncio | |
async def run(cmd: str) -> str: | |
process = await asyncio.create_subprocess_shell( | |
cmd, | |
stdout=asyncio.subprocess.PIPE, |
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
typeset -A custom_cd_commands | |
custom_cd_commands=(ws "~/WebstormProjects/" xc "~/XcodeProjects" py "~/PycharmProjects") | |
function custom_cd() { | |
FOLDER="$(find ${1} -name "*${2}*" -type d -maxdepth 1 | head -n 1)" | |
if [ -n "$FOLDER" ]; then | |
cd "$FOLDER" | |
fi | |
} |
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 cd() { | |
builtin cd "$@" | |
if [[ -z "$VIRTUAL_ENV" ]] ; then | |
if [[ -d ./venv ]] ; then | |
source ./venv/bin/activate | |
fi | |
else | |
parentdir="$(dirname "$VIRTUAL_ENV")" | |
if [[ "$PWD" =~ $parentdir ]] ; then |
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 recognition = new webkitSpeechRecognition(); // eslint-disable-line | |
recognition.continuous = true; | |
recognition.interimResults = true; | |
recognition.lang = 'en-US'; | |
recognition.onstop = () => { | |
console.log('Stopping recognition'); | |
}; | |
export default (resetCallback, callback) => { |