Skip to content

Instantly share code, notes, and snippets.

View ImTheSquid's full-sized avatar
🌊
Roaming the sea

Jack Hogan ImTheSquid

🌊
Roaming the sea
View GitHub Profile
@ImTheSquid
ImTheSquid / lib.rs
Created March 5, 2023 16:21
Rand Derive Macro
#[derive(FromVariant)]
struct EnumVariantData {
ident: syn::Ident,
}
#[derive(FromDeriveInput)]
#[darling(supports(enum_unit), forward_attrs(allow, doc, cfg))]
struct EnumData {
ident: syn::Ident,
data: ast::Data<EnumVariantData, ()>,
@ImTheSquid
ImTheSquid / helper.rs
Created February 20, 2023 16:17
Option<chrono::DateTime<Utc>> to Option<bson::DateTime> serialization and deserialization
pub mod chrono_datetime_option_as_bson_datetime_option {
use bson::{Bson, DateTime};
use chrono::Utc;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use std::result::Result;
use serde::de::Error;
pub fn deserialize<'de, D>(deserializer: D) -> Result<Option<chrono::DateTime<Utc>>, D::Error>
where
D: Deserializer<'de>,
@ImTheSquid
ImTheSquid / DraggableStepper.swift
Last active January 9, 2022 18:24
A simple stepper with dragging support for SwiftUI
//
// DraggableStepper.swift
//
// Created by Jack Hogan on 1/9/22.
// Copyright © 2022 Jack Hogan. Licensed Under MIT License.
//
/*
MIT License
@ImTheSquid
ImTheSquid / index.js
Created June 10, 2021 20:38
ComputerCraft program to download files from a password-protected server
const express = require('express')
const app = express()
const fs = require('fs')
const path = require('path')
const port = 80
const secret = 'testing'
const safeDir = 'E:/Programming/Lua'
app.use('/luasync', (req, res) => {
if (req.headers.authorization == null) {
// MIT License
// Copyright (c) 2021 Jack Hogan
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// MIT License
// Copyright (c) 2021 Jack Hogan
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions: