This file contains hidden or 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 static class Clock | |
| { | |
| private static DateTime? _frozenTime; | |
| /// <summary> | |
| /// Gets a <see cref="DateTime"/> object that is set to the current date and time on this computer, | |
| /// expressed as the local time. | |
| /// </summary> | |
| public static DateTime Now | |
| { |
This file contains hidden or 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 Uninstall-OldTentacle { | |
| Write-Output "Uninstalling the 1.0 Tentacle" | |
| $app = Get-WmiObject -Query "SELECT * FROM Win32_Product WHERE Name = 'Octopus Deploy Tentacle' AND Version < 2.0" | |
| $app.Uninstall() | |
| & sc.exe delete "Octopus Tentacle" | |
| } | |
| function Upgrade-Tentacle |
This file contains hidden or 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 fs = require('fs'); | |
| var path = require('path'); | |
| var es = require('event-stream'); | |
| var gulp = require('gulp'); | |
| var concat = require('gulp-concat'); | |
| var rename = require('gulp-rename'); | |
| var uglify = require('gulp-uglify'); | |
| var scriptsPath = './src/scripts/'; |
This file contains hidden or 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 readJson(file) { | |
| return JSON.parse(fs.readFileSync(file, 'utf8')); | |
| } | |
| function getFilesInFolder(dir) { | |
| console.log("Exploring " + dir); | |
| return fs.readdirSync(dir) | |
| .map(function(fileName) { | |
| var filePath = path.join(dir, fileName); | |
| var stat = fs.statSync(filePath); |
This file contains hidden or 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 HtmlRequestValidationModelBinder : DefaultModelBinder | |
| { | |
| public override object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) | |
| { | |
| try | |
| { | |
| return base.BindModel(controllerContext, bindingContext); | |
| } | |
| catch (HttpRequestValidationException) | |
| { |
This file contains hidden or 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 AntiForgeryTokenFilter : IAuthorizationFilter | |
| { | |
| public void OnAuthorization(AuthorizationContext filterContext) | |
| { | |
| if (IsHttpPostRequest(filterContext) && !SkipCsrfCheck(filterContext)) | |
| AntiForgery.Validate(); | |
| } | |
| private static bool IsHttpPostRequest(AuthorizationContext filterContext) | |
| { |
This file contains hidden or 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 static DateTime AddWorkingDays(this DateTime date, int workingDaysToAdd, string countryCode = null) | |
| { | |
| return AddWorkingDays(date, workingDaysToAdd, (dateToTest) => IsWorkingDay(dateToTest, countryCode)); | |
| } | |
| public static DateTime AddWorkingDays(this DateTime date, int workingDaysToAdd, Func<DateTime,bool> isWorkingDay) | |
| { | |
| var sign = Math.Sign(workingDaysToAdd); | |
| var unsignedDays = Math.Abs(workingDaysToAdd); | |
| for (var i = 0; i < unsignedDays; i++) |
This file contains hidden or 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
| -- Question 1 | |
| allEven :: [Integer] -> [Integer] | |
| allEven [] = [] | |
| allEven (h:t) = if even h then h:allEven t else allEven t | |
| allEven2 :: [Integer] -> [Integer] | |
| allEven2 list = [a | a <- list, even a] | |
| -- Question 2 |
This file contains hidden or 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
| Target "TestCoverage" (fun _ -> | |
| let filters = "-:*.Tests;" # exclude test assemblies from coverage stats | |
| # run NUnit tests via dotCover | |
| !! testAssemblies | |
| |> DotCoverNUnit (fun p -> { p with | |
| Output = artifactsDir @@ "NUnitDotCover.snapshot" | |
| Filters = filters }) nunitOptions | |
| # run the MSpec tests via dotCover | |
| !! testAssemblies |
OlderNewer