Skip to content

Instantly share code, notes, and snippets.

View MichalGrzegorzak's full-sized avatar

Michal Grzegorzak MichalGrzegorzak

  • UK
View GitHub Profile
@MichalGrzegorzak
MichalGrzegorzak / UsefulMaterials.md
Created April 1, 2023 13:05 — forked from sweethuman/UsefulMaterials.md
Useful materials to checkout. In case you want to learn more.

Useful Articles, Videos and Tools

You can check them out if you want to learn more. Some are theoretical, some are more practical. You can look through them.

YouTube

Channels

IAmTimCorey (C# mostly)
Christopher Okhravi (General videos, about programming concepts, ideas and rules)

@MichalGrzegorzak
MichalGrzegorzak / AsyncCallOnConstructor.md
Created March 26, 2023 11:15 — forked from jessicamilene/AsyncCallOnConstructor.md
C# - Call an async method on the constructor

C#

Call an async method on the contructor and wait for it's execution

Task.Run(() => this.FunctionAsync()).Wait();
@MichalGrzegorzak
MichalGrzegorzak / InjectionFixture.cs
Created March 21, 2023 16:21 — forked from phillippelevidad/InjectionFixture.cs
xUnit: add Startup to test project and reuse configurations
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.TestHost;
using System;
using System.Net.Http;
namespace Tests
{
public class InjectionFixture : IDisposable
{
private readonly TestServer server;
@MichalGrzegorzak
MichalGrzegorzak / ExportAsExcel.cshtml
Created June 14, 2017 08:31 — forked from mattiasnorell/ExportAsExcel.cshtml
List all page types from a EPiServer CMS 7.5
@model IEnumerable<EPiServer.DataAbstraction.ContentType>
@{
Layout = null;
}
@Html.Partial("PageTypeTablePartial", Model)
@MichalGrzegorzak
MichalGrzegorzak / PropertyAppSettingsDropDownList.cs
Created June 14, 2017 08:30 — forked from mattiasnorell/PropertyAppSettingsDropDownList.cs
Populate a EPiServer CMS 7 drop down list in dynamic content from AppSettings
using EPiServer.Core;
using EPiServer.PlugIn;
using EPiServer.SpecializedProperties;
using EPiServer.Web.PropertyControls;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Web.UI.WebControls;
namespace Namespace.Path.In.Project
@MichalGrzegorzak
MichalGrzegorzak / CookieConsentAttribute.cs
Created February 24, 2017 13:15 — forked from Maarten88/CookieConsentAttribute.cs
ASP.NET ActionFilterAttribute to help implement european cookie-law
/*
* ASP.NET ActionFilterAttribute to help implement EU Cookie-law
* MIT Licence (c) Maarten Sikkema, Macaw Nederland BV
*/
using System;
using System.Web;
using System.Web.Mvc;
namespace Auction.Web.Utility
@MichalGrzegorzak
MichalGrzegorzak / box.ps1
Created July 24, 2016 12:07 — forked from JonCubed/box.ps1
Testing Boxstarter configuration
<#
#OPTIONAL
** Windows 7 **
Should upgrade to WMF 5 first for reduced errors
https://www.microsoft.com/en-us/download/details.aspx?id=50395
# If Dev Machine
[Environment]::SetEnvironmentVariable("BoxStarter:InstallDev", "1", "Machine") # for reboots

Episerver 7 - Dynamic page for vomiting all dynamic data store objects

Provides functionality for:

  • Exporting dynamic data stores to excel
  • Deleting single dynamic data store objects.

Set the stores you want to list in the stores, for example:

protected static List<object> stores = new List<object>()

{

param([string]$site=$(throw "Site argument is required."))
function vdir-exists([string]$name)
{
if((Test-Path -path $name) -eq $False)
{
return $False
}
(Get-Item $name).GetType().Name -eq "ConfigurationElement"
ALTER DATABASE [AspectoWeb] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
RESTORE DATABASE [AspectoWeb]
FROM DISK = N'C:\Users\RasmusKL\Desktop\www.aspectoweb.com_backup_2011_12_15_030005_0285276\www.aspectoweb.com_backup_2011_12_14_031114_3950159.wbak'
WITH NORECOVERY, REPLACE
RESTORE DATABASE [AspectoWeb]
FROM DISK = N'C:\Users\RasmusKL\Desktop\www.aspectoweb.com_backup_2011_12_15_030005_0285276\www.aspectoweb.com_backup_2011_12_15_030005_0285276.bak'
WITH RECOVERY