Skip to content

Instantly share code, notes, and snippets.

View patricksrobertson's full-sized avatar

Patrick Robertson patricksrobertson

View GitHub Profile
BlargController = App.IndexController.extend
isFeatureOn: (->
@get('features').get('This_is_my_feature') == true
).property('features')
Thoughts on js toolchain infancy / difficulty
In general:
I think serious browser app development is still in its infancy and
as a result the tools move really quickly and the continued development
invalidates documentation / blog posts / SO questions etc. This is analogous
to the Rails 2.0 time period in which we had just gotten a pile of good stuff
on the internet to deal with Rails 1.8 and then everything just broke. Considering
how young the tooling is, I think it's gotten crazy powerful recently (ember-cli / lineman).
In a year we'll probably be very happy people.
@patricksrobertson
patricksrobertson / ecosystem.md
Last active August 29, 2015 14:13
ember cli ecosystem

ICIS Ember-CLI Ecosystem

This doc outlines what we have going for us with Ember-CLI apps/addons.

The idea behind the addon ecosystem is this that it's currently too fucking expensive to build single page apps vs how expensive it should be.

We have automatically generating Ruby API clients, we have engines for authenticaiton on the server side, but up till now we don't have anything for the client.

Breaking up with Asset Pipeline TL;DR

BEFORE

  • metric crapton of coffee files, plus sourcemaps (~3 year actively developed BackboneJS app with ~7 pages)
  • metric crapton of sass files, no sourcemaps (our designer hated us with a passion for the lack of sourcemaps)
  • development page load time ~45seconds - 1 minute
  • Assload of mocha/chai tests, run with konacha (rails engine)
    • Took ~4 minutes for konacha to load all test files, pain in the ass
  • Had to split up konacha suite into 3 parts for CI
@patricksrobertson
patricksrobertson / structs.md
Last active August 29, 2015 13:58
STRUCTRIK ROBERTSON

Why structs are pretty OK

I primarily use structs as:

  • A data structure replacing any array and calls to array like things.
  • As a value object.
  • As an internal class wrapping some behavior until I get a better grasp on things.

Consider the following:

@patricksrobertson
patricksrobertson / arel_node_ascending_test.rb
Created February 15, 2014 13:50
node ascending AR test case.
require 'cases/helper'
if current_adapter?(:PostgreSQLAdapter)
class ArelNodeAscendingTest < ActiveRecord::TestCase
self.use_transactional_fixtures = false
class State < ActiveRecord::Base
has_many :cities
default_scope { includes(:cities) }
end
class Vector
def initialize(x, y)
@x, @y = x, y
end
def *(value)
self.class.new(@x * value, @y * value)
end
def to_s
class HL7::Message::Segment::FTS < HL7::Message::Segment
add_field :something
add_field :something_else
end
class HL7::Message::Segment::FTS < HL7::Message::Segment
add_field :something
add_field :something_else
end
@patricksrobertson
patricksrobertson / some_controller.rb
Last active December 17, 2015 01:28
Why I hate the anti-runtime extension topic with DCI.
class SomeController < ApplicationController
def create
patient = Patient.new(params[:patient]) #METHOD CACHE DESTROYED ABOUT A MILLION TIMES
patient.extend RegisteringNewPatient #METHOD CACHE DESTROYED ONCE, 0.00001 seconds consumed
patient.save #METHOD CACHE DESTROYED ANOTHER MILLION TIMES
end
end
@patricksrobertson
patricksrobertson / blerg.coffee
Created October 29, 2012 13:04
oh god dont show them how to perpetuate option hash passing in coffescript.
# so very bad
class Blerg
constructor: (@options = {}) ->
byLine: ->
"by #{@options.author.fullName()}"
category: ->
@options.category