Skip to content

Instantly share code, notes, and snippets.

View chrisortman's full-sized avatar

Chris Ortman chrisortman

View GitHub Profile
@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 / open-hack-announce.md
Last active August 29, 2015 14:20
Open Hack Announce

You don't want to be that bitter guy in the corner who had the great idea 5 yrs ago but never executed it. -@jasonlankow

Finish those side projects on github. Learn that new language or framework. Contribute to open source. If you make small consistent progress you will get something done. You just need a dedicated time and space.

Come to the North Liberty CoLab on the second Thursday of every month. A productive environment with a group of peers for when you need that second set of eyeballs.

Hope to see you there,

Chris

@chrisortman
chrisortman / fraction.rb
Created December 3, 2014 06:11
Fraction multiplication visualization
class Fraction
attr_accessor :numerator, :denominator
def initialize(n,d)
@numerator = n
@denominator = d
end
end
@chrisortman
chrisortman / fix_finders.rb
Last active August 29, 2015 14:09
Converts finder methods to ActiveRecord 3
#!/usr/bin/env ruby -n
#
# You can setup shortcuts in vim that will run this automatically
#
# :map mm :.!~/<path_to_script>/fix_finders.rb<cr>
# Will replace the current line with the output of this script
#
# :map mn :t.<cr>:.!~/<path_to_script>/fix_finders.rb<cr>
# Will duplicate the line first so that you can do comparision of the
@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>
.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 / 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>
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