Skip to content

Instantly share code, notes, and snippets.

<!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;
<xsl:call-template name="string(@status)"/>
<xsl:if test="contains(@status,'test')">
<xsl:call-template name="test"/>
</xsl:if>
<xsl:if test="contains(@status,'test2')">
<xsl:call-template name="test2"/>
</xsl:if>
<xsl:template name="test">
<xsl:param name="Pos" select="position()"/>
<h1>test</h1>
<SharePoint:FormField runat="server" id="testfield1{$Pos}" ControlMode="Edit" FieldName="Title" __designer:bind="{ddwrt:DataBind('u',concat('testfield',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Title')}"/>
</xsl:template>
<xsl:template name="test2">
<xsl:param name="Pos" select="position()"/>
<h1>test</h1>
<SharePoint:FormField runat="server" id="testfield2{$Pos}" ControlMode="Display" FieldName="Title" __designer:bind="{ddwrt:DataBind('u',concat('testfield',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Title')}"/>
@PiotrFerenc
PiotrFerenc / colored-status-view.xsl
Created July 11, 2018 14:07
colored Sharepoint status column
<xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" version="1.0" exclude-result-prefixes="xsl msxsl ddwrt" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal" xmlns:o="urn:schemas-microsoft-com:office:office">
<xsl:include href="/_layouts/xsl/main.xsl"/>
<xsl:include href="/_layouts/xsl/internal.xsl"/>
<xsl:template name="FieldRef_body.Status" match="FieldRef[@Name='Status']" mode="body">
<xsl:param name="thisNode" select="."/>
<xsl:choose>
<xsl:when test="$thisNode/@*[name()=current()/@Name] = 'Completed'">
<img src="/_layouts/images/IMNON.png" alt="Status: {$thisNode/@Status}"/>
</xsl:when>
@PiotrFerenc
PiotrFerenc / SPOUpload-Files.ps1
Created July 11, 2018 13:25
Files Sharepoint Upload
Add-Type -Path "C:\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Microsoft.SharePoint.Client.Runtime.dll"
Function Ensure-Folder()
{
Param(
[Parameter(Mandatory=$True)]
[Microsoft.SharePoint.Client.Web]$Web,
@PiotrFerenc
PiotrFerenc / Get-MsolUsers.ps1
Created July 11, 2018 13:09
PowerShell AzureAD Groups Members
$User = "nazwa@domena.pl"
$PWord = ConvertTo-SecureString -String "tajnehaslo" -AsPlainText -Force
$Credential = New-Object -TypeName "System.Management.Automation.PSCredential" -ArgumentList $User, $PWord
#$UserCredential = Get-Credential
Connect-MsolService -Credential $Credential
$Groups = Get-MsolGroup -All
foreach ($Group in $Groups)
{