Skip to content

Instantly share code, notes, and snippets.

View zicklag's full-sized avatar
🛰️
Making awesome stuff!

Zicklag zicklag

🛰️
Making awesome stuff!
View GitHub Profile
@zicklag
zicklag / README.md
Created August 28, 2024 19:20
Custom, dumb, simple pow in the browser.

Inspired by and is somehow way worse.

@zicklag
zicklag / README.md
Last active August 19, 2024 23:15
Simple Force-directed Graph Algorithm
@zicklag
zicklag / exploding-cards.md
Created June 13, 2024 00:07 — forked from paulera/exploding-cards.md
Exploding cards: Explodding Kittens variant, with regular playing cards

Exploding cards

This is a variant of the Exploding Kittens game rules, using regular playing cards

  • 1 deck: 3 to 8 players
  • 2 decks: up to 16 players

Objective

The last survivor wins the game. If you draw a Bomb card and don't have a Disarm card, you die.

Preparing the game

{
"client_id": "openidconnect.net",
"redirect_uris": ["https://openidconnect.net/callback"],
"grant_types": ["authorization_code"]
}
@zicklag
zicklag / configureGlobalFetch.ts
Created January 13, 2024 19:35
Configuring a Global Proxy for Undici That Kind of Supports the `no_proxy` Environment Variable.
/**
* Importing this modules will configure the global undici agent, which is used to provide
* global `fetch()` support, to use an http proxy if present during development. Unfortunately
* undici doesn't come with this functionality so we implement a solution that is not fully
* correct as to the way that proxy environment variables are supposed to be parsed.
*
* This only goes into effect during development, though, and it's functional enough for that
* purpose.
*/
@zicklag
zicklag / singleton.rs
Last active November 8, 2023 16:42
Piccolo Singleton Manager
pub struct LuaSingletons {
singletons: Rc<AtomicCell<HashMap<usize, Box<dyn Any>>>>,
}
impl Default for LuaSingletons {
fn default() -> Self {
Self {
singletons: Rc::new(AtomicCell::new(HashMap::default())),
}
}
}
@zicklag
zicklag / arclock.rs
Created October 20, 2023 16:18
Arc<AtomicCell<T>> Static Lock
use std::ptr::NonNull;
use bones_framework::prelude::borrow::{AtomicBorrow, AtomicBorrowMut};
use crate::prelude::*;
/// Extension trait over [`Arc<AtomicCell>`] to allow obtaining a `'static` borrow guard.
pub trait ArcAtomicCellExt<T> {
fn lock_static(self) -> ArcRef<T>;
fn lock_static_mut(self) -> ArcRefMut<T>;
@zicklag
zicklag / freeze.rs
Last active October 19, 2023 16:42
**Probalby Not Sound:** An attempt at simplifying https://gist.github.com/kyren/9b461b880ce37a36320e77e02cdf4134
use paste::paste;
use std::{cell::RefCell, marker::PhantomData, rc::Rc};
/// Trait that allows you to determine what the type of something would be if you changed its
/// lifetime.
///
/// It is not recommended to implement this trait yourself, if not necessary.
///
/// You may use the [`impl_WithLifetime`] macro to safely implement this for types with
/// a single lifetime parameter, and it is automatically implemented for [`&T`] and [`&mut T`].
@zicklag
zicklag / readme.md
Last active April 30, 2024 17:16
Common Open Source License Obligations - NOT LEGAL ADVICE

NOT LEGAL ADVIVCE, THIS INTERPRETATION MAY BE INCORRECT


Common License Obligations

Observations of common license obligations in regards to what is necessary to account for when distributing an application built on /open-source software with various licenses.

/apache-2.0

Must give give a copy of the license.

  • This "license" is defined as "the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document."
@zicklag
zicklag / theme.css
Last active August 3, 2023 20:05
My Trilium notes theme.
:root {
--theme-style: dark;
--main-font-family: "Fira Sans";
--main-font-size: normal;
--tree-font-family: "Fira Sans";
--tree-font-size: 0.9em;
--detail-font-family: "Fira Sans";