Skip to content

Instantly share code, notes, and snippets.

@chillpert
chillpert / vim-unreal.md
Last active February 26, 2024 13:34
Debugging and autocompletion for Unreal Engine 4 and 5 projects in (Neo)vim

Debugging and autocompletion for Unreal Engine 4 and 5 projects in (Neo)Vim

+++ Updated for UE 5.1 (see bottom)

Autocompletion

For autocompletion there are two options:

  1. coc (Vim, Neovim)
  2. LSP (Neovim only)
@Kestrer
Kestrer / how-to-write-hygienic-macros.md
Created October 17, 2020 05:35
A guide on how to write hygienic Rust macros

How to Write Hygienic Rust Macros

Macro hygiene is the concept of macros that work in all contexts; they don't affect and aren't affected by anything around them. Ideally all macros would be fully hygienic, but there are lots of pitfalls and traps that make it all too easy to accidentally write unhygienic macros. This guide attempts to provide a comprehensive resource for writing the most hygienic macros.

Understanding the Module System

First, a little aside on the details of Rust's module system, and specifically paths; it is

Looking into the Future

futures-rs is the library which will hopefully become a shared foundation for everything async in Rust. However it's already become renowned for having a steep learning curve, even for experienced Rustaceans.

I think one of the best ways to get comfortable with using a library is to look at how it works internally: often API design can seem bizarre or impenetrable and it's only when you put yourself in the shoes of the library author that you can really understand why it was designed that way.

In this post I'll try to put down on "paper" my understanding of how futures work and I'll aim to do it in a visual way. I'm going to assume you're already somewhat familiar with Rust and why futures are a useful tool to have at one's disposal.

For most of this post I'll be talking about how things work today (as of September 2017). At the end I'll touch on what's being proposed next and also make a case for some of the changes I'd like to see.

If you're interested in learning more ab

@PhilipWitte
PhilipWitte / app.nim
Last active August 8, 2016 07:24
"Brim" - Nim version of maikklein's 'Breeze' ECS
import brim
# ---
type
Position = object
x, y: float
Velocity = object
anonymous
anonymous / playground.rs
Created January 24, 2016 02:30
Shared via Rust Playground
#![feature(type_macros)]
#[derive(Debug)]
struct Tuple<T, N> {
data: T,
next: N,
}
macro_rules! tuple {
($y:ty, $($x:ty),+) => {
Tuple<$y, tuple!($($x),+)>
@Stebalien
Stebalien / rust-update-docs-hook
Last active September 21, 2017 22:34
A post-commit hook to update a rust project's gh-pages.
#!/bin/bash
set -e
[[ "$(git symbolic-ref --short HEAD)" == "master" ]] || exit 0
msg() {
echo "> $@"
}
dir="$(pwd)"
tmp="$(mktemp -d)"
@staltz
staltz / introrx.md
Last active April 25, 2024 04:18
The introduction to Reactive Programming you've been missing

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns                     on recent CPU
L2 cache reference ........................... 7 ns                     14x L1 cache
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns                     20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs 4X memory