Skip to content

Instantly share code, notes, and snippets.

@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
@Wanchai
Wanchai / TEST_WEBSITE.bat
Created September 5, 2016 15:35
Test ASP.NET website locally without Visual Studio
SET IISRoot="%ProgramFiles(x86)%\IIS Express\"
// You have to put this file in your project directory
%IISRoot%iisexpress.exe /path:%CD% /port:9090
// Go to http://localhost:9090 to see the result