Skip to content

Instantly share code, notes, and snippets.

@Wanchai
Wanchai / gist:1c4354e83f1fdb7b6d361f684a6a3228
Last active October 31, 2024 14:15
Reading through a HTTP stream with RxJs. It needs to be improved but this is a working solution to decode a stream of data.
from(
fetch('https://dev.com', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization:
'Bearer XXX',
},
body: JSON.stringify({}),
}),
@Wanchai
Wanchai / csharp.json
Last active November 29, 2022 12:03
C# snippets for Godot in Visual Studio Code
{
"Get Node Godot": {
"prefix": "getnode",
"body": [
"${1:type} ${2:varName};",
"${2:varName} = GetNode<${1:type}>(\"${3:nodeName}\");"
],
"description": "Get Node in Godot"
},
"Godot Signal": {
@Wanchai
Wanchai / trad.ts
Created October 1, 2021 14:52
Typescript quick translation system from constants
const FR = {
hi: "bijour",
};
const UK = {
hi: "hello",
};
type Trad = typeof FR;
@Wanchai
Wanchai / .gitlab-ci.yml
Created April 18, 2020 03:27
Deploy a gitlab artifact through FTP - Used here with an Angular build
variables:
HOST: ftp.myhost.com
USER: login
PASSWD: password
build:
stage: build
image: trion/ng-cli
before_script:
- npm ci
@Wanchai
Wanchai / EMailerService.cs
Last active October 18, 2022 12:14
Sending emails with .Net Core using MailKit with DKIM signature
using System;
using MailKit.Net.Smtp;
using MailKit.Security;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using MimeKit;
using MimeKit.Cryptography;
namespace MailerApi.Services
{
public void ConfigureServices(IServiceCollection services)
{
services.AddScoped<EmailerService, EmailerService>();
services.AddControllers();
}
using MailerApi.Services;
using Microsoft.AspNetCore.Mvc;
namespace MailerApi.Controllers
{
[ApiController]
[Route("[controller]")]
public class TestController : ControllerBase
{
EmailerService Mailer { get; }
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*",
"Smtp": {
using System;
using MailKit.Net.Smtp;
using MailKit.Security;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using MimeKit;
namespace MailerApi.Services
{
public class EmailerService
@Wanchai
Wanchai / .gitlab-ci.yml
Last active September 20, 2020 21:41
Deploy an app from Gitlab registry to Heroku (.Net Core example). See -> http://blog.thomasmalicet.com/2018/04/deploy-app-from-gitlabs-registry-to.html
image: docker:git
services:
- docker:dind
variables:
DOCKER_DRIVER: overlay
# You can find this on your Gitlab repo page, under "Registry"
CONTAINER_GITLAB: registry.gitlab.com/<USER OR GROUP NAME>/<REPO NAME>
# It's just a tag, use whatever you want : back, front, test, staging...
CONTAINER_TAG: latest