Skip to content

Instantly share code, notes, and snippets.

View Opiskull's full-sized avatar
🐠
Blub

Opiskull Opiskull

🐠
Blub
View GitHub Profile
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Runtime.ExceptionServices;
using System.Threading;
@Opiskull
Opiskull / UnitTest1.cs
Last active February 13, 2019 23:17
Add Skip of test and add azure resources
using System.Threading.Tasks;
namespace dotnet_test
{
public class UnitTest1
{
// private string Skip = "Manual Only (only execute this tests if blabla exists";
private string Skip = null;
[Fact(Skip = Skip)]
@Opiskull
Opiskull / gist:aff84b2cc7590ade04fdca703e4c140b
Created March 29, 2018 19:20
Add trailing slash with url rewrite to .net core
<rule name="Add trailing slash" stopProcessing="true">
<match url="(.*[^/])$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" pattern="(.*?)\.html$" negate="true" />
<add input="{REQUEST_FILENAME}" pattern="(.*?)\.aspx$" negate="true" />
</conditions>
<action type="Redirect" redirectType="Permanent" url="{R:1}/" />
</rule>
@Opiskull
Opiskull / gist:ba453d139b868ee446ff8f0aee75ff99
Created November 22, 2017 09:07
async-binding-behavior.ts
export class AsyncBindingBehavior {
bind(binding, source) {
binding.originalupdateTarget = binding.updateTarget;
binding.updateTarget = (a) => {
if (typeof a.then === "function") {
a.then(d => { binding.originalupdateTarget(d); });
}
else
binding.originalupdateTarget(a);
@Opiskull
Opiskull / gist:0ce807ee3f987d4cb7ce098f9ce0ac03
Created November 22, 2017 08:30
promise-repeat-strategy.ts
import { Repeat, RepeatStrategyLocator } from "aurelia-templating-resources";
export class PromiseRepeatStrategy {
constructor(private repeatStrategyLocator: RepeatStrategyLocator) { }
instanceChanged(repeat: Repeat, promise: any): void {
promise.then((items) => {
const strategy = this.repeatStrategyLocator.getStrategy(items);
if (!strategy) {
@Opiskull
Opiskull / gist:447400fa8bbb963a200a
Last active August 29, 2015 14:04
Angular Watchers Counter
(function () {
var root = angular.element(document.getElementsByTagName('html')); var watchers = [];
var f = function (element) {
if (element.data().hasOwnProperty('$scope')) {
angular.forEach(element.data().$scope.$$watchers, function (watcher) { watchers.push(watcher); });
}
angular.forEach(element.children(), function (childElement) { f(angular.element(childElement)); });
};
f(root);
console.log(watchers.length);