This file contains 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
public class DeleteUserCommandHandlerTests | |
{ | |
private readonly AssistantsAIDbContext _context; | |
private readonly DeleteUserCommandHandler _handler; | |
public DeleteUserCommandHandlerTests() | |
{ | |
var options = new DbContextOptionsBuilder<AssistantsAIDbContext>() | |
.UseInMemoryDatabase(databaseName: "AssistantsAITest") |
This file contains 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
namespace AssistantsAI.Commands; | |
public class DeleteUserCommandHandlerTests | |
{ | |
[Fact] | |
public async Task Should_Delete_User_If_Exists_And_NotLocked() | |
{ | |
// Arrange | |
var mockContext = new Mock<MyDbContext>(); | |
var mockDbSet = new Mock<DbSet<User>>(); |
This file contains 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.Linq; | |
using Microsoft.CodeAnalysis; | |
using Microsoft.CodeAnalysis.CSharp.Syntax; | |
namespace SourceGeneratorsExample; | |
[Generator(LanguageNames.CSharp)] | |
public class SourceGeneratorWithInterceptors : IIncrementalGenerator | |
{ | |
public void Initialize(IncrementalGeneratorInitializationContext context) |
This file contains 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
// On the server side: | |
function ServerComponent(){ | |
return <div>I am a server component</div> | |
} | |
<ClientComponent> | |
<ServerComponent></ServerComponent> | |
</ClientComponent> |
This file contains 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
<asp:ScriptManager ID="ScriptManager1" runat="server" /> | |
<asp:UpdatePanel ID="UpdatePanel1" runat="server"> | |
<ContentTemplate> | |
<asp:Calendar ID="Calendar1" ShowTitle="True" OnSelectionChanged="Calendar1_SelectionChanged" | |
runat="server" /> | |
<div> Background: <br /> | |
<asp:DropDownList ID="ColorList" AutoPostBack="True" OnSelectedIndexChanged="DropDownSelection_Change" | |
runat="server"> | |
<asp:ListItem Selected="True" Value="White"> White </asp:ListItem> | |
<asp:ListItem Value="Silver"> Silver </asp:ListItem> |
This file contains 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
const [lat, long] = getCoordinates() | |
vs. | |
const [long, lat] = getCoordinates() | |
//How do you know which one is correct? Even typescript doesn't help you here. | |
// Better version with a record: | |
const {lat,long} = getCoordinates() |
This file contains 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
const memoized = new Map() | |
function compute(... args) { | |
const key = #[...args] // magic is here | |
if (memoized.has(key)) | |
{ | |
return memoized.get(key) | |
} | |
else { | |
const value = carrySlowComputation(...args) |
This file contains 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
const memoized = new Map() | |
function compute(... args) { | |
const key = JSON.stringify({...args}) | |
if (memoized.has(key)) | |
{ | |
return memoized.get(key) | |
} | |
else { | |
const value = carrySlowComputation(...args) |
This file contains 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
// [count, setCount] is a classic tuple but now without the support of a native tuple. | |
const [count, setCount] = useState(0) |
This file contains 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
const record = #{ name: "S. Holmes", age: 27 } | |
const record2 = Record.fromEntries([["age", 27], #["name", "S. Holmes"]]) // Note that any iterable of entries will work | |
const tuple = Tuple(...[1, 2, 3]) | |
const tuple2 = Tuple.from([1, 2, 3]) // Note that an iterable will work as well | |
record == #{ name: "S. Holmes", age: 27 } => true | |
tuple == #[1, 2, 3]) => true | |
// JS Compiler throws an error when using a non-primitive value |
NewerOlder