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
#include <Arduino.h> | |
#include <WiFi.h> | |
#define MYPORT_TX 18 //16 | |
#define MYPORT_RX 16 | |
#include "EspMQTTClient.h" | |
unsigned long previousMillis = 0; | |
// constants won't change: |
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
foreach (var item in Enumerable.Range(1, 100).Select(FizzBuzz)) | |
{ | |
Console.WriteLine(item); | |
} | |
static string FizzBuzz(int number) | |
{ | |
return (number % 3, number % 5) switch | |
{ | |
(0, 0) => "FizzBuzz", |
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 _null | |
{ | |
private static string[] _dividers3 = new string[] { "f", string.Empty, string.Empty }; | |
private static string[] _dividers5 = new string[] { "bu", string.Empty, string.Empty, string.Empty, string.Empty }; | |
private static string[] _results = new string[] { "", "fizz", "buzz", "fizzbuzz" }; | |
public string FizzBuzz(int i) | |
{ | |
_results[0] = i.ToString(); | |
return _results[(_dividers3[i % 3] + _dividers5[i % 5]).Length]; |
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
string[] s = new string[6]{"Fizz", "Buzz", "", "", "", ""}; | |
for (int i = 1; i <= 100; i++) | |
{ | |
string output = s[(i%3)*2] + s[(i%5)+1]; | |
Console.WriteLine(string.IsNullOrEmpty(output)? "" + i : output); | |
} |
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
//orginal line | |
Enumerable.Range(1, 100).ToList().ForEach(i => Console.WriteLine( i % 3 * i % 5 == 0 ? (i % 3 == 0 ? "Fizz" : "") + (i % 5 == 0 ? "Buzz" : "") : i.ToString())); | |
// chopped so we can see it without scrolling | |
Enumerable | |
.Range(1, 100) | |
.ToList() | |
.ForEach(i => Console.WriteLine( | |
i % 3 * i % 5 == 0 | |
? (i % 3 == 0 ? "Fizz" : "") + (i % 5 == 0 ? "Buzz" : "") | |
: i.ToString())); |
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 void FizzBuzz() | |
{ | |
const string FIZZ = "Fizz"; | |
const string BUZZ = "Buzz"; | |
const string FIZZBUZZ = "FizzBuzz"; | |
int i = 0; | |
while (i < 150) | |
{ | |
Console.WriteLine(++i); |
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 void DoFizzBuzz() | |
{ | |
for (int i = 1; i <= 100; i++) | |
{ | |
bool fizz = i % 3 == 0; | |
bool buzz = i % 5 == 0; | |
if (fizz && buzz) | |
Console.WriteLine ("FizzBuzz"); | |
else if (fizz) | |
Console.WriteLine ("Fizz"); |
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 void DoFizzBuzz() | |
{ | |
var combinations = new Tuple<int, string>[] | |
{ | |
new Tuple<int, string> (3, "Fizz"), | |
new Tuple<int, string> (5, "Buzz"), | |
}; | |
for (int i = 1; i <= 100; ++i) | |
{ |
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
[HttpPost] | |
public HttpResponseMessage UpdateElementIdManual(Parameters parameters) | |
{ | |
_logger.Debug("some useful info here"); | |
try | |
{ | |
var eletran = ctx.ElementTransactions.Where(s => s.ElementNo == parameters.ElementId).First(); | |
var dt = DateTime.Parse(eletran.DocumentPeriod + "-01"); | |
var documentPeriod = string.IsNullOrWhiteSpace(eletran.DocumentPeriodType) ? $"{dt:MMM}-{dt:yy}" : $"{dt:MMM}-{dt:yy} {eletran.DocumentPeriodType}"; |
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
[HttpPost] | |
public HttpResponseMessage UpdateSomething(Parameters parameters) | |
{ | |
_logger.Debug("some useful info here"); | |
try | |
{ | |
var response = new HttpResponseMessage(); | |
var eletran = ctx.ElementTransactions.Where(s => s.ElementNo == parameters.ElementId).First(); | |
NewerOlder