Skip to content

Instantly share code, notes, and snippets.

View aarroyoc's full-sized avatar

Adrián Arroyo Calle aarroyoc

View GitHub Profile
@aarroyoc
aarroyoc / gist:5102473
Created March 6, 2013 19:52
Mi first Gist
Really, my first Gist on GitHub
@aarroyoc
aarroyoc / fichero.rb
Created March 30, 2013 21:25
Ver "DivCity Snapshot 1" en YouTube
https://www.youtube.com/watch?v=AoR8p_FGgh8&feature=youtube_gdata_player Nuevo vídeo
@aarroyoc
aarroyoc / gist:6151741
Created August 4, 2013 20:07
GIT Manual
http://www-cs-students.stanford.edu/~blynn/gitmagic/intl/es/index.html
@aarroyoc
aarroyoc / bloco_loop.js
Created August 9, 2013 15:48
Bloco Loop with Physijs and FirstPersonControls
/*
* bloco_loop.js
*/
var lastTemp;
var preventLoop=0;
var leftCube;
var rightCube;
var forwardCube;
var backwardCube;
var lastControls;
#[deriving(FromPrimitive)]
enum Instruction {
INTEGER = 0x00,
STRING = 0x01,
ADD = 0x02,
SHOWINTEGER = 0x0A,
SHOWVERSION = 0x0E,
EXITVM = 0x0F
}
@aarroyoc
aarroyoc / execute.rs
Created August 27, 2014 10:01
Crea tu lenguaje de programación en Rust
fn execute(&mut self, execbyte: u8) -> () {
if self.push {
self.push(execbyte);
self.push=false;
}else{
let op: Option<Instruction> = FromPrimitive::from_u8(execbyte);
match op{
None => {
println!("Unknown instruction, skipping...");
},
@aarroyoc
aarroyoc / instruction.rs
Created August 27, 2014 10:43
instruction.rs
#[deriving(FromPrimitive)]
enum Instruction {
INTEGER = 0x00,
STRING = 0x01,
ADD = 0x02,
SHOWINTEGER = 0x0A,
SHOWVERSION = 0x0E,
EXITVM = 0x0F
}
@aarroyoc
aarroyoc / interpreter.rs
Created August 27, 2014 10:43
interpreter.rs
pub fn interpreter(&mut self,bytecode: &'static str) -> (){
for execbyte in bytecode.chars() {
self.execute(execbyte as u8);
}
}
@aarroyoc
aarroyoc / execute.rs
Created August 27, 2014 10:45
execute.rs
fn execute(&mut self, execbyte: u8) -> () {
if self.push {
self.push(execbyte);
self.push=false;
}else{
let op: Option<Instruction> = FromPrimitive::from_u8(execbyte);
match op{
None => {
println!("Unknown instruction, skipping...");
},
@aarroyoc
aarroyoc / pushAndPop.rs
Created August 27, 2014 10:46
pushAndPop.rs
fn push(&mut self, value: u8) -> (){
self.stack.push(value);
}
fn pop(&mut self) -> u8{
let a: Option<u8>=self.stack.pop();
match a{
None => {
println!("Failed to pop");
0
},