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
@erlend-sh
erlend-sh / fundamentals-of-netizenship.md
Last active May 12, 2024 14:09
Fundamentals of Netizenship (draft)

Fundamentals of Netizenship

Internetting from first principles; what is required to participate as an autonomous citizen of the World Wide Web.

web-fundamentals

Read the web (browser-agent)

Look at stuff on the web; read.

@kyren
kyren / freeze.rs
Created October 17, 2023 00:59
Freeze
use std::{cell::RefCell, marker::PhantomData, mem, rc::Rc};
use thiserror::Error;
#[derive(Debug, Copy, Clone, Eq, PartialEq, Error)]
pub enum AccessError {
#[error("frozen value accessed outside of enclosing scope")]
Expired,
#[error("already borrowed incompatibly")]
BadBorrow,
@ItsDoot
ItsDoot / _description.md
Last active January 7, 2024 00:17
Bevy + egui in a text-based, turn-based adventure game.

Bevy + egui in a text-based, turn-based adventure game.

I won't go too far into the nitty details (lol), but this is generally how I've structured my WIP mostly-text-based, turn-based adventure game. I emphasize that because I suspect this approach doesn't work all that well for other styles of games. Specifically, because practically everything in my game happens on-click; there's very little running in the background.

TL;DR?

Nah, I strained my eyes for this.

@VictorTaelin
VictorTaelin / implementing_fft.md
Last active June 19, 2024 15:48
Implementing complex numbers and FFT with just datatypes (no floats)

Implementing complex numbers and FFT with just datatypes (no floats)

In this article, I'll explain why implementing numbers with just algebraic datatypes is desirable. I'll then talk about common implementations of FFT (Fast Fourier Transform) and why they hide inherent inefficiencies. I'll then show how to implement integers and complex numbers with just algebraic datatypes, in a way that is extremely simple and elegant. I'll conclude by deriving a pure functional implementation of complex FFT with just datatypes, no floats.

@erlend-sh
erlend-sh / legendofworlds2.md
Created February 25, 2023 10:11
Dev Log 2 - Core Engine

Legend of Worlds

⚔️ Salutations fellow legends! ⚔️

Wow! Time has passed quickly since our last blog post, however, much progress has been made! Today, we're going to go over the technical aspects of the core engine for Legend of Worlds and what has been accomplished so far. The core of the engine has been completed, and now we are at the point where we can focus on gameplay and world creation logic!

Legend of Worlds is a cross-platform, cross-play, 2D online sandbox multiplayer experience where you can join, play, create and share player created worlds. This blog post covers the open-source game engine I've created in order to build this game.

The Problem

In the last post, we discussed the benefits of Rust and WebAssembly in our game engine architecture. Rust gave us many benefits, but one issue it gave us was long compile times, depending on the more code and libraries we jammed into one module. This was getting to be a problem, as a Rust project starts off on my machine as a few seconds to compile

@vi
vi / interesting_crates.md
Last active April 27, 2024 22:00
List of crates that improves or experiments with Rust, but may be hard to find

Let's list here crates that enhance Rust as a language.

It not "batteries" like in stdx, but Rust-specific crates for workarounds for various missing features and experimental ideals from non-accepted/postponed RFCs, or just hacky tricks.

The list is supposed to contain (mostly) crates that are internal to Rust, not ones for making Rust deal with "external world" like other languages bindings, file formats, protocols and so on.

Primary focus should be on crates that are not easy to find by conventional means (e.g. no algorithm name, format or protocol to search for).

Note that quality of the listed crates may vary from proof-of-concept to stable-and-widely-used.

@kvverti
kvverti / monads.md
Last active October 15, 2023 23:57
What the heck are monads anyway?

What the Heck is a Monad, Anyway?

Querying one's favorite search engine with the text "a monad is" yields this answer on StackOverflow, which explains, in excruciating mathematical symbology, what a monad in fact is. But, don't worry. Understanding monads doesn't require you to learn the nuances of such concepts as moirails and eigenfunctors. I would suggest that the concept of monads can be distilled into a clearer single sentence.

A monad is a control abstraction that defines a composition of effectful functions.

Let's unpack.

@zicklag
zicklag / lib.rs
Last active October 13, 2020 18:41
Starter main.rs and lib.rs files for Rust applications
use thiserror::Error;
use tracing as trc;
/// An error that indicates that the program should exit with the given code
#[derive(Error, Debug)]
#[error("Program exited {0}")]
struct Exit(i32);
fn run() {
// Install tracing for logs
Entity [
MyComponent,
Scale { x: 2.0, y: 2.0, z: 2.0 },
PropDemo {
value: "hello",
sequence: [0,1,2],
map: {field: 1.0, hello: "hi"},
nested: {field: [{test: 1.0}]}
},
// Children entities are nested

Modeling timeseries data in Dgraph with timestamp on value object

Problem is, you will likely want to query by TimeStamp and need to index the TimeStamp in your schema. However when sending tons of mutations adding new values with high frequency the index keeps rebuilding and all attempts querying the timeseries data will either timeout or fail saying something like “try again later”. Recording a few values per minute should work fine, but for anything more aggressive run more tests before building a whole product relying on it. This approach puts timestamps on the node. An alternative approach is to put the timestamps on a facet, see below.

Schema

Name: string @index(fulltext, term, trigram) .
Value: uid @reverse .