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
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Linq; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using StackExchange.Redis; | |
namespace CitySurvival.Redis | |
{ |
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
public class Program | |
{ | |
private static void Main(string[] args) | |
{ | |
var host = Host.CreateDefaultBuilder(args).Build(); | |
using var scope = host.Services.CreateScope(); | |
var logger = scope.ServiceProvider.GetRequiredService<ILogger<Program>>(); | |
var configuration = scope.ServiceProvider.GetService<IConfiguration>(); |
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
public class Program | |
{ | |
private static void Main(string[] args) | |
{ | |
var host = Host.CreateDefaultBuilder(args).Build(); | |
using var scope = host.Services.CreateScope(); | |
var logger = scope.ServiceProvider.GetRequiredService<ILogger<Program>>(); | |
var configuration = scope.ServiceProvider.GetService<IConfiguration>(); |
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
macro_rules! raindrop { | |
($func:ident, $factor:expr, $text:expr) => { | |
fn $func<'a>(n: u32) -> Option<&'a str> { | |
if n % $factor == 0 { | |
return Some($text); | |
} | |
return None; | |
} | |
}; | |
} |
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
pub fn raindrops(n: u32) -> String { | |
let mut result = String::new(); | |
if let Some(v) = is_factor_of_three(n) { | |
result.push_str(v); | |
} | |
if let Some(v) = is_factor_of_five(n) { | |
result.push_str(v); | |
} |
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 config::{Config, ConfigError, Environment, File}; | |
use serde_derive::Deserialize; | |
use std::env; | |
#[derive(Deserialize)] | |
pub struct ServerSettings { | |
pub host: String, | |
pub port: i32, | |
} |
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
SERVER.PORT=5001 |
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
[dependencies] | |
serde = "1.0.113" | |
serde_derive = "1.0.113" | |
dotenv = "0.15.0" | |
config = "0.10.1" |
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
/* | |
* Copyright 2017 Ben D'Angelo | |
* | |
* MIT License | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy of this | |
* software and associated documentation files (the "Software"), to deal in the Software | |
* without restriction, including without limitation the rights to use, copy, modify, merge, | |
* publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons | |
* to whom the Software is furnished to do so, subject to the following conditions: |
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
[ | |
{ "type": "escape", "title": "esc", "align": "left" }, | |
{ "type": "exitTouchbar", "title": "", "align": "left", "bordered": false, "width": 24, | |
"image": { | |
"base64": | |
"iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAQ6wAAEOsBUJTofAAAAVlpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KTMInWQAAHktJREFUeAG9Wwl4VdW1Xme4U+6QOSETAUIShASZJwkGFZCZKmF4aKsdbIvazzpbn890tPpsqdU+q3Z4trZWsJaKA1QroFYCAhaZhzAEApnne3OHM7x/7XtPuIlBk762G87d5+xxrX+vtfbaQxT6x4JkVausJLm8vFLatm2baaX9u+LKykoZfSmTJ0+WDh069O/qlgTzCxfOTB41orTU6rW8vFy13v8d8b+7v3ieBABrPrfoja9/YaU5a9rMP979tRszuEB |
NewerOlder