This file contains hidden or 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
// Caesar's cipher implemented in Rust | |
// Made by Xinayder with the help of folks from #rust at irc.mozilla.org | |
// | |
fn encrypt(msg: &str, shift: u32) -> String { | |
let alphabet_upper: &str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; | |
let alphabet_lower: &str = "abcdefghijklmnopqrstuvwxyz"; | |
let mut result: String = String::new(); | |
for c in msg.chars() { | |
if c.is_whitespace() { |
This file contains hidden or 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() { | |
println!("{:?}", substr("abcdef", 2, 4)); | |
} | |
fn substr(string: &str, start_index: u32, length: u32) -> String { | |
let mut result: String = String::new(); | |
let index: usize = start_index as usize; | |
let mut lusize: usize = length as usize; | |
result.push_str(&string[index..lusize+index]); |
This file contains hidden or 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
// ==UserScript== | |
// @name Auto Steam Discovery Queue | |
// @namespace RockyTV | |
// @description Go to next game queued as soon as page is done loading. | |
// @version 1.5 | |
// @include http://store.steampowered.com/explore/* | |
// @match *://store.steampowered.com/explore* | |
// @match *://store.steampowered.com//explore* | |
// @run-at document-end | |
// @grant none |
This file contains hidden or 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
trait Substring { | |
fn substr(&self, start_index: u32, length: u32) -> &str; | |
fn substring(&self, start_index: u32) -> &str; | |
} | |
impl Substring for str { | |
fn substr(&self, start_index: u32, length: u32) -> &str { | |
if length == 0 { return ""; } | |
if start_index == 0 && length == self.len() as u32 { return &self; } | |
return &self[start_index as usize .. start_index as usize + length as usize]; |