Skip to content

Instantly share code, notes, and snippets.

View 616b2f's full-sized avatar

Alexej Kowalew 616b2f

View GitHub Profile
@616b2f
616b2f / Dockerfile
Last active January 11, 2023 21:37
nvim in docker
FROM fedora:37
RUN dnf install -y 'dnf-command(copr)' && \
dnf copr enable -y agriffis/neovim-nightly && \
dnf install -y neovim
CMD nvim --listen 0.0.0.0:8080
@616b2f
616b2f / state.rs
Created October 13, 2021 20:58 — forked from dbrgn/state.rs
Custom Text based Diesel type for an enum
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
#[serde(rename_all="snake_case")]
pub enum State {
Pending,
Sending,
Sent,
Failed,
}
impl fmt::Display for State {
@616b2f
616b2f / StringEnumConverter.cs
Last active June 6, 2019 13:03
Generic StringEnumConverter<T> for C# version < 7.3
using System;
using System.Reflection;
using Newtonsoft.Json.Converters;
public class StringEnumConverter<TEnum> : StringEnumConverter where TEnum : struct, IConvertible
{
public override bool CanConvert(Type objectType)
{
Type t = Nullable.GetUnderlyingType(objectType) ?? objectType;
return t.IsEnum && t == typeof(TEnum);
}