Skip to content

Instantly share code, notes, and snippets.

View bstrie's full-sized avatar

bstrie bstrie

View GitHub Profile
@endolith
endolith / Has weird right-to-left characters.txt
Last active April 30, 2024 12:48
Unicode kaomoji smileys emoticons emoji
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶
@malarkey
malarkey / Contract Killer 3.md
Last active April 16, 2024 21:44
The latest version of my ‘killer contract’ for web designers and developers

When times get tough and people get nasty, you’ll need more than a killer smile. You’ll need a killer contract.

Used by 1000s of designers and developers Clarify what’s expected on both sides Helps build great relationships between you and your clients Plain and simple, no legal jargon Customisable to suit your business Used on countless web projects since 2008

…………………………

@spacejam
spacejam / rr-with-rust.md
Last active March 13, 2024 18:51
using rr with rust

using rust with rr

rr is a great debugging tool. it records a trace of a program's execution, as well as the results of any syscalls it executes, so that you can "rewind" while you debug, and get deterministic forward and reverse instrumented playback. it works with rust, but by default if you try it out, it could be pretty ugly when you inspect variables. if this bothers you, configure gdb to use a rust pretty-printer

rr is probably in your system's package manager.

usage

@nsf
nsf / clean.bash
Last active March 4, 2019 14:38
Perlin noise benchmark
#!/bin/bash
rm -rf *.o *.[568] test_*
@luser
luser / source-count
Created June 15, 2018 19:36
count of source file lines by extension for source files compiled into a macOS Firefox Nightly build
.cpp 3111001
.h 1272859
.c 1207323
.cc 303090
.rs 246356
.mm 57859
.hh 15850
.cxx 14731
.api 1854
.hxx 802

Rust RFC 2005 "Match Ergonomics" was just accepted. However there was a copy-paste error in the summary that led to some confusion about what it was actually doing. Here's a quick run down of the details that matter to users:

TL;DR version:

Before this change, matching on references works like this:

let by_ref: &MyEnum;
let by_mut: &mut MyEnum;
@Gankra
Gankra / gist:155234908dae0d984fe5
Created March 19, 2015 20:56
mutable singly-linked list
struct List<T> {
head: Option<Box<Node<T>>>
}
struct Node<T> {
elem: T,
next: Option<Box<Node<T>>>,
}
impl<T> List<T> {
anonymous
anonymous / playground.rs
Created March 23, 2016 10:10
Shared via Rust Playground
#![feature(unboxed_closures, fn_traits)]
fn get_fn_ptr<A, C: Fn<A>>(_: &C) -> extern "rust-call" fn(&(), A) -> C::Output {
let fn_ptr: extern "rust-call" fn(&(), A) -> C::Output = unsafe {
std::mem::transmute(<C as std::ops::Fn<A>>::call as usize)
};
fn_ptr
}
fn main() {
anonymous
anonymous / playground.rs
Created March 23, 2016 09:56
Shared via Rust Playground
#![feature(unboxed_closures, fn_traits)]
fn get_fn_ptr<C: Fn() -> ()>(_: &C) -> extern "rust-call" fn(&(), ()) -> () {
let fn_ptr: extern "rust-call" fn(&(), ()) -> () = unsafe { std::mem::transmute(<C as std::ops::Fn<()>>::call as usize) };
fn_ptr
}
fn main() {
let closure = ||{ println!("hi") };
let ptr = get_fn_ptr(&closure);