Skip to content

Instantly share code, notes, and snippets.

View phosphene's full-sized avatar

Ed Phillips phosphene

View GitHub Profile
@phosphene
phosphene / parsimony.txt
Last active December 12, 2015 05:08
Law of Parsimony in Practical Object-Oriented Design
Occam's Razor or Lex Parsimoniae or the Law of Parsimony
"It is vain to do with more what can be done with fewer"
It is an heuristic for design; it is not a golden hammer.
applying the razor to SOLID:
We get: Cohesive responsibility, cohesion, object coherence, or single responsibility.
@phosphene
phosphene / testing_principles.txt
Last active December 12, 2015 05:08
Practical Parsimonious Testing Design
Testing Principles:
Proving and Documenting Behaviour and Effectiveness
First Cut with the Razor:
A. Integration/Acceptance testing
1. Acceptance testing with Capybara
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@phosphene
phosphene / what_is_bdd.txt
Last active December 13, 2015 18:09
What is BDD
Tests add value through:
1. Reducing costs
2. Increasing communication
3. Find bugs, document behaviour (contracts, stories), defer design decisions
Behaviour-Driven Development is development through
describing behavior:
Where behavior is:
@phosphene
phosphene / subject_let_and_before.txt
Last active December 13, 2015 21:39
Sane guidelines for setting up Rspec tests with subject, let, and before(:each)
1. subject:
Use subject for creating the subject. Named subjects should be preferred unless
used only implicitly thereafter
i.e.:
subject(:user) { create(:user) }
where "user.bar" will be preferred over "subject.bar"
@phosphene
phosphene / find_awk_delete.txt
Last active December 14, 2015 03:59
find and delete large files using find, awk and system rm on ubuntu. ubuntu filename is at $8 on 10.10 but at $9 for 11
find and delete:
find . -type f -size +10000k -exec ls -lh {} \; | awk '{cmd="rm " $9; print cmd; system(cmd) }'
or
just find and print:
find . -type f -size +100000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'
@phosphene
phosphene / knife.rb
Created February 24, 2013 19:34
knife.rb with cache options for test of solo runs using test kitchen
log_level :info
log_location STDOUT
#cookbook_path ['./cookbooks']
cache_type 'BasicFile'
cache_options( :path => '~/.chef/checksums' )
cookbook_path [ './cookbooks', './site-cookbooks' ]
@phosphene
phosphene / simple_steps_to_cascalog.txt
Last active August 29, 2015 13:57
install cascalog, hadoop, etc. all in one go. a few minutes and we have a testable, queryable, hadoop instance in place.
simple steps to clojure cascalog
is ~/bin in your $PATH
at term type: echo $PATH
if not there add this to .bash_profile:
export PATH=$HOME/bin:$PATH

logstash json format

{
  "message"    => "hello world",
  "@version"   => "1",
  "@timestamp" => "2014-04-22T23:03:14.111Z",
  "type"       => "stdin",
  "host"       => "hello.local"
}
@phosphene
phosphene / scala_sbt_intstall_ubuntu
Created October 28, 2015 20:25
scala and sbt install on ubuntu
sudo wget www.scala-lang.org/files/archive/scala-2.11.7.deb
sudo dpkg -i scala-2.11.7.deb
sudo wget https://bintray.com/artifact/download/sbt/debian/sbt-0.13.9.deb
sudo dpkg -i sbt-0.13.9.deb