Skip to content

Instantly share code, notes, and snippets.

@Shawn1224
Shawn1224 / passing-values-to-generators.js
Created August 3, 2021 16:35 — forked from ericelliott/passing-values-to-generators.js
Passing values into generators through `.next()`
function* crossBridge() {
const reply = yield 'What is your favorite color?';
console.log(reply);
if (reply !== 'yellow') return 'Wrong!'
return 'You may pass.';
}
{
const iter = crossBridge();
const q = iter.next().value; // Iterator yields question
@Shawn1224
Shawn1224 / scroll.py
Created November 28, 2019 11:13 — forked from hmldd/scroll.py
Example of Elasticsearch scrolling using Python client
# coding:utf-8
from elasticsearch import Elasticsearch
import json
# Define config
host = "127.0.0.1"
port = 9200
timeout = 1000
index = "index"