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 New-Password { | |
param([int]$length = 12, | |
[int]$complexity = 4) | |
[String[]]$source = "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "1234567890", "[]{}<>@#~?!£$%^&*()" | |
$newPassword = $null | |
foreach($counter in 1..$length) { | |
# Work out which character type to get | |
$set = Get-Random $complexity |
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
var regexp = /ste/ig; | |
var results = []; | |
for(var i = 0; i < 10; i++) { | |
results.push(regexp.test('Steve Hocking')); | |
regexp.lastIndex = 0; | |
} | |
console.log(results.toString()); |
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
var regexp = /ste/i; | |
var results = []; | |
for(var i = 0; i < 10; i++) { results.push(regexp.test('Steve Hocking')); } | |
console.log(results.toString()); |
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
var regexp = /ste/ig; | |
var results = []; | |
for(var i = 0; i < 10; i++) { results.push(regexp.test('Steve Hocking')); } | |
console.log(results.toString()); |
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
var regexp = /ste/ig; | |
var names = ['John Smith', 'Steven Hocking', 'Robert Stevenson', 'Steve Hocking', 'Janet Smith']; | |
var filtered = names.filter(function(name) {return regexp.test(name);}); | |
console.log(filtered.toString()); |
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 getObjectType(obj) { | |
var funcNameRegex = /function (.{1,})\(/; | |
if(!!obj && !!obj.constructor) { | |
var results = (funcNameRegex).exec(obj.constructor.toString()); | |
return (results && results.length > 1) ? results[1] : ""; | |
} | |
return typeof obj; | |
} |
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.Linq; | |
using System.Linq.Expressions; | |
namespace Moq | |
{ | |
public static class MockingUtilities | |
{ | |
public static Mock<T> AutoMockFluentInterface<T>(this Mock<T> interfaceMock) where T:class | |
{ |
NewerOlder