Skip to content

Instantly share code, notes, and snippets.

View chrisortman's full-sized avatar

Chris Ortman chrisortman

View GitHub Profile
@chrisortman
chrisortman / nonminifiedjavascript.cs
Created March 12, 2012 15:54
Non minified javascript bundle
public class NonMinifyingJavascript : IBundleTransform
{
public void Process(BundleContext context, BundleResponse bundle)
{
if(bundle == null)
{
throw new ArgumentNullException("bundle");
}
context.HttpContext.Response.Cache.SetLastModifiedFromFileDependencies();
@chrisortman
chrisortman / gist:4046168
Created November 9, 2012 14:58
restricted xml request
[Route("/helloservice/alive")]
[Service(1,RestrictAccessTo = EndpointAttributes.Xml | EndpointAttributes.HttpGet)]
public class Alive {}
@chrisortman
chrisortman / gist:5152438
Created March 13, 2013 14:07
Example of screwy nuget behavior
(-> means references)
WebProject -> ServiceStack 3.9.32 -> ServiceStack.Text 3.9.32
Using 'Manage nuget packages for solution' I add ServiceStack to my test project and wind up with
TestProject -> ServiceStack 3.9.32 -> ServiceStack.Text 3.9.38
#WTF!!!
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="My WPF UI" Height="300" Width="300">
<StackPanel Margin="5">
<StackPanel>
<Label Content="Prename:" />
<TextBox x:Name="preName" MinWidth="50"/>
</StackPanel>
<StackPanel>
<Label Content="Surename:" />
@chrisortman
chrisortman / example.cs
Last active December 30, 2015 06:49
I've been doing this thing where I pass an 'output' object into methods. The things I like about this are * I can vary implementation of output objects like one for an MVC ViewModel and another for a WPF ViewModel * Keeps privates of business objects (for lack of a better term) private * When I have methods that need to return more than one thin…
public class Payment {
private int _accountID;
private int _userID;
private decimal _paymentAmount;
/* I realize this looks almost like it should be a FI, but
that would just distract from the point */
public void OnAccount(int id) {
_accountID = id;
@chrisortman
chrisortman / LoginForm.cs
Created February 27, 2014 16:34
Example of C# html builder
public class LoginForm : FormView
{
public LoginForm()
{
this.Action = "/login";
Method = "POST";
AutoComplete = "off";
Classes = new[] {"form-stacked"};
DefineFields<LoginModel>(f =>
rails new nebcc14 -m https://raw.github.com/RailsApps/rails-composer/master/composer.rb

This will give me a little wizard where I can choose some default options. For simplicitly I'm going to omit some things like devise (used for user authentication)

In this example I will choose the first option for everything except

  • Build a starter application - 3 I want to build my own
  • Unit Testing? - 2 RSpec
  • Fixture replacement? - 2 - Factory Girl
@chrisortman
chrisortman / index.html
Created April 16, 2014 04:04
game of life
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Jasmine Spec Runner v2.0.0</title>
<link rel="shortcut icon" type="image/png" href="jasmine-standalone-2/lib/jasmine-2.0.0/jasmine_favicon.png">
<link rel="stylesheet" type="text/css" href="jasmine-standalone-2/lib/jasmine-2.0.0/jasmine.css">
<script type="text/javascript" src="jasmine-standalone-2/lib/jasmine-2.0.0/jasmine.js"></script>
<script type="text/javascript" src="jasmine-standalone-2/lib/jasmine-2.0.0/jasmine-html.js"></script>
.slide-container {
overflow: hidden;
}
.slide.ng-enter,
.slide.ng-leave {
-webkit-transition: 300ms cubic-bezier(0.250, 0.250, 0.750, 0.750) all;
-moz-transition: 300ms cubic-bezier(0.250, 0.250, 0.750, 0.750) all;
-ms-transition: 300ms cubic-bezier(0.250, 0.250, 0.750, 0.750) all;
@chrisortman
chrisortman / packages.config
Created August 5, 2014 14:59
Failing test for SM3 property injection
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="structuremap" version="3.0.5.130" targetFramework="net45" />
<package id="xunit" version="1.9.2" targetFramework="net45" />
</packages>