Skip to content

Instantly share code, notes, and snippets.

View oscartbeaumont's full-sized avatar

Oscar Beaumont oscartbeaumont

View GitHub Profile
/**
* This file was auto-generated by openapi-typescript.
* Do not make direct changes to the file.
*/
export interface paths {
"/pet/{petId}/uploadImage": {
post: operations["uploadFile"];
};
"/pet": {
@oscartbeaumont
oscartbeaumont / Dockerfile
Created March 15, 2022 00:25
Prisma Client Rust Bug
FROM rust
ADD ./run.sh /run.sh
RUN chmod +x /run.sh
CMD [ "/run.sh" ]
@oscartbeaumont
oscartbeaumont / [path].ts
Last active January 17, 2022 13:07
Cloudflare Workers Serve Specific File from Function Issue
// This handler does a 301 redirect to `/test` in a loop until browser throws ERR_TOO_MANY_REDIRECTS (using wrangler@beta)
export const onRequest: PagesFunction<unknown> = async ({ request, env }) => {
// The goal of this handler is to return a static file called `test.html`.
// Parsing `/test.html` directly returns a URL parsing error as per issue https://github.com/cloudflare/wrangler2/issues/165
const assetReq = new Request("http://fakehost/test.html", {
cf: request.cf,
});
const response = await env.ASSETS.fetch(assetReq);
return new Response(response.body, response);
@oscartbeaumont
oscartbeaumont / Cargo.toml
Created December 26, 2021 01:30
Async GraphQL Field Guard on Complex Object Not Working
[package]
name = "async-graphql-example"
version = "0.1.0"
authors = ["Oscar Beaumont <[email protected]>"]
edition = "2018"
[dependencies]
async-graphql = "3.0.17"
actix-web = "4.0.0-beta.14"
async-graphql-actix-web = "3.0.17"
@oscartbeaumont
oscartbeaumont / generic.rs
Created December 24, 2021 02:45
SeaORM Custom Value
# This code does not work.
# The DeriveEntityModel panics with error `message: `"AccountId<String>"` is not a valid identifier`
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, SimpleObject)]
#[sea_orm(table_name = "tenant")]
#[graphql(name = "Tenant")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: AccountId<String>,
pub name: String,
@oscartbeaumont
oscartbeaumont / Cargo.toml
Created December 22, 2021 10:24
Async GraphQL Generic Interface Bug
[package]
name = "async-graphql-relay-example"
version = "0.1.0"
authors = ["Oscar Beaumont <[email protected]>"]
edition = "2018"
[dependencies]
async-graphql = "3.0.17"
actix-web = "4.0.0-beta.14"
async-graphql-actix-web = "3.0.17"
@oscartbeaumont
oscartbeaumont / Cargo.toml
Created December 17, 2021 17:49
SeaORM Test
[package]
name = "sea-orm-test"
version = "0.1.0"
edition = "2021"
[dependencies]
sea-orm = { version = "0.4.2", features = [ "sqlx-sqlite", "runtime-tokio-native-tls", "macros" ], default-features = false }
tokio = { version = "1", features = ["full"] }
@oscartbeaumont
oscartbeaumont / README.md
Last active September 12, 2021 04:10
A Problem

Items: A - 158mm B - 128mm C - 143mm D - 60mm E - 93mm

How many of each fit into 1500mm with only 5-10mm of wastage

a158 + b128 + c143 + d60 + e*60

hello: {{ (datasource "config").test }}
@oscartbeaumont
oscartbeaumont / Cargo.toml
Created June 13, 2021 17:27
Rust Actix Scope Middleware
[package]
name = "rust-actix-scope-middleware-bug"
version = "0.1.0"
authors = ["Oscar Beaumont <[email protected]>"]
edition = "2018"
[dependencies]
actix-web = "3.3.2"