Skip to content

Instantly share code, notes, and snippets.

View Archina's full-sized avatar

Archina Archina

View GitHub Profile
@Archina
Archina / bees.html
Created March 6, 2019 18:41
Random Visualizer
<html>
<head>
<title>Bienentherme Graphen</title>
<script src="snap.svg-min.js"></script>
<script>
const TEMP_RANGE_MAX = 90
const HUMIDITY_MAX = 100
const ACTIVITY_MAX = 50000
const dataA = Array.from(new Array(48)).map(x => ({
@Archina
Archina / playground_arc_rwlock_option.rs
Last active September 29, 2018 12:59
Rust accessing an Option within a Arc RwLock
use std::sync::{Arc, RwLock};
use std::thread;
#[derive(Debug)]
struct Object{
name: String,
}
fn main() {
extern crate futures;
extern crate tokio;
use futures::{Future, Stream};
use tokio::timer::*;
use std::time::{Duration, Instant};
fn main() {
@Archina
Archina / test_thread.rs
Created September 4, 2017 18:19
Playing around with threads in rust....
use std::sync::*;
use std::thread;
fn main() {
let mut x = 12;
let y = x; // This copies
x = 16; //
@Archina
Archina / Component.rs
Created August 24, 2017 10:27
Draft for a Entity-Component-System in Rust
use std::vec::Vec;
use std::rc::{Weak,Rc};
struct Component{
parent: Weak<Compound>,
active_site: Option< Box< ActiveSite > >,
}
impl Component{
fn update(&self){
@Archina
Archina / Stack.rs
Last active August 24, 2017 04:41
Implementing a simple Stack within Rust
use std::boxed::Box;
use std::mem;
enum CellarState<S>{
Empty,
Value (S,Box<CellarState<S>>),
}
pub struct Cellar<S>{
// The Cellar of the Automaton
@Archina
Archina / Observer.rs
Last active August 23, 2017 11:38
Attempt for an Implementation of the Observer Pattern in Rust
use std::vec::Vec;
use std::rc::{Weak,Rc};
pub trait Observer{
fn on_notify( &self ) -> ();
}
#[derive(Default)]
pub struct Subject{
observers: Vec< Weak <Observer > >,