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(test)] | |
extern crate test; | |
extern crate brainfuck; | |
extern crate bf; | |
use test::Bencher; | |
const HELLO_WORLD: &'static str = "++++++++++[>+++++++>++++++++++>+++>+<<<<-] | |
>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>."; |
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
# NOTE: This is a WIP, please pardon our dust. | |
# | |
# Example: | |
# | |
# git --namespace=foobar clone https://github.com/nixpulvis/seali | |
# #<Git @args=[], @flags={namespace: "foobar"}, @sub=#<Clone @args=["https://github.com/nixpulvis/seali"], @flags=[], @sub=nil>> | |
class Seali | |
class << self | |
attr_accessor :subs |
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
# Simple helper function for retrying a first or create when two happen | |
# at the same time and one violates the database unique index constraint. | |
def first_or_create(scope, attributes = {}) | |
begin | |
scope.first_or_create(attributes) | |
rescue ActiveRecord::RecordNotUnique | |
retry | |
end | |
end |
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
#[macro_export] | |
macro_rules! debug_expr { | |
($expr:expr) => {{ | |
let value = $expr; | |
debug!("`{}` = {:?}", stringify!($expr), value); | |
value | |
}}; | |
} |
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::ops::Deref; | |
use serde::{Serialize, Serializer, Deserialize, Deserializer, Error}; | |
use serde_json::value::Value; | |
use super::*; | |
/// An integer. | |
/// | |
/// This should ideally work for all sized integers, but currently does not. | |
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)] | |
pub struct Integer(pub i64); |
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
//! ```cargo | |
//! [dependencies] | |
//! serde = { git = "https://github.com/nixpulvis/serde.git" } | |
//! serde_json = { git = "https://github.com/nixpulvis/json.git" } | |
//! ``` | |
extern crate serde; | |
extern crate serde_json as json; | |
use serde::de; |
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
// NOTE: | |
// | |
// Matthias's code below and inline. | |
// | |
// (define (<-card c1 c2) | |
// (match-define (card f1 t1) c1) | |
// (match-define (card f2 t2) c2) | |
// (or (<-trait t1 t2) (and (equal? t1 t2) (< f1 f2)))) | |
// (define (<-card c1 c2) |
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
impl Node { | |
fn new(state: State) -> Node { | |
Rc::new(RefCell::new(state)) | |
} | |
fn then(self, state: State) { | |
let arrow = Arrow::Then(self.clone()); | |
state.arrows.push(arrow); | |
Node::new(state) | |
} |
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(plugin_registrar, rustc_private)] | |
extern crate syntax; | |
extern crate rustc; | |
extern crate rustc_plugin; | |
extern crate itertools; | |
extern crate serde; | |
extern crate serde_json; | |
use syntax::codemap::Span; |
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
#[derive(Debug)] | |
struct Recur(u32); | |
impl Recur { | |
pub fn call(n: u32) -> u32 { | |
let r = Recur(n); | |
let r = r.recur(); | |
r.0 | |
} | |