Skip to content

Instantly share code, notes, and snippets.

View KevM's full-sized avatar

Kevin Miller KevM

View GitHub Profile
@KevM
KevM / policy.cs
Created February 19, 2014 18:22
Alternative Anti Forgery Policy
[ConfigurationType(ConfigurationType.InjectNodes)]
public class SSAntiForgeryFilterPolicy : IConfigurationAction
{
public void Configure(BehaviorGraph graph)
{
var antiForgerySettings = graph.Settings.Get<AntiForgerySettings>();
graph.Behaviors.Where(antiForgerySettings.AppliesTo)
.Each(x => x.Prepend(ActionFilter.For<SSAntiForgeryFilter>(f => f.Filter())));
}
}
@KevM
KevM / behavior.js
Created February 21, 2014 22:00
Transfer API Get Requests to a SPA home
public class TransferApiGetRequestsToHome : IConfigurationAction
{
public void Configure(BehaviorGraph graph)
{
graph.Behaviors
.Where(x => x.FirstCall() != null && x.FirstCall().InputType().CanBeCastTo<IApi>())
.Each(b => b.Prepend(ActionFilter.For<APIGetDetector>(x => x.Filter(null))));
}
}

Running selenium tests via Team City as a windows service has a resolution of 1024x768. I tryed adding/changing DefaultSettings.XResolution and YResolution in the registry with no luck. What did work was running TC agent in the console as a logged in user.

Use these instructions to setup a user to automatically log in when your box starts up

http://www.win2008workstation.com/configure-auto-logon/

Add shortcut to the startup forlder on start menu: C:\Users\YOUUSER\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

that points to your team city agent's start.bat with 'start' parameter

@KevM
KevM / 1_initial.md
Last active August 29, 2015 13:57
Overdrive Case Initial Contact

Your case (00326056) history details...

THE ISSUE:

  1. Category: Software Issue

  2. Description: After upgrading from an earlier version of Overdrive Media Console to version 1.1.1 on my Macbook (OSX 10.9.2) I cannot launch the application. I get an error. The details of that are entered below. ss

  3. Pressing either button from the error dialog simply does nothing. The Activity Monitor shows the overdrive console process exiting shortly after one of these options is pressed.

@KevM
KevM / FubuRegistry.cs
Created April 25, 2014 17:03
Getting FubuValidation to apply to more than just POST endpoints
public class ConfigureFubuMVC : FubuRegistry
{
public ConfigureFubuMVC()
{
// ....
AlterSettings<ValidationSettings>(e =>
{
e.Where.RespondsToHttpMethod("PUT", "POST", "DELETE").And.Matching(new HasInputType());
});
@KevM
KevM / test.cs
Created June 3, 2014 15:27
FubuMVC Integration testing
[Test]
public void home_endpoint_should_return_document_specifications()
{
using (var server = new WebApplication().BuildApplication().RunEmbedded())
{
var results = server.Endpoints.Get<HomeEndpoint>(x => x.Execute(new HomeRequest()))
.ReadAsJson<SpecificationListViewModel>();
results.SpecificationDocumentCount.ShouldBeGreaterThan(0);
}
@KevM
KevM / animal.schemascript.xml
Last active August 29, 2015 14:02
Adding Attachments to a Custom Entity
<schemaScript xmlns="http://www.dovetailsoftware.com/2006/10/SchemaScript.xsd">
<addTable name="animal" id="4921">
<groupName>Test</groupName>
<description>Test of adding attachments to custom entities.</description>
</addTable>
<addColumn name="objid" dataType="Integer" table="animal">
<description>Internal record number</description>
<clarifyGenericFieldID>3</clarifyGenericFieldID>
</addColumn>
@KevM
KevM / userStatus.spark
Created July 10, 2014 21:07
userStatus.spark
<viewdata model="Web.api.UserStatusModel"/>
<use namespace="FubuCore"/>
<ul class="nav unstyled" id="primary-tasks" if="Model.IsAuthenticated">
<li if="Model.CanCreateCase">
<a class="create-case-action" href="${ this.Urls.UrlFor(new Agent.Support.api.Cases.CreateCaseRequest()) }">${ Agent.Shared.Core.SharedCoreKeys.CREATE } ${ Agent.Shared.Core.SharedCoreKeys.CASE }</a>
</li>
<li class="dropdown" if="Model.CanCreateCase || Model.CanCreateContact || Model.CanCreateSite || Model.CanCreateSolution">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
${ Agent.Shared.Core.SharedCoreKeys.CREATE } <span class="caret"></span>
@KevM
KevM / EmployeeTemplatePolicyExpression.cs
Last active August 29, 2015 14:04
Dovetail History Builder Customization Example
public class EmployeeActEntryTemplatePolicy : ActEntryTemplatePolicyExpression {
public EmployeeActEntryTemplatePolicy(IHistoryOutputParser historyOutputParser) : base(historyOutputParser)
{
}
protected override void DefineTemplate(WorkflowObject workflowObject)
{
if (workflowObject.Type != "employee")
{
//This policy only cares about employee objects. If we didn't add this guard clause these policies would be present
@KevM
KevM / CoupV3.js
Last active August 29, 2015 14:05
Wonder Coup Automate!
var b = require('bonescript');
var SunCalc = require('suncalc');
// Set Beagles GPIO pin moodes
var DoorOpen = "P8_13";
var DoorClose = "P8_14";
var DoorOpenBtn = "P8_15";
var DoorCloseBtn = "P8_16";
b.pinMode(DoorOpen, b.OUTPUT);
b.pinMode(DoorClose, b.OUTPUT);