This file contains 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
/** AngularJS function to unsubscribe from observables when scope destroyed. | |
* @param $scope - Scope that is listening to an observable. | |
*/ | |
export function registerDestroyedObservable($scope: any) { | |
if($scope.destroyed$) { | |
return; | |
} | |
$scope.destroyed$ = new Subject(); | |
$scope.$on('$destroy', () => { |
This file contains 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
function getInjectables(appName) { | |
const queue = (angular.module(appName) as any)._invokeQueue; | |
const injectables = []; | |
function injectable(type, name, deps) { | |
return { name, type, deps, depsCount: deps.length, depsJoin: deps.join() }; | |
} | |
queue.forEach(q => { |
This file contains 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
log4net.Config.XmlConfigurator.Configure(); |
This file contains 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 class FooServiceTests | |
{ | |
private Fixture _fixture = new Fixture(); | |
[Test] | |
public void WhenLoggedIn_TheReportHasTheUsersNameIncluded() | |
{ | |
var subject = _fixture.LogIn("George Washington").CreateService(); | |
var result = subject.GetReportData(); | |
Check.That(result.CurrentUserName).IsEqualTo("George Washington"); |
This file contains 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
// [RequiredIf("SomeOtherProperty")] -- required if the other property is true | |
// [RequiredIf("SomeIntProperty", OtherPropertyValue = 42)] -- required if the other property is 42 | |
public class RequiredIfAttribute : ValidationAttribute, IClientValidatable | |
{ | |
public string OtherPropertyName { get; } | |
public object OtherPropertyValue { get; set; } | |
public RequiredIfAttribute(string otherPropertyName) | |
{ |
This file contains 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
USE [HobbyDB] | |
GO | |
/****** Object: Table [dbo].[AspNetRoleClaims] Script Date: 6/4/2018 10:18:03 PM ******/ | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[AspNetRoleClaims]') AND type in (N'U')) | |
BEGIN | |
CREATE TABLE [dbo].[AspNetRoleClaims]( |
This file contains 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
[MemoryDiagnoser] | |
public class Benchmark1 | |
{ | |
[Params("555-55-5555", "555-123-fsdfjksdf-xxx_fdslfs fkslfd_fkdlsf")] | |
public string Input { get; set; } | |
[Benchmark] | |
public string StringBuilderForeach() | |
{ | |
var sb = new StringBuilder(); |
This file contains 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.Diagnostics; | |
using System.Linq; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace ConsoleApp3 | |
{ | |
class Program | |
{ |
This file contains 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
protected void Application_Start() | |
{ | |
log4net.Config.XmlConfigurator.Configure(); | |
log4net.GlobalContext.Properties["userid"] = new Log4NetUserIdResolver(); | |
} |
This file contains 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
SET folder=%1 | |
echo "C:\projects\%folder%" | |
robocopy "C:\projects\%folder%" "E:\projects-archive\%folder%" /E /FFT /R:3 /W:10 /Z /NP /NDL /MT /XD node_modules /XD bower_components /XD packages |