Skip to content

Instantly share code, notes, and snippets.

View bbrt3's full-sized avatar
🤑

Hubert Kłonowski bbrt3

🤑
View GitHub Profile
#!markdown
Records in C#
#!csharp
public class Course
{
public string Name {get; set;}
public string Author {get; set;}
@bbrt3
bbrt3 / dapper.dib
Last active November 21, 2022 22:45
#!csharp
#r "nuget:Microsoft.Extensions.Configuration"
#r "nuget:Microsoft.Extensions.Configuration.Json"
#r "nuget:Dapper"
#r "nuget:Dapper.Contrib"
#r "nuget:System.Data.SqlClient"
#r "System.IO"
#!csharp
/*
React's basic components:
a) components - they are like functions, we invoke function with some input and they give us some output,
- input: props, output: UI
- reusable and composable
- <Component />
- can manage a private state
import numpy as np
def canPlace(x2: int, y2: int) -> bool:
for x in range(x2):
if result[x] == y2 or abs(x - x2) == abs(result[x] - y2):
return False;
return True;
def placeQueens(x: int) -> np.void:
for X in range(N):
@bbrt3
bbrt3 / simpleTest.cs
Last active September 20, 2021 06:56
Selenium WebDriver
using Xunit;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
namespace DemoWebApp.Tests
{
public class LoanApplicationTests
{
[Fact]
public void StartApplication()
@bbrt3
bbrt3 / buildingBlocks.cs
Last active September 7, 2021 14:02
WCF
/*
Service Contracts are collections of operations or methods,
which take parameters and return values.
They provide interface for those methods.
Data Contracts are parameters taken by service contracts and
values that they return
Service is a class that contains implementations of those methods
that we want to be available for our client.
@bbrt3
bbrt3 / benefits.txt
Last active September 5, 2021 11:34
Webpack
Benefits of using Webpack:
a) Interactive coding - instead of writing code, compiling, waiting and reloading,
we can use Hot Module Reload (HMR) which will only reload data that has changed.
So if we only changed one element on our site, then only that one element will recompile (NO RELOADING!)
b) Seamless compilation of anything - code, styles, layout, images, fonts, etc.
c) Consistent tooling - webpack is not tied to a particular IDE and/or OS
d) Modularity - write code with benefits of small modules, ship code in bundles
Which means that we can have common dependencies that are going to be loaded
e) Sophisticated bundling - bundle per page, bundle/code splitting, minify, lazy loading bundles, remove unused code
E.g. we are a gaming company and we have three games: A, B, C
@bbrt3
bbrt3 / add.txt
Last active September 2, 2021 19:16
yarn
yarn add @angular/core
is how we would add dependency to angular/core to our project.
It will update package.json and add dependency (it always gives latest version, like npm install --save !)
yarn add protrator --dev / --peer / --optional
is how we would add dependency to protractor to dev/peer/optionalDependencies part of package.json
yarn global add @angular/cli
@bbrt3
bbrt3 / backendData.ts
Last active August 31, 2021 09:19
KnockoutJS
// View
<h3>Tasks</h3>
<form data-bind="submit: addTask">
Add task: <input data-bind="value: newTaskText" placeholder="What needs to be done?" />
<button type="submit">Add</button>
</form>
<ul data-bind="foreach: tasks, visible: tasks().length > 0">
<li>
@bbrt3
bbrt3 / abstraction.cs
Last active August 14, 2021 11:05
OOP
/*
Abstraction means to simplify reality.
Example:
Person is an object, but if we were designing application
to process data about a person, then it's unlikely
that we will be interested in everything there is to know
about a person.
Rather you would only concern yourself with the relevant data
and task that we want to perform on that data.