Skip to content

Instantly share code, notes, and snippets.

Pavel cpoDesign

View GitHub Profile
@cpoDesign
cpoDesign / PSExecution.cs
Last active Jan 17, 2018
Example how to run powershell in .net 4.7 from C#
View PSExecution.cs
namespace Web.Controllers
{
public class PSExecution
{
public PSCommand PSCommand{get;set;}
public string Output{get; private set;}
public void SetOutput(string output){
this.Output = output;
}
View WaitAll.cs
public async Task<IHttpActionResult> MethodB()
{
var customer = new Customer();
var getAllWidgetsTask = _widgetService.GetAllWidgets();
var getAllFoosTask = _fooService.GetAllFos();
Task.WaitAll(new List[] {getAllWidgetsTask, getAllFoosTask});
customer.Widgets = getAllWidgetsTask.Result;
View vendorInformation.js
if (_angular_core.ɵglobal['Node']) {
nodeContains = _angular_core.ɵglobal['Node'].prototype.contains || function (node) {
return !!(this.compareDocumentPosition(node) & 16);
};
}
View DebuggingInfo.log
Microsoft.AspNetCore.NodeServices.HostingModels.NodeInvocationException: Prerendering failed because of error: TypeError: Cannot read property 'Node' of undefined
at module.exports.d.(anonymous function) (netcore2AppPath\ClientApp\dist\vendor.js:26869:26)
at module.exports.Object.setPrototypeOf.__proto__ (netcore2AppPath\ClientApp\dist\vendor.js:25890:10)
at Object.module.exports.d.(anonymous function) (netcore2AppPath\ClientApp\dist\vendor.js:25893:2)
at __webpack_require__ (netcore2AppPath\ClientApp\dist\vendor.js:21:30)
at Object.define.function.define.amd.global.ng (netcore2AppPath\ClientApp\dist\main-server.js:8019:42)
at __webpack_require__ (netcore2AppPath\ClientApp\dist\main-server.js:20:30)
at Object.setPrototypeOf.__proto__ (netcore2AppPath\ClientApp\dist\main-server.js:8031:51)
at Object.define.function.define.amd.global.ng (netcore2AppPath\ClientApp\dist\main-server.js:8034:2)
@cpoDesign
cpoDesign / commandLine.bat
Created Sep 5, 2017
Extract MSI files without installing
View commandLine.bat
msiexec /a c:\testfile.msi /qb TARGETDIR=c:\temp\test
@cpoDesign
cpoDesign / distinctDates.sql
Created Apr 30, 2017
SQL - Select distinct dates
View distinctDates.sql
SELECT
DISTINCT
CAST(FLOOR(CAST(Created as FLOAT)) as DateTime) as date
FROM
dbo.table
ORDER BY 1 ASC
View UmbracoStartUpHandler.cs
public class SiteStartupHandler : IApplicationEventHandler
{
public void OnApplicationStarted(UmbracoApplicationBase umbracoApplication,ApplicationContext applicationContext)
{
// Register bunding for umbraco
RegisterStyles(BundleTable.Bundles);
RegisterJavascript(BundleTable.Bundles);
}
private static void RegisterStyles(BundleCollection bundles)
{
View web.config
<add key="umbracoReservedPaths" value="~/umbraco,~/install/,~/bundles/" />
View actor-poison-pill.cs
// The fact that user actor is created using the props does not mean
// anything as it needs to be registered with the system to know about it.
Props demoActorRef = Props.Create<MyDemoActor>();
// Lets register the actor with the system
IActorRef actorRef = BulkProcessingSystem.ActorOf(demoActorRef, "DemoActor");
// Send message to the actor
actorRef.Tell("Akka.net rocks");
@cpoDesign
cpoDesign / calculator.feature
Created Apr 5, 2017
Specflow calculator feature definition and scenario
View calculator.feature
Feature: Calculator
In order to avoid silly mistakes
As a math idiot
I want to be told the sum of two numbers
@mytag
Scenario: Add two numbers
Given I have entered 50 into the calculator
And I have also entered 70 into the calculator
When I press add
You can’t perform that action at this time.