Skip to content

Instantly share code, notes, and snippets.

View christopheranderson's full-sized avatar
🪐
Making the Cosmos (DB) better

Christopher Anderson christopheranderson

🪐
Making the Cosmos (DB) better
View GitHub Profile
@christopheranderson
christopheranderson / upgrade.md
Created October 29, 2026 22:24
Upgrade Semantic Model connector and add local dev support

I want to access my semantic models outside of the Fabric shell, but we need to make some changes first:

  1. Upgrade my Rayfin and fabric-apps packages to latest. Confirm you’re on at least 1.36.2 by running “npx rayfin —version”.
  2. Update the agent files with “npx rayfin init ai-files create”. You may need to restart the rayfin-mcp server and reload any skills related to rayfin after this to get the latest.
  3. Update my “dev” script in my package.json to use “rayfin dev”.
  4. Update my vite.config.json to use the @microsoft/rayfin-local-dev vite plugin. You may need to install it first.
  5. Install the @microsoft/rayfin-connectors packages and the related semantic model package
  6. Update my semantic model calls in my app to use the new rayfin-connectors library.
  7. Remove any logic I have that requires the app to run run in embed only mode
  8. Start the rayfin dev server, if you haven’t already, so I can develop locally. Make sure you start it detached so it doesn’t block the session.
@christopheranderson
christopheranderson / edge_utils.zsh
Created March 23, 2026 10:00
Command line helper for Microsoft edge on MacOS
function edge_print_profiles() {
local profiles_paths
local __path
local delim
local suffix
local actual_profile_name email
local counter=0
local doCount=0
if [[ -z $1 ]]; then
delim=""
@christopheranderson
christopheranderson / Program.cs
Last active December 29, 2025 19:28 — forked from alaye-ms/Program.cs
Using a different image for Aspire CosmosDB emulator
var builder = DistributedApplication.CreateBuilder(args);
var database = builder.AddAzureCosmosDB("cosmos").AddDatabase("iotdb")
//.RunAsEmulator()
.WithEndpoint(name: "emulator", targetPort: 8080)
.WithAnnotation(new ContainerImageAnnotation
{
Registry = "<registry name>",
Image = "<image name>",
Tag = "<tag>"
@christopheranderson
christopheranderson / upsert-test.js
Created October 9, 2019 23:21
Test using upsert with condition on non-existing always succeeds
//@ts-check
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = "0";
const { CosmosClient } = require("@azure/cosmos");
const client = new CosmosClient({
endpoint: "https://localhost:8081",
key:
"C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw=="
});
@christopheranderson
christopheranderson / index.js
Created March 14, 2019 18:38
ChangeFeed hasMoreResults issue
//@ts-check
const cosmos = require("@azure/cosmos");
const {items} = require("./sampleItems");
process.env.NODE_TLS_REJECT_UNAUTHORIZED = 0;
const {CosmosClient} = cosmos;
const endpoint = process.env.COSMOS_ENDPOINT;
const key = process.env.COSMOS_KEY;
@christopheranderson
christopheranderson / index.ts
Created August 28, 2018 02:10
create-hmac typescript default import
import createHmac from "create-hmac";
const hmac = createHmac("sha256", "hello world").update("I love cupcakes").digest("hex");
console.log(hmac);
@christopheranderson
christopheranderson / body.json
Created January 9, 2018 23:27
Example context object for Azure Functions
{
"invocationId": "a3ea24b8-d262-41d0-a57b-f6a207ade9c2",
"executionContext": {
"invocationId": "a3ea24b8-d262-41d0-a57b-f6a207ade9c2",
"functionName": "hello",
"functionDirectory": "C:\\workspace\\temp\\contextjs\\hello"
},
"log": "[FUNCTION]",
"bindingData": {
"invocationId": "a3ea24b8-d262-41d0-a57b-f6a207ade9c2",
@christopheranderson
christopheranderson / omg.cs
Last active November 15, 2017 00:28
Why would I do this?
using System;
using System.Threading.Tasks;
using EdgeJs;
class Program
{
public static async Task Start()
{
var func = Edge.Func(@"
return function (data, callback) {
@christopheranderson
christopheranderson / run.csx
Created September 8, 2017 20:31
Factory/Singleton pattern in Azure Functions
public class StartUpWork {
private static StartUpWork _singleton;
private string initializeOnce;
public StartUpWork() {
// Do long startup tasks/create database connection pools/whatever you want to happen once
this.initializeOnce = "Woooooo!";
}
public static StartUpWork ensureStartUp() {
@christopheranderson
christopheranderson / host.json
Created May 10, 2017 00:58
Example config for App Insights pipeline
{
"logger": {
"categoryFilter": {
"defaultLevel": "Information",
"categoryLevels": {
"Host.Results": "Error",
"Function": "Error",
"Host.Aggregator": "Information"
}
},