I hereby claim:
- I am yoadsn on github.
- I am yoad (https://keybase.io/yoad) on keybase.
- I have a public key ASCVYF1k9xLsTm6Xvo9ZIP-BtdjEjatYyAdyd_qpqcUGqQo
To claim this, I am signing this object:
| max_parallel_degree = 2 | |
| check_every_secs = 1 | |
| @entrypoint | |
| async def limited_parallel_execution(input_state: dict[any, any], config: RunnableConfig): | |
| items = range(10) | |
| all_tasks = [] | |
| for item in items: | |
| t_future = process_item(item) # process_item is a @task | |
| all_tasks.append(t_future) |
| const appendUserAgent = (envelope, context) => { | |
| if (envelope.data.baseType === 'RequestData') { | |
| // headers are available on the context - but are not reported | |
| const ua = context['http.ServerRequest'].headers['user-agent']; | |
| if (ua) { | |
| // Extract the bot type (google only in that case) | |
| const botType = getGoogleBotType(ua); | |
| if (botType) { | |
| // The reporting would not include the bot type data point with the request. | |
| envelope.data.baseData.properties['bot-type'] = botType; |
| import * as appInsights from 'applicationinsights'; | |
| const avoidMongodbAdmin = (envelope, context) => { | |
| if (envelope.data.baseType === 'RemoteDependencyData') { | |
| const { type, target } = envelope.data.baseData; | |
| // Do not monitor calls to the admin DB | |
| if (type === 'mongodb' && target === 'admin') { | |
| return false; | |
| } | |
| } |
| { | |
| "name": "rankedRand", | |
| "text": { | |
| "weights": { | |
| "name": 5 | |
| } | |
| }, | |
| "functions": [ | |
| { | |
| "fieldName": "randCoord", |
| { | |
| "name": "randomRanked", | |
| "text": null, | |
| "functions": [ | |
| { | |
| "fieldName": "randCoords", | |
| "freshness": null, | |
| "interpolation": "linear", | |
| "magnitude": null, | |
| "distance": { |
| const center = { | |
| lat: 0, | |
| lng: 0 | |
| }; | |
| const angle = (Math.random() - 0.5) * 360; | |
| const distance = Math.random() * 50; | |
| const point = getPointOnRadius(center, distance, angle); |
| const R = 6371e3; // Earth radius in meters (approximated) | |
| const fromRadians = (rad) => rad / (Math.PI / 180); | |
| const toRadians = (deg) => deg * (Math.PI / 180); | |
| const getPointOnRadius = (center, radius, angle) => { | |
| const phi1 = toRadians(center.lat); | |
| const lambda1 = toRadians(center.lng); | |
| const theta = toRadians(angle); | |
| const d = radius; |
I hereby claim:
To claim this, I am signing this object:
| const tenantsConfig = [ | |
| { name: 't1', connStr: 'mongodb://...' }, | |
| { name: 't2', connStr: 'mongodb://...' } | |
| ]; | |
| let tenantConns = tenantsConfig.map(tenant => ({ | |
| ...tenant, | |
| conn: mongoose.createConnection(tenant.connStr)) | |
| }); | |
| import Prismic, { Document } from 'prismic.io'; | |
| ... | |
| let api = await Prismic.api("http://wescover-repo.prismic.io/api"); | |
| let document = await api.getByUID('homepage', 'homepage'); | |
| let asJson = JSON.stringify(document); | |
| let asObject = JSON.parse(asJson); | |
| let backToDoc = new Document( | |
| asObject.id, | |
| asObject.uid, | |
| asObject.type, |