Skip to content

Instantly share code, notes, and snippets.

SELECT
OBJECT_NAME(i.object_id) AS TableName,
i.name AS IndexName,
i.index_id,
i.type_desc,
i.is_unique,
i.is_primary_key,
i.is_disabled
FROM
sys.indexes i
public static string GetDifference(string baseString, string comparedString)
{
if (baseString == null || comparedString == null)
throw new ArgumentNullException("Input strings cannot be null.");
if (comparedString.StartsWith(baseString))
{
// Jeśli comparedString zaczyna się od baseString, zwróć różnicę
return comparedString.Substring(baseString.Length);
}
public interface IWorkflowStep
{
string Name { get; }
Task<WorkflowResult> ExecuteAsync(WorkflowContext context);
}
public class WorkflowResult
{
public bool Success { get; set; }
public string? Message { get; set; }
// Tworzenie wyrażenia "x => x.Property != null && x.Property.Contains(value)"
var parameter = propertyExpression.Parameters[0]; // Pobierz parametr lambda z propertyExpression (np. x)
var property = propertyExpression.Body; // Pobierz ciało wyrażenia (np. x.Property)
// Utwórz wyrażenie "x.Property != null"
var notNullExpression = Expression.NotEqual(property, Expression.Constant(null, typeof(string)));
// Wyszukaj metodę "Contains" na typie string
var containsMethod = typeof(string).GetMethod(nameof(string.Contains), new[] { typeof(string) });
if (containsMethod == null)
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<IncludeBuildOutput>false</IncludeBuildOutput>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageId>MyAnalyzerPackage</PackageId>
<PackageVersion>1.0.0</PackageVersion>
<Authors>Your Name</Authors>
<Company>Your Company</Company>
@PiotrFerenc
PiotrFerenc / gist:dd4ae2d70022327638b856ecdeec9831
Created December 6, 2024 13:36
Porównanie danych z dwóch tabel
-- Wyświetlenie różnic między dwoma tabelami
SELECT
'TABELA_1 -> TABELA_2' AS RÓŻNICA,
t1.*
FROM
TABELA_1 t1
LEFT JOIN
TABELA_2 t2
ON
t1.id = t2.id
<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dynamiczny Diagram Mermaid</title>
<script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
<style>
#mermaid {
border: 1px solid black;
@PiotrFerenc
PiotrFerenc / gist:9bc43d50a0634f4f60d5f0eeb8389a41
Created October 7, 2021 20:04 — forked from sandord/gist:400553
Get property name from lambda expression
using System.Linq.Expressions;
/// <summary>
/// Returns the name of the specified property of the specified type.
/// </summary>
/// <typeparam name="T">The type the property is a member of.</typeparam>
/// <param name="property">The property expression.</param>
/// <returns>The property name.</returns>
public static string GetPropertyName<T>(Expression<Func<T, object>> property)
{
@PiotrFerenc
PiotrFerenc / demo-output-GetPropertyName.linqpad.cs
Created October 2, 2021 20:20 — forked from zaus/demo-output-GetPropertyName.linqpad.cs
From StackOverflow discussion http://stackoverflow.com/questions/671968/retrieving-property-name-from-lambda-expression/17220748#17220748 -- demonstrating the behavior of various solutions via LinqPad to answer questions in the comments. Usage: LinqPad as "C# Program".
void Main()
{
// from comment discussion http://stackoverflow.com/questions/671968/retrieving-property-name-from-lambda-expression/17220748#17220748
Expression<Func<O, int>> exprId = o => o.Id;
Expression<Func<O, string>> exprName = o => o.Name;
Expression<Func<O, int[]>> exprItems = o => o.Items;
Expression<Func<O, int>> exprItemsLength = o => o.Items.Length;
Expression<Func<O, Subclass>> exprChild = o => o.Child;
Expression<Func<O, string>> exprChildName = o => o.Child.Name;
@PiotrFerenc
PiotrFerenc / Error: Failed to start the transport 'WebSockets': Error: There was an error with the transport
Created September 29, 2021 20:30
Error: Failed to start the transport 'WebSockets': Error: There was an error with the transport
server {
listen 80;
server_name 52.xx.xxx.xx;
location / {
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
proxy_pass "http://127.0.0.1:4200";
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;