This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
def r_step_generator(lo, hi): | |
num = lo | |
diff = hi - lo | |
while True: | |
num += random.randint(0, diff) #Feel free to swtich for numpy.random.randint for speed boost | |
if num < hi: | |
yield num | |
else: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy.random as nprnd | |
from time import clock | |
def r_step_generator(lo, hi): | |
num = lo | |
diff = hi - lo | |
while True: | |
num += nprnd.randint(0, diff) | |
if num < hi: | |
yield num |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Error detected while processing function pymode#Option: | |
line 8: | |
E121: Undefined variable: g:pymode_syntax | |
E121: Undefined variable: g:pymode_doc | |
E121: Undefined variable: g:pymode_lint | |
E121: Undefined variable: g:pymode_rope | |
E121: Undefined variable: g:pymode_run | |
E121: Undefined variable: g:pymode_breakpoint | |
E121: Undefined variable: g:pymode_folding | |
Error detected while processing /Users/Jonathan/.spf13-vim-3/.vim/bundle/python-mode/after/ftplugin/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*globals define*/ | |
define(function(require, exports, module) { | |
'use strict'; | |
// import dependencies | |
var Engine = require('famous/core/Engine'); | |
var Surface = require('famous/core/Surface'); | |
var Scrollview = require('famous/views/Scrollview'); | |
var StateModifier = require('famous/modifiers/StateModifier'); | |
var ViewSequence = require('famous/core/ViewSequence'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var compose = function(f, g) { return function(x) { return f(g(x)); }; }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
#[deriving(Show)] | |
struct Foo { | |
a: i32 | |
} | |
let mut test:Vec<Foo> = Vec::new(); | |
test.push(Foo { a: 1 }); | |
test.push(Foo { a: 3 }); | |
test.push(Foo { a: 2 }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Works: | |
fn sum<T: Zero>(list: &Vec<T>) -> T { | |
list.iter().fold(Zero::zero(), |a: T, b| a + *b) | |
} | |
// Does not work: | |
// Gives a move error on &b saying you are trying to move out | |
// of a dereference of an &-pointer. | |
fn sum<T: Zero>(list: &Vec<T>) -> T { | |
list.iter().fold(Zero::zero(), |a: T, &b| a + b) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(phase, macro_rules)] | |
extern crate regex; | |
#[phase(plugin)] extern crate regex_macros; | |
macro_rules! matching( | |
($($a:tt),+) => ( | |
regex!(concat!("^", glob_to_regex!($($a))+, "$")) | |
); | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let isAbsoluteUri = match req.request_uri { | |
AbsolutePath(_) => true, | |
_ => false | |
}; | |
if isAbsoluteUri { | |
match req.request_uri { | |
AbsolutePath(ref mut path) => { | |
*path = path.as_slice().slice_from(self.route.len()).to_string(); | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::any::{Any, AnyRefExt, AnyMutRefExt}; | |
use std::intrinsics::TypeId; | |
use std::collections::HashMap; | |
/// A map which can contain one value of any type and is keyed by types. | |
/// | |
/// Values must implement the `Any` trait. | |
pub struct TypeMap { | |
map: HashMap<TypeId, Box<Any>> | |
} |
OlderNewer