Skip to content

Instantly share code, notes, and snippets.

View willcrichton's full-sized avatar
🦀

Will Crichton willcrichton

🦀
View GitHub Profile
var videos = [{frames: [1,2,3]},{frames: [1,2,3]},{frames: [1,2,3]}]
var detectFaceBoundingBoxes = function(frame) {
return flip(.5) ? [.7] : (flip(.5) ? [.7, .8] : (flip(.5) ? [.7, .8, .9] : [.7, .8, .9, .7]))
}
var predictGender = function(boundingBox, frame) {
return flip(.7) ? .9 : .1
}
var isWolfBlitzer = function(boundingBox, frame) {
return flip(.7) ? .8 : .2
}
#![feature(proc_macro)]
extern crate proc_macro;
extern crate proc_macro2;
extern crate syn;
#[macro_use]
extern crate quote;
use proc_macro2::{Span};
let mut tmp = os::tmpdir();
tmp.push(Path::new("llvm_tmp"));
File::create(&tmp).write_str(gen.as_slice()).unwrap();
match Command::new(format!("llvm-as < {} | opt | llvm-dis", tmp.display())).output() {
Ok(out) => out.output.to_string(),
Err(e) => fail!("Fail? {}", e)
}
/Users/will/Code/git/gpe/src/compress.rs:72:33: 72:37 error: cannot infer an appropriate lifetime due to conflicting requirements
/Users/will/Code/git/gpe/src/compress.rs:72 let self_ref = Arc::new(self);
^~~~
/Users/will/Code/git/gpe/src/compress.rs:55:66: 91:6 note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the block at 55:65...
/Users/will/Code/git/gpe/src/compress.rs:55 fn mutate(&self, population: Vec<Encoding>) -> Vec<Encoding> {
/Users/will/Code/git/gpe/src/compress.rs:56 let mut new_population = Vec::new();
/Users/will/Code/git/gpe/src/compress.rs:57 for candidate in population.into_iter() {
/Users/will/Code/git/gpe/src/compress.rs:58 for _ in range(0, constants::MUTATIONS) {
/Users/will/Code/git/gpe/src/compress.rs:59 new_population.push(Some(candidate.clone()));
/Users/will/Code/git/gpe/src/compress.rs:60 }
MOVL %r15d,8(%rsp)
MOVQ 8(%rsp),%rax
ADDQ %rsi,%rax
MOVQ 0(%rax),%rax
[root]
name = "gpe"
version = "0.0.1"
dependencies = [
"graphics 0.0.0 (git+https://github.com/PistonDevelopers/graphics)",
"image 0.1.0 (git+https://github.com/PistonDevelopers/rust-image)",
"opengl_graphics 0.0.0 (git+https://github.com/pistondevelopers/opengl_graphics)",
"sdl2_window 0.0.0 (git+https://github.com/pistondevelopers/sdl2_window)",
]
Compiling gpe v0.0.1 (file:///Users/will/Code/git/gpe)
warning: using multiple versions of crate `image`
/Users/will/Code/git/gpe/src/main.rs:4:1: 4:20 note: used here
/Users/will/Code/git/gpe/src/main.rs:4 extern crate image;
^~~~~~~~~~~~~~~~~~~
note: crate name: image
/Users/will/Code/git/gpe/src/render.rs:5:1: 5:30 note: used here
/Users/will/Code/git/gpe/src/render.rs:5 extern crate opengl_graphics;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[package]
name = "gpe"
version = "0.0.1"
authors = ["Will Crichton <willcrichton@cmu.edu>"]
[dependencies.image]
git = "https://github.com/PistonDevelopers/rust-image"
@willcrichton
willcrichton / tree.c
Created January 14, 2013 03:45
Binary search trees (Coding for Interviews)
/*
* Question 1: The three main depth-first traversals are:
* preorder: visiting the root, then left and right subtree,
* inorder: visiting the left subtree, then root, then right subtree
* postorder: visiting the left and right subtree, then the root
*
* In implementing any of these, you just want to make sure you hit
* every node and that you don't try to visit NULL nodes
*/