Skip to content

Instantly share code, notes, and snippets.

# This script will clone the settings from one project to another via an exported YAML
$apiUrl = 'https://ci.appveyor.com/api'
$token = '[your token]'
$headers = @{
"Authorization" = "Bearer $token"
"Content-type" = "application/json"
}
$accountName = '[account name]'
$projectSlug = '[project slug]'
[AttributeUsage(AttributeTargets.Method)]
public class ValidationActionFilterAttribute : ActionFilterAttribute
{
public override void OnActionExecuting(HttpActionContext actionContext)
{
InnerOnActionExecuting(actionContext);
var modelState = actionContext.ModelState;
if (modelState.IsValid)
@kadet1090
kadet1090 / prompt.ps1
Created March 21, 2016 17:33
PowerLine like prompt for PowerShell
$script:bg = [Console]::BackgroundColor;
$script:first = $true;
$script:last = 0;
function Write-PromptFancyEnd {
Write-Host  -NoNewline -ForegroundColor $script:bg
$script:bg = [System.ConsoleColor]::Black
}
@mikanyg
mikanyg / ResourceNotFoundAttribute.cs
Last active May 2, 2017 22:37
WebApi ActionFilter used in conjunction with Service Fabric reverse proxy or ServiceFabric.AutoRest to indicate a RESTfull 404 response.
using System;
using System.Net;
using System.Web.Http.Filters;
namespace ServiceFabric.WebApi.Filters
{
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited = true, AllowMultiple = false)]
public class ResourceNotFoundAttribute : ActionFilterAttribute
{
public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext)
@mika76
mika76 / IniSerializer.cs
Last active January 16, 2024 20:45
INI Serializer for .NET Core in C# - Pretty basic with some validations and Serialize and Deserialize methods. There are lot's of variations for ini files though so it will probably not support every scenario. Feel free to adapt to your use-case.
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace tools
{
/// <summary>
/// Serializer class for ini files.