Skip to content

Instantly share code, notes, and snippets.

View beeb's full-sized avatar
🦀
Rust Evangelist

Valentin B. beeb

🦀
Rust Evangelist
View GitHub Profile
@beeb
beeb / ci.yml
Last active December 14, 2023 13:09
Generate slither warnings in GitHub Actions instead of erroring
name: CI
on:
pull_request:
jobs:
run-slither:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
@beeb
beeb / build.rs
Created November 4, 2023 13:06
Build script to initialize dev db in sqlx project
use std::str::FromStr;
use sqlx::{
sqlite::{SqliteConnectOptions, SqliteJournalMode},
SqlitePool,
};
use tokio::runtime::Builder;
fn main() {
let database_url = std::env::var("DATABASE_URL").unwrap_or("sqlite://dev.db".to_string());
@beeb
beeb / nomenclature.typ
Created June 19, 2023 13:06
Product nomenclature template for Typst
#let segments = (
(nomenclature: "4", title: "Refrigerant Type", description: [4 = R-410A \ 2 = R22], separator: ""),
(nomenclature: "TE", title: "Application", description: [TE = Fully Convertible \ TG = Semi Convertible], separator: "-"),
(nomenclature: "E", title: "Product Family", description: [E = Leadership -- Variable Speed \ P = Leadership], separator: "-"),
)
#let nomenclature(
segments: ((nomenclature: "A", title: "Foo", description: [Bar], separator: "-"))
) = {
place(top + left, [#box()#label("margins")]) // get top + left margins dynamically
@beeb
beeb / catppuccin_mocha.postcss
Created May 9, 2023 12:32
Catppuccin Mocha theme for Skeleton UI
/*
https://www.skeleton.dev
https://github.com/catppuccin/catppuccin
*/
:root {
/* =~= Theme Properties =~= */
--theme-font-family-base: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
'Noto Color Emoji';
--theme-font-family-heading: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
@beeb
beeb / prelude.rs
Created February 14, 2023 16:49
Substring
use std::ops::{Bound, RangeBounds};
/// Utilities to take a substring of a string slice, taking into account UTF-8.
pub trait StringUtils {
/// Get a substring of a string slice, with start and length.
fn substring(&self, start: usize, len: usize) -> &str;
/// Get a substring of a string slice, with a range.
fn slice(&self, range: impl RangeBounds<usize>) -> &str;
}