Skip to content

Instantly share code, notes, and snippets.

View cpoDesign's full-sized avatar

Pavel cpoDesign

View GitHub Profile
@cpoDesign
cpoDesign / SQL2016DropIFExistsNew.sql
Last active January 23, 2018 17:01
SQL 2016 new way of checking if exists
DROP TABLE IF EXISTS dbo.Product
DROP TRIGGER IF EXISTS trProductInsert
DROP PROCEDURE IF EXISTS [dbo].[InsertData]
@cpoDesign
cpoDesign / PSExecution.cs
Last active January 17, 2018 21:46
Example how to run powershell in .net 4.7 from C#
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;
}
@cpoDesign
cpoDesign / SQLDropIFExistsOld.sql
Created January 17, 2018 21:33
Old way of checking if item exists before drop
IF EXISTS(SELECT 1 FROM sys.objects AS O WHERE O.name = 'Product' AND O.[type] = 'U')
BEGIN
    DROP TABLE [SomeTable]
END
 
IF OBJECT_ID('dbo.Product', 'U') IS NOT NULL
BEGIN
DROP TABLE dbo.Product;
END
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;
if (_angular_core.ɵglobal['Node']) {
nodeContains = _angular_core.ɵglobal['Node'].prototype.contains || function (node) {
return !!(this.compareDocumentPosition(node) & 16);
};
}
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 September 5, 2017 06:47
Extract MSI files without installing
msiexec /a c:\testfile.msi /qb TARGETDIR=c:\temp\test
@cpoDesign
cpoDesign / distinctDates.sql
Created April 30, 2017 22:14
SQL - Select distinct dates
SELECT
DISTINCT
CAST(FLOOR(CAST(Created as FLOAT)) as DateTime) as date
FROM
dbo.table
ORDER BY 1 ASC
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)
{
<add key="umbracoReservedPaths" value="~/umbraco,~/install/,~/bundles/" />