Skip to content

Instantly share code, notes, and snippets.

View chinhvo's full-sized avatar

Chinh Vo chinhvo

  • Ho Chi Minh City
View GitHub Profile
@Configuration
@EnableWebFlux
@Slf4j
public class SimpleWebSocketHandler implements WebSocketHandler {
@Bean
public SimpleUrlHandlerMapping simpleUrlHandlerMapping() {
Map<String, WebSocketHandler> urlMap = new HashMap<>();
urlMap.put("/ws", this::handle);
@davidemunoz94
davidemunoz94 / main.tf
Last active July 24, 2026 03:04
Azure Provider block
# Set the Azure provider source and version being used
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "=3.0.0"
}
}
}
# Configure the Microsoft Azure Provider
/**
* Methods required by a custom player for `react-player`
*/
export interface Player {
load(url?: string): void;
seekTo(amount: number, type?: 'seconds' | 'fraction'): void;
getCurrentTime(): number;
getDuration(): number;
getSecondsLoaded(): number | null;
stop?(): void;
import React, { Component } from "react";
import ReactPlayer, { ReactPlayerProps } from "react-player";
import { getSDK } from "react-player/lib/utils";
import {
Player,
IkWidget,
KalturaNotificationName,
KalturaPlayerElement,
KalturaPlayerEvents,
app.MapGet("/background", (
PeriodicHostedService service) =>
{
return new PeriodicHostedServiceState(service.IsEnabled);
});
class PeriodicHostedService : BackgroundService
{
private readonly TimeSpan _period = TimeSpan.FromSeconds(5);
private readonly ILogger<PeriodicHostedService> _logger;
private readonly IServiceScopeFactory _factory;
private int _executionCount = 0;
public bool IsEnabled { get; set; }
public PeriodicHostedService(
ILogger<PeriodicHostedService> logger,
private int _executionCount = 0;
public bool IsEnabled { get; set; }
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
using PeriodicTimer timer = new PeriodicTimer(_period);
while (
!stoppingToken.IsCancellationRequested &&
await timer.WaitForNextTickAsync(stoppingToken))
{
@chinhvo
chinhvo / bootstrap-tab-panel-example.markdown
Created March 10, 2022 03:34
Bootstrap tab panel example
@shubhamnikam
shubhamnikam / GithubController.cs
Last active August 21, 2023 02:43
Named Client implementation of IHttpClientFactory
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace TestAPIGithub.Controllers
{
@shubhamnikam
shubhamnikam / Startup.cs
Created February 20, 2021 17:28
Setup HttpClient configuration in Startup.ConfigureService
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers();
//configure httpclient service
services.AddHttpClient("GithubAPI", client=>
{
//customize as per your need
client.BaseAddress = new Uri("http://api.github.com/");
client.DefaultRequestHeaders.Add("Accept", "application/vnd.github.v3+json");