Skip to content

Instantly share code, notes, and snippets.

View profesor79's full-sized avatar
:octocat:
creating new.... ideas?

Grzegorz Bernas profesor79

:octocat:
creating new.... ideas?
View GitHub Profile
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FranclinMath
{
class Program
{
using System;
using System.Collections.Generic;
namespace maaaa
{
public class Item
{
public string Name { get; set; }
public double Priec { get; set; }
public int Index { get; set; }
@profesor79
profesor79 / all.cs
Last active November 1, 2017 21:17
public class Cat : Animal
{
public Cat(){
base.Sound = "miau miau";
}
}
<p style="line-height: 18px; font-size: 18px; font-family: times;">
Click "<i>Load samples</i>" to view and edit more JS samples.<br>
<br>
Labyrinth generated with JavaScript:<br><br>
<script>
var firstBusObject ={busNumber:4,stops: [{in:3, out:1},{in:3, out:1},{in:3, out:1}]};
document.write('firstBusObject <br/>');
document.write(firstBusObject.busNumber);
document.write(' <br/>');
document.write(firstBusObject.stops[2].in);
@profesor79
profesor79 / atmLinqPad.cs
Last active April 30, 2018 10:54
a dirty atm cash dispenser solution
void Main()
{
var atm = new AtmDispenser();
var value = 250;
var notes = atm.GetTheCash (value).Dump($" value: {value}");
value = 230;
notes = atm.GetTheCash (value).Dump($" value: {value}");
value = 370;
notes = atm.GetTheCash (value).Dump ($" value: {value}");
value = 260;
@profesor79
profesor79 / index.js
Created September 18, 2018 17:36
how we can dry it?
resetSelectedState() {
const geoElement = Object.assign([], this.state.states); // create new copy to avoid mutation
geoElement.forEach((a) => a.isSelected = false);
this.setState({ states: geoElement });
}
resetSelectedCountry() {
const geoElement = Object.assign([], this.state.countries); // create new copy to avoid mutation
geoElement.forEach((a) => a.isSelected = false);
this.setState({ countries: geoElement });
}
@profesor79
profesor79 / gist:17c18982fffa07b537ec2832714b1993
Created February 14, 2023 11:12
if VS switch - a total war
public class SwitchStuff
{
[Benchmark]
[Arguments("ThisIsCase1")]
[Arguments("ThisIsCase2")]
[Arguments("ThisIsCase3")]
[Arguments("ThisIsCase4")]
[Arguments("ThisIsCase5")]
public string ProcessSwitchWithString(string matchCase)
@profesor79
profesor79 / messaging.cs
Created February 19, 2023 02:45
start messaging today
void Main()
{
// we need to create a consumer class instance - or we will have no listener
new ConsumerOurDatabaseAccess();
new WarehouseOurBusinessLogicStuff();
var p = new ProducerOurWebApiEndpoint();
Console.WriteLine("Hey buddy provide order details - and don't play with me!");
while (true)
@profesor79
profesor79 / 1.cs
Last active February 21, 2023 09:55
Separate logic from implementation variant 1
public string ProcessItFor(int id) {
var a = GetFromDatabase(id)
if ((a.Length > 15 && a.Contains("11")) | (a.Length < 20 && a.Contains("2")))
{
// some code here
}
return string.Empty;
}
@profesor79
profesor79 / 2.cs
Created February 21, 2023 07:58
Separate logic from implementation variant 1
public string ProcessItFor(int id) {
var a = GetFromDatabase(id)
var johnBlogEntryCode = a.Length>15 && a.Contains("11")
var maryBlogEntryCode = a.Length<20 && a.Contains("2")
var doWeHaveOurBlogEntries = johnBlogEntryCode | maryBlogEntryCode
if(doWeHaveOurBlogEntries)
{
// some code here
}