Skip to content

Instantly share code, notes, and snippets.

public Message Post([FromBody]Message message)
{
const string NotSupportMessage = "Sorry, I could not understand that.";
if (message.Type == "Message")
{
Command command = null;
if (Command.TryParse(message.Text, out command) == false)
{
return message.CreateReplyMessage(NotSupportMessage);
private static Message CreateReplyMessage(Message message, string text)
{
var reply = message.CreateReplyMessage(text);
reply.BotUserData = message.BotUserData;
return reply;
}
private Message HandleAddCommand(Command command, Message message)
{
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
!-::
{
SendInput —
}
return
@luuhq
luuhq / HmacDataProtector.cs
Created April 6, 2017 03:15
HmacDataProtector
using System;
using System.Security.Cryptography;
using System.Text;
using Microsoft.AspNetCore.DataProtection;
namespace Home.Web
{
internal sealed class HmacDataProtector : IDataProtector
{
private const int HmacSize = 32; // for SHA256
version: '3'
services:
web:
image: microsoft/dotnet:1.1.1-sdk
ports:
- "5000:5000"
env_file: .env
depends_on:
- db
volumes:
FROM microsoft/dotnet:1.1.1-runtime
RUN mkdir /opt/app-release
WORKDIR /opt/app-release
COPY out .
ENTRYPOINT ["dotnet", "My.Dotnet.Application.dll"]
private static IWebHost CreateWebHost()
{
var scheme = Environment.GetEnvironmentVariable("SCHEME");
if (string.IsNullOrWhiteSpace(scheme))
{
scheme = "http";
}
var port = Environment.GetEnvironmentVariable("PORT");
if (string.IsNullOrWhiteSpace(port))
type FileInfo* = object
def fib(i : Int32, ch : Channel(Int32) | Nil)
if i < 2
return i if ch.nil?
ch.send(i)
return 0
end
sub_ch = Channel(Int32).new
spawn fib(i - 1, sub_ch)
x = fib(i - 2, nil)
"use strict";
class Test_Location {
get name() {
return this._name;
}
set name(val) {
if (val === null || val === undefined) {
throw "Cannot set null or undefined value for 'name'";