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
#[test] | |
fn test_undefined() { | |
use encoding_rs::WINDOWS_874; | |
let replacement = "�".as_bytes(); | |
let double_replacement = "��".as_bytes(); | |
let res = WINDOWS_874.decode(&[254]).0; | |
assert_eq!(res.as_bytes(), replacement); | |
let res = WINDOWS_874.decode(&[255]).0; | |
assert_eq!(res.as_bytes(), replacement); | |
let res = WINDOWS_874.decode(&[255, 255]).0; |
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::io; | |
mod xorshift; | |
mod password; | |
fn main() { | |
let length = loop { | |
let mut length_buffer = String::new(); | |
println!("Enter the length of wannabe password: "); |
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
(defmulti transform type) | |
(defmethod transform java.lang.Long [v] | |
(* v v)) | |
(defmethod transform clojure.lang.PersistentVector [v] | |
(map inc v)) | |
(map transform [1 2 [3 4 5]) |
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
(ns rumming.core | |
(:require [rum])) | |
(defn handle-number-input [event owner] | |
(let [text (.. event -target -value) | |
num-pattern #"-?\d*"] | |
(if (re-matches num-pattern text) | |
(reset! owner text) | |
(reset! owner @owner)))) |