Skip to content

Instantly share code, notes, and snippets.

View vertonghenb's full-sized avatar
💭
I may be slow to respond.

Benjamin Vertonghen vertonghenb

💭
I may be slow to respond.
  • University of Applied Sciences and Arts
  • Ghent, Belgium
  • 01:15 (UTC +02:00)
View GitHub Profile
git subtree push --prefix exercise origin gh-pages
// In the form you can multiple of these:
<MTextField Text=@Text
IsAutofocus=@IsAutofocus
IsMultiline=@IsMultiline
Lines=@Lines
Value=@Value
Placeholder=@Placeholder
Suffix=@Suffix
OnChange=@OnChange
InputType=@InputType
@vertonghenb
vertonghenb / index.js
Last active November 25, 2018 17:16
Group 8 - /addRatings/:evaluationid'
router.post('/addRatings/:evaluationid', function (req, res) {
const ids = req.body.map(x => x.competenceID);
const incomingRatings = req.body;
Rating.findAll({
where: {
competenceID: [ids]
}
}).then(ratings => {
incomingRatings.forEach(r => {
let foundRating = ratings.find(x => x.competenceID == r.competenceID);
public class Travel
{
public IList<Expense> Expenses { get; set; } = new List<Expense>();
}
public class Cost
{
public decimal Amount { get; set; }
@vertonghenb
vertonghenb / App.razor
Created October 26, 2020 22:36
Default Blazor.Fast App.Razor
<SystemProvider Theme="new ThemeProvider(ThemeType.Fast)" use-defaults>
<Router AppAssembly="@typeof(Program).Assembly">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
</Found>
<NotFound>
<LayoutView Layout="@typeof(MainLayout)">
<p>Sorry, there is nothing at this address.</p>
</LayoutView>
</NotFound>
@vertonghenb
vertonghenb / BlazorFastAdvancedValidation.razor
Last active October 27, 2020 09:43
[Blazor.Fast] Example of how to use the components with validation and databinding
@using System.ComponentModel.DataAnnotations
<EditForm Model="model" OnValidSubmit="Submit">
<DataAnnotationsValidator />
<ValidationSummary />
<p>
<TextField @bind-Value="model.Firstname">Firstname*</TextField>
</p>
<p>
<TextField @bind-Value="model.Lastname">Lastname*</TextField>
@vertonghenb
vertonghenb / controller.cs
Created October 30, 2020 16:49
Stream from Azure Blob
[Route("api/test")]
[HttpGet]
public async Task<IActionResult> Test() {
var contentType = "multipart/x-mixed-replace;boundary=myboundary";
Stream stream = await client.Value.GetStreamAsync(WebCamUrl);
var result = new FileStreamResult(stream, contentType) {
EnableRangeProcessing = true
};
return result;
}
@vertonghenb
vertonghenb / Blob Stream
Created November 9, 2020 22:58
Blob Stream Example
[HttpGet]
public async Task<IActionResult> Get()
{
BlobContainerClient container = new BlobContainerClient(_connectionString, "test");
var blockBlob = container.GetBlobClient("test.mp4");
Stream fileStream = new MemoryStream();
var contentType = "multipart/x-mixed-replace;boundary=myboundary";
await blockBlob.DownloadToAsync(fileStream);
var result = new FileStreamResult(fileStream, contentType)
{
@vertonghenb
vertonghenb / Address.cs
Created November 10, 2020 15:55
Value Object vs Entity
public class Address : ValueObject
{
public string Street { get; init; }
public string ZipCode { get; init; }
public string Municipality { get; init; }
public string AddressLine1 => $"{Street}";
public string AddressLine2 => $"{Country.Code}-{ZipCode} {Municipality}";
/// <summary>

Hot reload commando

dotnet watch run