Skip to content

Instantly share code, notes, and snippets.

View gabrfarina's full-sized avatar

Gabriele Farina gabrfarina

View GitHub Profile
@gabrfarina
gabrfarina / fizz_buzz_generator.rs
Created October 26, 2017 20:33
FizzBuzzGenerator
#![feature(inclusive_range_syntax, generators, generator_trait, never_type)]
use std::ops::{Generator, GeneratorState};
fn is_div_by(n: u64, modulus: u64) -> bool {
if n % modulus == 0 {
true
} else {
false
}
@gabrfarina
gabrfarina / sorted.rs
Created October 26, 2017 19:19
sorted.rs
trait Sorted {
fn sorted(mut self) -> Self;
}
impl<T> Sorted for Vec<T> where T: Ord {
fn sorted(mut self) -> Self {
self.sort();
self
}
}
@gabrfarina
gabrfarina / beads.ipynb
Created October 26, 2014 13:38
Counting beads
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.