View cargo-fmt-diff.rs
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 git2::Delta; | |
use git2::DiffOptions; | |
use git2::Repository; | |
use std::collections::BTreeMap; | |
use std::env::set_current_dir; | |
use std::process::Command; | |
fn main() { | |
let repo = Repository::open_from_env().unwrap(); | |
set_current_dir(repo.workdir().unwrap()).unwrap(); |
View amedia.java
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
/* | |
* To change this license header, choose License Headers in Project Properties. | |
* To change this template file, choose Tools | Templates | |
* and open the template in the editor. | |
*/ | |
package amedia; | |
import java.io.File; | |
import java.net.URL; |
View combinator.rs
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() { | |
fn map<F, T, A>(option: Option<T>, f: F) | |
-> Option<A> | |
where F: FnOnce(T) -> A { | |
match option { | |
None => None, | |
Some(value) => Some(f(value)), | |
} |
View Cargo.toml
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
[package] | |
authors = ["Mika Attila <radiantstatue@gmail.com>"] | |
name = "plugintest" | |
version = "0.1.0" | |
[dependencies] | |
dylib = "0.0.2" | |
[lib] | |
name = "guest" |
View main.rs
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
// from crates.io | |
//extern crate mmap; | |
//extern crate libc; | |
//mod fpga_awg; | |
//fn main() { | |
// let mut awg = fpga_awg::fpgaAwg::new(); | |
// let mut params: fpga_awg::awgParam = fpga_awg::awgParam::default(); | |
//let mut data: [i32; fpga_awg::n] = [0; fpga_awg::n]; |
View main.rs
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
// from crates.io | |
extern crate mmap; | |
extern crate libc; | |
mod fpga_awg; | |
use std::ptr; | |
use std::fs; | |
use std::io::{Write, SeekFrom, Seek}; | |
use std::os::unix::prelude::AsRawFd; |
View main.rs
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
mod simple; | |
use simple::Expr::{Number, Add, Multiply}; | |
fn main() { | |
println!("Let's compute!"); | |
let e = Add(Box::new(Add(Box::new(Number(1)), | |
Box::new(Number(1)))), | |
Box::new(Multiply(Box::new(Number(2)), |
View gist:9c022a0b320ce9ecbbeb
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
rustc-host-x86_64-unknown-linux-gnu: libgraphviz | |
src/libgraphviz/lib.rs:373:16: 373:36 error: mismatched types: | |
expected `Option<Id<'a>>`, | |
found `Result<Id<'_>, _>` | |
(expected enum `Option`, | |
found enum `Result`) | |
src/libgraphviz/lib.rs:373 return Ok(Id{ name: name }); | |
^~~~~~~~~~~~~~~~~~~~ | |
error: aborting due to previous error |
View gist:81fb9edf198aceecb2f3
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 mut result = "".into_string(); | |
let mut chars = remainder.chars(); | |
while let Some(c) = chars.next() { | |
if c == '-' { | |
match chars.next() { | |
Some(c @ 'a'...'z') => { | |
result.push(c.to_uppercase()); | |
} | |
Some(c) => { | |
result.push('-'); |
View rollout.rs
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(macro_rules)] | |
extern crate curl; | |
extern crate libc; | |
extern crate serialize; | |
use std::io::process::{Command, InheritFd}; | |
use std::io::{stdio, File, BufReader}; | |
use std::os; |
NewerOlder