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
public List<AShityLongClass> HandleNullValue(List<AShityLongClass> some_Results) | |
{ | |
if (some_Results[0].P1 == null) | |
some_Results[0].P1 = 0; | |
if (some_Results[0].P11 == null) | |
some_Results[0].P11 = 0; | |
if (some_Results[0].P12 == null) | |
some_Results[0].P12 = 0; | |
if (some_Results[0].P13 == null) | |
some_Results[0].P13 = 0; |
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
public AShityLongClassModel HandleNullValueWithModel(List<AShityLongClass> some_Results) | |
{ | |
var r = some_Results[0]; | |
var model = new AShityLongClassModel | |
{ | |
P1 = r.P1.HasValue ? r.P1.Value : 0, | |
P11 = r.P11.HasValue ? r.P11.Value : 0, | |
P12 = r.P12.HasValue ? r.P12.Value : 0, | |
P13 = r.P13.HasValue ? r.P13.Value : 0, | |
P14 = r.P14.HasValue ? r.P14.Value : 0, |
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
// so we can transform this crap :D | |
if (some_Results[0].P1 == null) | |
some_Results[0].P1 = 0; | |
// to something less aggressive | |
some_Results[0].P1 = some_Results[0].P1.HasValue ? some_Results[0].P1 : 0; | |
. | |
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
public AShityLongClassModel HandleNullValueWithModel(List<AShityLongClass> some_Results) | |
{ | |
var result = some_Results[0]; | |
var model = new AShityLongClassModel | |
{ | |
P1 = result.P1.HasValue ? result.P1.Value : 0, | |
P11 = result.P11.HasValue ? result.P11.Value : 0, | |
P12 = result.P12.HasValue ? result.P12.Value : 0, | |
P13 = result.P13.HasValue ? result.P13.Value : 0, | |
P14 = result.P14.HasValue ? result.P14.Value : 0, |
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
public AShityLongClassModel GetValueOrDefaultWithModel(List<AShityLongClass> some_Results) | |
{ | |
var r = some_Results[0]; | |
var model = new AShityLongClassModel | |
{ | |
P1 = r.P1.GetValueOrDefault(), | |
P11 = r.P11.GetValueOrDefault(), | |
P12 = r.P12.GetValueOrDefault(), | |
P13 = r.P13.GetValueOrDefault(), | |
P14 = r.P14.GetValueOrDefault(), |
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
public class Email | |
{ | |
static string TemplateStart = "Hi,<br/><br/> Click on below given link to Reset Your Password<br/> <a href="; | |
static string TemplateEnd = ">Click here to change your password</a><br/>"; | |
static string Template = "Hi,<br/><br/> Click on below given link to Reset Your Password<br/> <a href= __callbackUrl__>Click here to change your password</a><br/>"; | |
static string TextToBeReplaced = "__callbackUrl__"; | |
public void Was() | |
{ |
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
public static class LivelinesHelper | |
{ | |
public static string CGroupMemoryFilePath = "/sys/fs/cgroup/memory/memory.usage_in_bytes"; | |
public static string ReadinesFilePath = "/somePathThatKubeCanAccess/readiness.probe"; | |
public static bool KeepConnection = true; | |
public static int CheckIntervalMiliSecs = 5000; | |
public static int MemoryThreshold = 1024 * 1024 * 1024; // 1GB | |
public static void StartMonitoring() | |
{ |
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
using Akka.Streams.Dsl; | |
using Akka.IO; | |
using Tcp = Akka.Streams.Dsl.Tcp; | |
using Akka.Actor; | |
using Akka.Streams; | |
var Sys = ActorSystem.Create("example"); | |
IMaterializer materializer = Sys.Materializer(); | |
Source<Tcp.IncomingConnection, Task<Tcp.ServerBinding>> connections = | |
Sys.TcpStream().Bind("127.0.0.1", 8888); |
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
void Main() | |
{ | |
Connect(); | |
} | |
static void Connect() | |
{ | |
var client = new TcpClient("localhost", 8888); | |
var message = @"make it large long big and fat, so the buffer will be filled fast | |
"; |
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
public class UCanHave10YearsExperienceCounted1x10_or_10x1 | |
{ | |
public void Shit(string docNumber) | |
{ | |
int documentNumber = 0; | |
if (int.TryParse(docNumber, out documentNumber)) | |
{ |