Skip to content

Instantly share code, notes, and snippets.

View mattmazzola's full-sized avatar

Matt Mazzola mattmazzola

View GitHub Profile
@mattmazzola
mattmazzola / web_omniverse_map.md
Last active September 1, 2024 19:41
Markdown test
React Omniverse
Styling
class="my_class" name="my_class"
.my_class { ... } Element.my_class { ... }
id="my_id" style_type_name_override="my_id"
my_id { ... } MyId { ... }
Layout
flexbox, flex-direction: row, gap: gap ui.VStack(spacing=gap)
flexbox, flex-direction: column, gap: gap ui.HStack(spacing=gap)
npx create-react-app@latest client --template=typescript
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
md Service
cd Service
dotnet new sln
dotnet new gitignore
dotnet new webapi -n Articles.Api
dotnet sln add Articles.Api
git add -A
git commit -m "Initial Commit"
@mattmazzola
mattmazzola / setup.ps1
Created February 20, 2022 20:28
Creating the monorepo
md dotnet-openapi-node
cd dotnet-openapi-node
git init
@mattmazzola
mattmazzola / playerOutcome.ts
Created November 23, 2020 03:53
Compute player outcome
const [playerProbability, questionProbability] = ratingSystem.getPlayerProbabilities(player.rating, question.rating)
const expectedOutcome = playerProbability > 0.5 ? 1 : 0
const playerOutcome = Math.random() < playerProbability ? 1 : 0
@mattmazzola
mattmazzola / matching.ts
Created November 23, 2020 03:51
Get question within range
const minRating = player.rating - ratingRange
const maxRating = player.rating + ratingRange
const isRatingWithinRange = (question: Question) => minRating <= question.rating && question.rating <= maxRating
const question = getRandomWhichMeetsConstraints(questions, isRatingWithinRange)
@mattmazzola
mattmazzola / createCsvFromObjects.ts
Created November 23, 2020 03:30
Create CSV from Objects
export function createCsvFromObjects<T extends Record<string, unknown>>(os: T[]): string {
if (os.length == 0) {
throw new Error(`Cannon create CSV from empty list. Given list must not be empty.`)
}
const firstResult = os[0]
const keys = Object.keys(firstResult)
const headers = keys.join(',')
const rows = os.map(result => Object.values(result).join(','))
@mattmazzola
mattmazzola / executeGames.ts
Created November 23, 2020 03:11
Execute Games
// Execute simulation
const numQuestionsPerPlayer = 100
// The maximum difference that a question's rating will be from the player's rating
// Simulates a queuing system the pairs likely candidates
const ratingRange = 250
const symmetricResults = simulateGames(symmetricRatingSystem, players, questions, numQuestionsPerPlayer, ratingRange)
const asymmetricResults = simulateGames(asymmetricRatingSystem, players2, questions2, numQuestionsPerPlayer, ratingRange)
@mattmazzola
mattmazzola / simulateGame.ts
Created November 23, 2020 03:04
Simulate Games
// For each player simulate the player answering series of questions and observe rating changes
export default function simulateGames(
ratingSystem: RatingSystem,
players: Player[],
questions: Question[],
numQuestionsPerPlayer: number,
ratingRange: number
): Result[] {
const results: Result[] = []