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
let (sender, hyper_body) = hyper::Body::channel(); | |
let mut runtime = tokio::runtime::Runtime::new().unwrap(); | |
let handle = runtime.spawn(async { | |
parser::parse_and_send( | |
reader, | |
sender, | |
reference, | |
).await |
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 parse_date(string: String) -> Option<DateTime<Utc>> { | |
let year = string.get(..4).and_then(|y| y.parse::<i32>().ok()); | |
let month = string.get(4..6).and_then(|m| m.parse::<u32>().ok()); | |
let day = string.get(6..8).and_then(|d| d.parse::<u32>().ok()); | |
let hour = string.get(9..11).and_then(|h| h.parse::<u32>().ok()); | |
let minute = string.get(12..14).and_then(|mm| mm.parse::<u32>().ok()); | |
let sec = string.get(15..17).and_then(|s| s.parse::<u32>().ok()); | |
let ss = string.get(18..21).and_then(|ss| ss.parse::<u32>().ok()); | |
let r = if year.is_some() && month.is_some() && day.is_some() && hour.is_some() |
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
let mut all_suites: Vec<Suite> = Vec::new(); | |
let mut default_suite = Suite { | |
children: vec![], | |
name: "".to_string(), | |
status: "fail".to_string(), | |
}; | |
let mut current_suite: &mut Suite = &mut default_suite; | |
loop { | |
match reader.read_event(&mut buf) { |
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
import Bottleneck from "bottleneck"; | |
const redisUrl = "redis://127.0.0.1:6379"; | |
const integrations = [ | |
"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", | |
]; | |
const globalInstance1 = new Bottleneck({ | |
clearDatastore: true, | |
clientOptions: { | |
url: redisUrl, |
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
sealed trait Nat | |
sealed trait Zero extends Nat | |
sealed trait Succ[N <: Nat] extends Nat | |
case class A[N <: Nat]() | |
f1 | |
def f1[N <: Nat]: A[Succ[N]] = | |
f2 |
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
// 1: how could you rewrite the following to make it shorter? | |
if (foo) { | |
bar.doSomething(el); | |
} else { | |
bar.doSomethingElse(el); | |
} | |
// not sure I would though.. sometimes the above is more readable than the below | |
(foo) ? bar.doSomething(el) : bar.doSomethingElse(el); |