Skip to content

Instantly share code, notes, and snippets.

View phosphene's full-sized avatar

Ed Phillips phosphene

View GitHub Profile
@phosphene
phosphene / snip_for_db_test.scala
Created February 6, 2016 16:38
play2.4_fakeapp_withinmemorydb
val appWithMemoryDatabase = FakeApplication(additionalConfiguration = inMemoryDatabase("test"))
@phosphene
phosphene / install_scala_2.11.7_on_ubuntu
Created January 29, 2016 19:25
scala 2.11.7 install on ubuntu
sudo wget www.scala-lang.org/files/archive/scala-2.11.7.deb
sudo dpkg -i scala-2.11.7.deb
@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

logstash json format

{
  "message"    => "hello world",
  "@version"   => "1",
  "@timestamp" => "2014-04-22T23:03:14.111Z",
  "type"       => "stdin",
  "host"       => "hello.local"
}
@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
@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 / 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 / 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 / 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:
=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')