Skip to content

Instantly share code, notes, and snippets.

View peter-lyons-kehl's full-sized avatar
🏠
Working from home

Peter Lyons Kehl peter-lyons-kehl

🏠
Working from home
View GitHub Profile
@peter-lyons-kehl
peter-lyons-kehl / main.rs
Last active April 30, 2024 07:36
Rust lambdas returning a reference, stored in a function pointer
fn _f() {
use alloc::string::String;
let lambda: fn(&str) -> &str = |x| x;
let lambda = |x| -> &str { x };
// No:
#[cfg(unused)]
let lambda = |x: &str| x;
#[cfg(unused)]
@peter-lyons-kehl
peter-lyons-kehl / rust_const_generics.md
Last active March 28, 2024 15:07
Rust Const Generics

Presentation on Const Generics as of 1.50.0 stable and 1.52.0-nightly

Challenges

  • Beware no, or misleading, documentation
  • Syntax may seem arbitrary:
    • Need ::< turbofish at some places, ordinary < elsewhere.
    • Need {...} curly brackets around some const generic parameter values, not around others.
    • Some error messages feel like going in circles.
@peter-lyons-kehl
peter-lyons-kehl / 00_destructuring.md
Last active October 10, 2023 19:56 — forked from john2x/00_destructuring.md
Clojure Destructuring Tutorial and Cheat Sheet

Clojure Destructuring Tutorial and Cheat Sheet

(Related blog post)

Simply put, destructuring in Clojure is a way of extracting values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.

Vectors and Sequences

Google Apps Script Gmail Utilities

##sendAndLabel(recipient, subject, body, options, label)##

An alternative to GmailApp.sendEmail(), which applies a label to the message thread in the sender's account.

Sends an email message with optional arguments. The email can contain plain text or an HTML body. The size of the email