Skip to content

Instantly share code, notes, and snippets.

@tacowan
tacowan / assistant_prompt.txt
Last active December 7, 2024 16:36
Address Deliverability Evaluation Tool Prompt
Help enhance the readability and deliverability of free-form delivery addresses. For each address provided, return a deliverability score from 0 to 1 (1 = complete and error-free; 0 = requires more information).
In your response, please:
Optimize the address by:
Converting state names to 2-letter abbreviations.
Adding missing country codes (assume "US" if none is specified).
Correcting obvious spelling errors in city names.
Identify any missing information needed for delivery (e.g., ZIP codes).
Note if multiple ZIP codes exist for the city/state pair.
[FunctionName("GeoEvent")]
public static async Task Run(
[TimerTrigger("0/5 * * * * *")] TimerInfo myTimer,
[DurableClient] IDurableEntityClient client,
[Table("simulation1", Connection = "AzureWebJobsStorage")] CloudTable cloudTable,
ILogger log,
[SignalR(HubName = "map")] IAsyncCollector<SignalRMessage> signalRMessages
)
{
await Common(client, cloudTable, signalRMessages, log, "blueroute");
[FunctionName("Counter")]
public static void Counter([EntityTrigger] IDurableEntityContext ctx)
{
int currentValue = ctx.GetState<int>();
switch (ctx.OperationName.ToLowerInvariant())
{
case "add":
int amount = ctx.GetInput<int>();
ctx.SetState(currentValue + amount);
break;
public static async Task Common(IDurableEntityClient client,
CloudTable cloudTable,
IAsyncCollector<SignalRMessage> signalRMessages,
ILogger log,
string partitionKey)
{
var entityId = new EntityId(nameof(Counter), partitionKey);
var stateResponse = await client.ReadEntityStateAsync<JValue>(entityId);
int i = 0;
if (stateResponse.EntityExists)
public class Event : TableEntity
{
public double Latitude { get; set; }
public double Longitude { get; set; }
public double SpeedKPH { get; set; }
}
@tacowan
tacowan / commonfunction.cs
Last active June 7, 2020 14:34
Simulator function definition
public static async Task Common(IDurableEntityClient client,
CloudTable cloudTable,
IAsyncCollector<SignalRMessage> signalRMessages,
ILogger log,
string partitionKey)
{
var entityId = new EntityId(nameof(Counter), partitionKey);
var stateResponse = await client.ReadEntityStateAsync<JValue>(entityId);
int i = 0;
if (stateResponse.EntityExists)