Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html>
<head>
<title>SNAKE</title>
<style>
body { background: #000; color: #0f0; font-family: monospace; text-align: center; }
canvas { border: 2px solid #0f0; background: #111; }
</style>
</head>
<body>

Migration Plan: Moving to Cloud Tasks

Overview

This document outlines a plan to migrate the current Firestore-triggered step processing to a more robust Cloud Tasks implementation. The migration will improve reliability, enable better retry mechanisms, and allow parallel processing where appropriate.

Benefits of Cloud Tasks

  1. Built-in Retry Logic: Configurable retry with exponential backoff
  2. Deduplication: Avoid duplicate processing of the same task
let instructions = `
### **AI Agent Instructions**
1. **Understand the Content:**
Use the provided content as the baseline for evaluating the learner's response. Ensure that the response aligns with the principles and safety guidelines in the content.
**Content:**
*"When working in a warehouse environment, always ensure that forklifts and pedestrians are separated by marked walkways. Forklift operators must maintain clear visibility and use warning signals when turning or reversing. Pedestrians should never assume they are seen and should make eye contact with the operator before crossing paths. A common cause of accidents is distraction, such as using mobile phones in high-traffic areas. Proper use of personal protective equipment (PPE), including high-visibility vests and steel-toe boots, is also crucial for minimizing injuries."*
2. **Understand the Question:**
// SDK USAGE
// On doument load resolve the SDK dependecy
function Initialize(onComplete) {
require(["Speech.Browser.Sdk"], function(SDK) {
onComplete(SDK);
});
}
// Setup the recongizer
function RecognizerSetup(SDK, recognitionMode, language, format, subscriptionKey) {
//what is the URL of your google spreadsheet?
var sheetURL = 'YOUR_URL_HERE';
var scoreVarName = 'userScore'; //what is the name of the score varible in Lectora?
var userVarName = 'userName'; //what is the name of the user name varible in Lectora?
var topTenVarName = 'topTenMsg'; //what is the name of the top ten message varible in Lectora?
/**** Do not edit below this line unless you are confident about your JS skills. ****/
var userScore = eval("Var"+scoreVarName).getValue(); //Get the score from the player
var userTag = eval("Var"+userVarName).getValue(); //Get the user name from the player
//what is the URL of your google spreadsheet?
var sheetURL = 'YOUR_URL_HERE';
var scoreVarName = 'userScore'; //what is the name of the score varible in Captivate?
var userVarName = 'userName'; //what is the name of the user name varible in Captivate?
var topTenVarName = 'topTenMsg'; //what is the name of the top ten message varible in Captivate?
/*
*** Do not edit below this line unless you are confident about your JS skills. ***
*/
// Usage
// 1. Save your GAS Project
//
// 2. Click: Run > setup
//
// 3. Click: Publish > Deploy as web app
// - enter Project Version Description (optional)
// - set security level and enable service ( execute as 'me' and access 'anyone, even anonymously)
//
// 4. Copy the 'Current web app URL' and paste it into the Leaderboard JavaScript file (first line)
//what is the URL of your google spreadsheet?
var sheetURL = "YOUR_URL_HERE";
var scoreVarName = "userScore"; //what is the name of the score varible in SL?
var userVarName = 'userName'; //what is the name of the user name varible in SL?
var topTenVarName = 'topTen'; //what is the name of the top ten message varible in SL?
/*
*** Do not edit below this line. ***
*/
var player = GetPlayer(); //Get the SL player