- Verify Assumptions Before Acting: always confirm ambiguous requirements with the user instead of assuming intent and proceeding silently
- Surface Confusion and Inconsistencies: when encountering unclear, contradictory, or incomplete specs, explicitly flag them and ask for clarification rather than guessing
- Prioritize Honesty Over Agreement: push back on questionable requests and defend sound technical choices instead of immediately complying with every suggestion
- Favor Simplicity Over Abstraction: write the simplest solution that meets the requirements; avoid unnecessary layers, patterns, and bloated APIs unless explicitly justified
- Clean Up After Yourself: remove dead code, unused imports, and stale comments introduced or made obsolete during your changes.
- Do Not Touch Unrelated Code: never modify, reformat, or delete comments and code that are orthogonal to the current task, even if they seem improvable
- Respect User Instructions Strictly: tre
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Threading; | |
| using System.Threading.Tasks; | |
| using Polly.Contrib.Simmy; | |
| using Polly.Contrib.Simmy.Outcomes; | |
| using Microsoft.Extensions.Diagnostics.HealthChecks; | |
| using CSharpx; | |
| sealed class ChaosHealthCheck : IHealthCheck | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Threading.Tasks; | |
| using Microsoft.AspNetCore.Http; | |
| using Microsoft.AspNetCore.Mvc; | |
| using Microsoft.Azure.WebJobs; | |
| using Microsoft.Azure.WebJobs.Extensions.Http; | |
| using Microsoft.Extensions.Logging; | |
| namespace HealthTest2 | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // based on: https://gist.github.com/FrankHu-MSFT/b6750185b19fd4ada4ba36b099985813 | |
| // can removes \r to fit in a single log line when using ILogger | |
| using System.IO; | |
| using Newtonsoft.Json; | |
| static class JsonUtil | |
| { | |
| public static string Prettify(string json, bool stripLineFeed = false) | |
| { | |
| using var stringReader = new StringReader(json); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // requires Microsoft.IdentityModel.Clients.ActiveDirectory 5.29 | |
| // Microsoft.Azure.Management.ResourceManager 3.15.1-preview | |
| using System; | |
| using System.Collections.Generic; | |
| using System.Net.Http; | |
| using System.Net.Http.Headers; | |
| using System.Threading; | |
| using System.Threading.Tasks; | |
| using Microsoft.Azure.Management.ResourceManager; | |
| using Microsoft.Azure.Management.ResourceManager.Models; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using SharpX.Extensions; | |
| static class EnumerableExtensions | |
| { | |
| public static IEnumerable<IEnumerable<T>> Partition<T, TKey>(this IEnumerable<T> source, Func<T, TKey> selector) | |
| { | |
| var result = new List<IEnumerable<T>>(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Drawing; | |
| using System.Drawing.Drawing2D; | |
| using System.Drawing.Imaging; | |
| using System.IO; | |
| public static class ImageUtil | |
| { | |
| public static Image Resize(this Image image, int width, int height) | |
| { | |
| var destRect = new Rectangle(0, 0, width, height); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // SPDX-License-Identifier: GPL-3.0 | |
| pragma solidity >=0.7.0 <0.9.0; | |
| contract BubbleSort { | |
| function sort(uint[] memory array) public pure returns (uint[] memory) { | |
| bool swapped; | |
| for (uint i = 1; i < array.length; i++) { | |
| swapped = false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using PuppeteerSharp; | |
| using SharpX.Extensions; | |
| static class PageExtensions | |
| { | |
| static string[] _desktopUserAgents = new[] | |
| { | |
| // Chrome User Agents | |
| "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.5615.138 Safari/537.36", | |
| "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.5615.138 Safari/537.36", |
OlderNewer