Skip to content

Instantly share code, notes, and snippets.

Joshua Barretto zesterer

Block or report user

Report or block zesterer

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:911e80d35c263db55f1816868c59b43c
# Sum types with type parameters
data Maybe T =
| Some T
| None
data Pet =
| Dog
| Cat
| Hamster
View Forge std example
const std = struct {
io: struct {
print: |msg| {
__print(msg);
},
println: |msg| {
self.print(msg + "\n");
},
input: || {
__input()
View tangle-test.rs
use std::{
collections::{HashMap, VecDeque, hash_map::DefaultHasher},
hash::{Hash, Hasher, BuildHasherDefault, BuildHasher},
};
#[derive(Debug)]
pub enum Error {
NoSuchHash,
DuplicateHash,
}
View perlin.rs
fn linear_lerp(a: f32, b: f32, x: f32) -> f32 {
a + (b - a) * x
}
fn cosine_lerp(a: f32, b: f32, x: f32) -> f32 {
let x = 0.5 - (x.fract() as f32 * f32::consts::PI).cos() * 0.5;
a + (b - a) * x
}
fn perlin_ext(pos: Vec3<f32>, seed: u32, lerp: fn(f32, f32, f32) -> f32, octaves: usize, freq_factor: f32, scale_factor: f32) -> f32 {
@zesterer
zesterer / natter.rs
Created Jun 30, 2019
Natter Interpreter
View natter.rs
use std::{
sync::mpsc,
thread::{self, JoinHandle},
collections::{HashMap, HashSet},
};
// Error
#[derive(Debug)]
pub enum Error {
View gist:624d661016406378c343dd629178189d
#!/usr/bin/env bash
set -e
cweb_version=0.6.24
cweb=https://github.com/koute/cargo-web/releases/download/$cweb_version/cargo-web-x86_64-unknown-linux-gnu.gz
curl -Lo cargo-web.gz $cweb
gunzip cargo-web.gz
chmod u+x cargo-web
View web.sh
#!/usr/bin/env bash
set -e
cweb_version=0.6.24
cweb=https://github.com/koute/cargo-web/releases/download/$cweb_version/cargo-web-x86_64-unknown-linux-gnu.gz
curl -Lo cargo-web.gz $cweb
gunzip cargo-web.gz
chmod u+x cargo-web
View veloren-docs.sh
#!/usr/bin/env bash
set -e
curl https://sh.rustup.rs -sSf | sh -s - --default-toolchain nightly -y
source ~/.cargo/env
rm -rf target/
rm -f Cargo.lock
View mdbook.sh
#!/usr/bin/env bash
set -e
mdbook=https://github.com/rust-lang-nursery/mdBook/releases/download/v0.2.1/mdbook-v0.2.1-x86_64-unknown-linux-gnu.tar.gz
curl -Lo mdbook.tar.gz $mdbook
tar -xzvf mdbook.tar.gz
chmod u+x mdbook
./mdbook build
View sim.rs
use std::{
f32,
io
};
use minifb::{
Key,
WindowOptions,
Window,
};
use vek::*;
You can’t perform that action at this time.