Skip to content

Instantly share code, notes, and snippets.

View Stamo-Gochev's full-sized avatar

Stamo Gochev Stamo-Gochev

View GitHub Profile
@Stamo-Gochev
Stamo-Gochev / cloudSettings
Last active January 20, 2022 08:06
Visual Studio Code Settings Sync Gist
{"lastUpload":"2022-01-20T08:06:10.390Z","extensionVersion":"v3.2.7"}
window.addEventListener("DOMContentLoaded",wof);
function wof() {
var arrow = document.querySelector(".arrow"),
arrowAngle = 0,
wheelAngle = 0,
snapAngle = 360/24/3,
getAngle = function(ele) {
let el = document.querySelector(ele),
elTr = el.style.transform,
// break down matrix value of transform and get angle
@Stamo-Gochev
Stamo-Gochev / gist:c3cf4a71b7876a071f584650b522752a
Created July 20, 2019 13:40 — forked from bessarabov/gist:674ea13c77fc8128f24b5e3f53b7f094
One-liner to generate data shown in post 'At what time of day does famous programmers work?' — https://ivan.bessarabov.com/blog/famous-programmers-work-time
git log --author="Linus Torvalds" --date=iso | perl -nalE 'if (/^Date:\s+[\d-]{10}\s(\d{2})/) { say $1+0 }' | sort | uniq -c|perl -MList::Util=max -nalE '$h{$F[1]} = $F[0]; }{ $m = max values %h; foreach (0..23) { $h{$_} = 0 if not exists $h{$_} } foreach (sort {$a <=> $b } keys %h) { say sprintf "%02d - %4d %s", $_, $h{$_}, "*"x ($h{$_} / $m * 50); }'
public static readonly ILoggerFactory MyLoggerFactory = LoggerFactory.Create(builder => { builder.AddDebug(); });
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<WeatherForecastContext>(options =>
options.UseLoggerFactory(MyLoggerFactory)
.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")), ServiceLifetime.Transient);
services.AddRazorPages();
services.AddServerSideBlazor();
services.AddScoped<WeatherForecastService>();

Cheat sheet: classes in JavaScript

Basic members of classes

class OtherClass {}

class MyClass1 extends OtherClass {

  publicInstanceField = 1;
Relational databases have been a successful technology for twenty years providing
- persistence
- concurrency control (Multiple apps and multiple users access the DB at the same time)
- integration mechanism (This is what prevented object oriented DBs to flourish)
Drawbacks of Relational DBs
- Impedance mismatch (In-memory(object) model of an application is different from (relational) model on disk).
That's why there are ORM frameworks which lead to loss of performance
- They are not designed to run efficiently on clusters
@Stamo-Gochev
Stamo-Gochev / what-forces-layout.md
Created December 15, 2020 12:54 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@Stamo-Gochev
Stamo-Gochev / what-forces-layout.md
Created December 15, 2020 12:54 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@Stamo-Gochev
Stamo-Gochev / wsl2-docker.md
Last active November 19, 2021 07:13 — forked from hakiri/wsl2-docker.md
Instruction how to set up WSL2 to work with Docker in Windows 10

On Windows 10 build 18917 or higher

Win / Enable WSL and VMP

PowerShell:

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

// requires restart
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux