Skip to content

Instantly share code, notes, and snippets.

View ppaska's full-sized avatar

Pavlo Paska ppaska

View GitHub Profile
@ppaska
ppaska / sequential_vs_parallel_call.py
Created October 12, 2022 17:37
Make a Sequential vs. Parallel API Calls in JSPython
from 'rxjs' import forkJoin, lastValueFrom, map
ids = [2, 7, 4, 9, 5]
async def run_Sequential():
data = []
for requestId in ids:
response = httpGet("https://jsonplaceholder.typicode.com/posts/" + requestId)
data.push({requestId, response})
@ppaska
ppaska / parallel_http_calls.py
Last active October 12, 2022 17:33
How To Make a Parallel Http call in JSPython
from 'rxjs' import forkJoin, lastValueFrom, map
ids = [2, 7, 4, 9, 5]
httpRequests$ = ids
.map(
requestId => httpRequest$("GET", "https://jsonplaceholder.typicode.com/posts/" + requestId)
.pipe(
map(r => {requestId, response: r.data})
)
@ppaska
ppaska / av_raw_data.json
Last active April 9, 2022 12:33
Importing Stock Data into the SQL database
{
"Meta Data": {
"1. Information": "Daily Prices (open, high, low, close) and Volumes",
"2. Symbol": "IBM",
"3. Last Refreshed": "2022-04-08",
"4. Output Size": "Compact",
"5. Time Zone": "US/Eastern"
},
"Time Series (Daily)": {
"2022-04-08": {
export const uniqueId = Date.now().toString(36) + Math.random().toString(36).substring(2);
@ppaska
ppaska / sample1.py
Created December 14, 2019 15:31
JS Python sample gist
arr = [4, 9, 16]
def sqrt(a):
return Math.sqrt(a)
# use Array.map() with Python function
roots = arr.map(sqrt).join(",")
# use Array.map() or use arrow function
roots = arr.map(i => Math.sqrt(i)).join(",")