Skip to content

Instantly share code, notes, and snippets.

@saosebastiao
saosebastiao / demo_analysis.R
Created May 7, 2019 19:19
This is a sample model used to model the predicted highs and lows within a specified window of time, based on analytic transformations of past data. It includes a few diagnostic visualizations.
library(compiler)
enableJIT(3)
# proprietary analytic functions
source("functions.R")
# database helper functions
source("database.R")
library(DSTrading)
library(ggplot2)
library(tidyverse)
library(lubridate)
use std::io::timer;
use std::time::Duration;
use std::sync::Future;
trait Constraint {
fn is_satisfied(&self) -> bool;
}
#[deriving(Send)]
struct Foo {
name: &'static str,
@saosebastiao
saosebastiao / gist:67dcf4ea695338270936
Created September 24, 2014 18:22
How would I parallelize this?
use std::io::timer;
use std::time::Duration;
use std::sync::Future;
trait Constraint {
fn is_satisfied(&self) -> bool;
}
#[deriving(Send)]
struct Foo { name: &'static str, a: bool, b: bool }
#[deriving(Send)]
fn member<T>(elem: T, vec: ~[T]) -> bool {
for vec.iter().advance |vec_elem| {
if elem == *vec_elem { return true; }
}
return false;
}