Skip to content

Instantly share code, notes, and snippets.

View chrisortman's full-sized avatar

Chris Ortman chrisortman

View GitHub Profile
@chrisortman
chrisortman / test-me.sh
Created February 25, 2016 15:26
Simple script for running an rspec test during git-bisect
set +e
RAILS_ENV=test bundle exec rake db:schema:load
bundle exec rspec spec/models/arm/create_line_items_visit_spec.rb:57
test_result=$?
echo Test complete
git checkout HEAD Gemfile.lock
exit $test_result
@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;
<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 / 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!!!
@chrisortman
chrisortman / test.rb
Created October 29, 2015 18:00
name this test-antipattern
def add(x, y)
x + y
end
it 'adds' do
# does this anti-pattern have a name?
add(1, 2).must_equal(1 + 2)
end
#vs
@chrisortman
chrisortman / grid.elm
Last active October 26, 2015 13:19
Grid with selectable rows
import StartApp.Simple as StartApp
import Mouse
import Html exposing(..)
import Html.Attributes exposing(style,attribute)
import Html.Events exposing(..)
import Signal exposing(..)
main =
StartApp.start { model = model, view = view, update = update }
@chrisortman
chrisortman / main.elm
Created October 16, 2015 03:22
Elm why you no check type alias
import Html exposing (text)
type alias ID = Int
type alias Minute = Int
f : ID -> Int
f x = x * 2
g : Minute -> Bool
g x = if x > 10 then True else False
@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 / 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 / A.cs
Created February 27, 2012 22:11
IoC example
public class A {
public A() {
_b = new B();
}
}