Skip to content

Instantly share code, notes, and snippets.

@davidfowl
davidfowl / MinimalAPIs.md
Last active April 10, 2024 04:24
Minimal APIs at a glance
@rjescobar
rjescobar / extend-trial-jetbrains-windows.bat
Created August 31, 2021 02:53
JetBrains IDE trial reset windows
REM Delete eval folder with licence key and options.xml which contains a reference to it
for %%I in ("WebStorm", "IntelliJ", "CLion", "Rider", "GoLand", "PhpStorm", "Resharper", "PyCharm") do (
for /d %%a in ("%USERPROFILE%\.%%I*") do (
rd /s /q "%%a/config/eval"
del /q "%%a\config\options\other.xml"
)
)
REM Delete registry key and jetbrains folder (not sure if needet but however)
rmdir /s /q "%APPDATA%\JetBrains"

System Architecture Course

This course provides a structured approach for designing and implementing large systems that are scalable and highly available.

The challenges designing and building large systems are in how they are decomposed and communicate with each other. You will learn how to define boundaries based on business capabilities and implement asynchronous messaging for communication.

This course will show architectural patterns and styles that create a system that is resilient when failures occur. And when load and traffic increases are scalable horizontally on-demand as required.

I've developed this course based on my over two decades of experience designing and developing business systems in distribution, transportation, manufacturing, and accounting.

@billpratt
billpratt / .NETMongoApplicationInsightsExamples.cs
Last active October 21, 2021 08:27
Examples of how to track .NET Mongodb queries in Application Insights
class Program
{
static void Main(string[] args)
{
var telemetryClient = new TelemetryClient(new TelemetryConfiguration("APP_INSIGHTS_KEY"));
var mongoConnectionString = "mongodb://localhost:27017/test";
TrackMongoByEvents(mongoConnectionString, telemetryClient);
TrackMongoManually(mongoConnectionString, telemetryClient);
@wojteklu
wojteklu / clean_code.md
Last active April 25, 2024 12:09
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@ejmr
ejmr / git-branch-show-description.sh
Last active May 29, 2022 07:41
Show the Description for the Current Branch
#!/bin/bash
#
# You can use `git branch --edit-description` to write a description
# for a branch, but Git provides no simple command to display that
# description. The "easiest" way to see it is via `git config --get
# branch.BRANCH_NAME.description`.
#
# This script automates that process and is meant to be used as
# a Git alias to provide a shorter command for showing the
# description of the current branch.
@gpapadopoulos
gpapadopoulos / ReadAsStreamAsync-Example.cs
Created October 13, 2015 06:50
How to get the Stream of a file from a Request object using "Request.Content.ReadAsStreamAsync()"
#region TEST "Request.Content.ReadAsStreamAsync()"
var provider = new MultipartMemoryStreamProvider();
await Request.Content.ReadAsMultipartAsync(provider);
foreach (var item in provider.Contents.Where(item => item.Headers.ContentDisposition.FileName != null))
{
Stream streamRead = await item.ReadAsStreamAsync();
@nethoncho
nethoncho / visibilitychange.js
Created February 15, 2015 12:57
Handling document.visibilitychange in AngularJS
// See http://megatuto.com/formation-JAVASCRIPT.php?JAVASCRIPT-Examples=handling+document.visibilitychange+in+AngularJS+Categorie+javascript+angularjs&article=1773
angular.module('myApp', [])
.run(['$rootScope', '$document', function($rootScope, $document) {
$document[0].addEventListener("visibilitychange", function() {
$rootScope.$broadcast('$visibilitychange', $document[0].hidden);
});
}])
.controller('UserNavCtrl', ['$scope', '$log',
function($scope,$log) {
$scope.$on('$visibilitychange', function(event, data) {
@mwise
mwise / README.md
Last active July 14, 2023 14:11
Git hook to prevent merging staging branch into master branch

To use this hook:

  • add the prepare-commit-msg file at .git/hooks/prepare-commit-msg and edit as needed
  • make it executable: chmod +x .git/hooks/prepare-commit-msg
  • disable fast-forward merges: git config branch.master.mergeoptions "--no-ff"
  • that's it!

NOTE: after a failed merge from a forbidden branch, the working tree will still be in a MERGING state. To discard the local working copy state, run: git reset --merge

@manishtpatel
manishtpatel / main.go
Last active October 18, 2023 03:12
GoLang Encrypt string to base64 and vice versa using AES encryption.
package main
import (
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"encoding/base64"
"fmt"
"io"
)