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 generateSongList(songSelector){ | |
var res = []; | |
var elements = document.querySelectorAll(songSelector); | |
elements.forEach( (el) => { | |
res.push(el.getElementsByClassName('audio_row__performers')[0].textContent.trim() | |
+ " - " | |
+ el.getElementsByClassName('audio_row__title')[0].textContent.trim()); | |
}); | |
return res; |
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
import signal | |
import functools | |
async def looping_task(loop, task_num): | |
try: | |
while True: | |
print('{0}:in looping_task'.format(task_num)) | |
await asyncio.sleep(5.0, loop=loop) | |
except asyncio.CancelledError: | |
return "{0}: I was cancelled!".format(task_num) |
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
<!DOCTYPE html> | |
<meta charset='utf-8'> | |
<head> | |
<title>Cubism + Websockets</title> | |
<script language='javascript' src='d3.min.js'></script> | |
<script language='javascript' src='cubism.v1.js'></script> | |
<script language='javascript'> | |
/* I can never seem to remember: | |
Array.push() appends to the end, and returns the new length |
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
""" | |
Problem: provide two-way communication with a subprocess in Python. | |
See also: | |
- https://kevinmccarthy.org/2016/07/25/streaming-subprocess-stdin-and-stdout-with-asyncio-in-python/ | |
- http://eli.thegreenplace.net/2017/interacting-with-a-long-running-child-process-in-python/ | |
""" | |
import asyncio | |
import sys |