Skip to content

Instantly share code, notes, and snippets.

@catb0t
catb0t / mypy_json.pyi
Last active October 3, 2020 09:37
Strict no-Any MyPy JSON type
# modified from Original source: https://github.com/python/mypy/issues/731#issuecomment-539905783
from typing import Union, Dict, List
JSONPrimitive = Union[str, int, bool, None]
JSONType = Union[JSONPrimitive, 'JSONList', 'JSONDict']
# work around mypy#731: no recursive structural types yet
class JSONList(List[JSONType]):
pass
@Zettt
Zettt / spotifyplayback.scpt
Created May 23, 2015 08:07
Playhead forward/backward - Because Spotify has stupidly removed the possibility to skip forward and backward using keyboard shortcuts, we now have to resort to do this via AppleScript. Well, it could be harder. The script below jumps 3 seconds ahead. Bind to keyboard shortcuts such as →. You may use ⇧→ to skip 10 seconds. This is how it was in …
tell application "Spotify"
if player state is playing then
set playPos to player position + 3.0
set player position to playPos
end if
end tell