This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var predicate = new DynamicFilterBuilder<Product>() | |
.And("Enabled", FilterOperator.Equals, true) | |
.And(b => b.And("Brand", FilterOperator.Equals, "Nike").Or("Brand", FilterOperator.Equals, "Adidas")) | |
.And(b => b.And("Price", FilterOperator.GreaterThanOrEqual, 20).And("Price", FilterOperator.LessThanOrEqual, 100)) | |
.Build(); | |
var products = _dbContext.Products.AsQueryable().Where(predicate).ToList(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static Expression<Func<TEntity, object>> GetPropertyGetter<TEntity>(string property) | |
{ | |
if (property == null) | |
throw new ArgumentNullException(nameof(property)); | |
var param = Expression.Parameter(typeof(TEntity)); | |
var prop = param.GetNestedProperty(property); | |
var convertedProp = Expression.Convert(prop, typeof(object)); | |
return Expression.Lambda<Func<TEntity, object>>(convertedProp, param); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from os import walk, path, remove | |
import sys | |
import re | |
pattern = re.compile(".+ \(\d+\)\..+") | |
# Taken from http://code.activestate.com/recipes/577081-humanized-representation-of-a-number-of-bytes/ | |
def get_human_readable_size(size, precision=2): | |
suffixes = ['B', 'KB', 'MB', 'GB', 'TB'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Single Page Apps for GitHub Pages</title> | |
<script type="text/javascript"> | |
// Single Page Apps for GitHub Pages | |
// https://github.com/rafrex/spa-github-pages | |
// Copyright (c) 2016 Rafael Pedicini, licensed under the MIT License | |
// ---------------------------------------------------------------------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Start Single Page Apps for GitHub Pages --> | |
<script type="text/javascript"> | |
// Single Page Apps for GitHub Pages | |
// https://github.com/rafrex/spa-github-pages | |
// Copyright (c) 2016 Rafael Pedicini, licensed under the MIT License | |
// ---------------------------------------------------------------------- | |
// This script checks to see if a redirect is present in the query string | |
// and converts it back into the correct url and adds it to the | |
// browser's history using window.history.replaceState(...), | |
// which won't cause the browser to attempt to load the new url. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: DeployToGitHubPages | |
env: | |
PUBLISH_DIR: bin/Release/netstandard2.1/publish/wwwroot | |
# Include subfolders if needed | |
on: | |
push: | |
branches: [ master ] | |
jobs: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Taken from https://stackoverflow.com/questions/34100048/github-create-empty-branch | |
git checkout --orphan gh-pages | |
git rm -rf . | |
git commit --allow-empty -m "root commit" | |
git push origin gh-pages |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Rectangle | |
{ | |
public double Width { get; init; } | |
public double Height { get; init; } | |
public Rectangle() | |
{ | |
// Of course you can still initialize the values in a constructor | |
Width = 10; | |
Height = 5; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Rectangle : IEquatable<Rectangle> | |
{ | |
[CompilerGenerated] | |
[DebuggerBrowsable(DebuggerBrowsableState.Never)] | |
private double <Width>k__BackingField; | |
[CompilerGenerated] | |
[DebuggerBrowsable(DebuggerBrowsableState.Never)] | |
private double <Height>k__BackingField; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Defining a record like this | |
public record Rectangle1 { double Width; double Height; } | |
// Is equivalent to this | |
public record Rectangle1 | |
{ | |
public double Width { get; init; } | |
public double Height { get; init; } | |
} |