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 class DateTimeExtensions | |
| { | |
| public static string ToFriendlyDate(this DateTime date) | |
| { | |
| // Calculate the elapsed time | |
| TimeSpan s = DateTime.UtcNow.Subtract(date); | |
| // Get total number of days elapsed. | |
| int dayDiff = (int)s.TotalDays; |
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
| //dotnet ef migrations add init | |
| //dotnet ef database update | |
| public class AppDbContext : DbContext | |
| { | |
| public AppDbContext(DbContextOptions options) | |
| : base(options) | |
| { |
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
| <?xml version="1.0" encoding="utf-8"?> | |
| <RuleSet Name="StyleCopRules" Description="StyleCop Analyzers" ToolsVersion="15.0"> | |
| <Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers"> | |
| <Rule Id="SA0001" Action="None"/> | |
| <Rule Id="SA1003" Action="None"/> | |
| <Rule Id="SA1101" Action="None"/> | |
| <Rule Id="SA1116" Action="None"/> | |
| <Rule Id="SA1200" Action="None"/> | |
| <Rule Id="SA1309" Action="None"/> | |
| <Rule Id="SA1310" Action="None"/> |
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
| using System; | |
| using System.Runtime.Caching; | |
| using AspectInjector.Broker; | |
| namespace testAspectInjector | |
| { | |
| [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] | |
| [Injection(typeof(CacheAspect), Inherited = true)] | |
| public abstract class AspectCacheAttribute : Attribute | |
| { |
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
| const fetch = require('node-fetch') | |
| const fs = require('fs-extra') | |
| const { execSync } = require('child_process') | |
| const main = async () => { | |
| const query = `nasa,cycling,surfing,underwater,swimming` | |
| const size = `1` | |
| const order = `latest` | |
| const orientation=`landscape` | |
| const photoName = 'photo.png' |
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 int DaysBetween(DateOnly startDate, DateOnly endDate) | |
| { | |
| return endDate.DayNumber - startDate.DayNumber; | |
| } | |
| public static (int Months, int Days) MonthsAndDaysBetween(DateOnly startDate, DateOnly endDate) | |
| { | |
| int months = (endDate.Year - startDate.Year) * 12 + endDate.Month - startDate.Month; | |
| DateOnly testDate = startDate.AddMonths(months); |
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
| using Microsoft.AspNetCore.Razor.TagHelpers; | |
| [HtmlTargetElement(LocalizeTagName)] // This is for <localize>Content here</localize> syntax | |
| [HtmlTargetElement(Attributes = LocalizeTagName)] // This is for <p localize>Content here</p> syntax, which I personally prefer | |
| public class LocalizeTagHelper : TagHelper | |
| { | |
| private const string LocalizeTagName = "localize"; | |
| public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) | |
| { |
OlderNewer

