Skip to content

Instantly share code, notes, and snippets.

View jakcharlton's full-sized avatar

Jak Charlton jakcharlton

View GitHub Profile
@jakcharlton
jakcharlton / comma_delimited_to_array.cs
Created July 26, 2012 05:23
comma_delimited_to_array
comma_delimited_to_array = (to_split) ->
return (to_split.split(",").map (c)-> c.replace(/^\s+|\s+$/g, "")) if to_split
[Step 1/2] Process exited with code 0
[10:42:42]Step 2/2: Test (NUnit) (running for 11m:36s)
[10:42:42][Step 2/2] Starting: C:\TeamCity\buildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher.exe #TeamCityImplicit
[10:42:42][Step 2/2] in directory: C:\TeamCity\buildAgent\work\cc73a2a1ac9bb9e7
[10:42:52][Step 2/2] JetBrains dotCover Console Runner v1.2.352.19. Copyright (c) 2009-2012 JetBrains s.r.o. All rights reserved.
[10:42:52][Step 2/2]
@jakcharlton
jakcharlton / gist:2488614
Created April 25, 2012 09:54
Mock S3 for Paperclip
@your_model.should_receive(:save_attached_files).and_return(true)
@jakcharlton
jakcharlton / controller_spec.rb
Created April 25, 2012 09:32
More complete rspec controller test
before(:each) do
@organisation = create(:organisation, owner: subject.current_user)
@request.host = @organisation.subdomain + ".example.com"
subject.current_user.stub(:organisations).and_return([@organisation])
subject.current_user.stub_chain(:organisations, :find_by_id).and_return(@organisation)
end
describe "GET index" do
it "assigns all organisations as @organisations" do
@jakcharlton
jakcharlton / rspec.rb
Created April 25, 2012 09:26
Simple controller mock
it "assigns all organisations as @organisations" do
org = double(Organisation)
org.stub!(:all).and_return([org])
get :index, {}, valid_session
assigns(:organisations).should eq([org])
end
@jakcharlton
jakcharlton / How to Make Yourself Loved and Relevant.md
Created April 24, 2012 21:26
How to Make Yourself Loved and Relevant

How to Make Yourself Loved and Relevant

Developers are a curious breed.

For all sorts of reasons we tend to have significantly elevated opinions of our own worth and value to an organisation.

And certainly we hold a huge amount of power over them, but it's usually that they fear us rather than embrace us.

In yet another opinionated rant, I'll explore some of the reasons why developers are so distrusted and feared, and show you ways to make yourself loved and relevant.

describe ProgramsController do
let(:programs) { [mock_model(Program)] }
describe "GET index" do
it { should paginate(Program).with_default_per_page(30) }
describe "after pagination" do
before(:each) do
Program.stub(:paginate).and_return(programs)
get :index
@jakcharlton
jakcharlton / gist:2231536
Created March 28, 2012 23:35
Bamboo install
is is purely a status request
jvm 1 | 2012-03-29 10:34:29,120 INFO [qtp1601766488-19] [AccessLogFilter] 127
.0.0.1 POST http://localhost:8085/setup/finishsetup.action 155194kb
jvm 1 | 2012-03-29 10:34:29,122 INFO [qtp1601766488-19] [ExecAndWaitWithJSONS
tatusUpdateInterceptor] Bypassing a completed/not started action finishsetup, th
is is purely a status request
jvm 1 | 2012-03-29 10:34:31,127 INFO [qtp1601766488-17] [AccessLogFilter] 127
.0.0.1 POST http://localhost:8085/setup/finishsetup.action 155016kb
jvm 1 | 2012-03-29 10:34:31,129 INFO [qtp1601766488-17] [ExecAndWaitWithJSONS
tatusUpdateInterceptor] Bypassing a completed/not started action finishsetup, th
@jakcharlton
jakcharlton / Gemfile
Created March 13, 2012 07:51
Rails Lightweight Stack. Most of this is detailed on Crafting Rails Applications - http://pragprog.com/book/jvrails/crafting-rails-applications
source :rubygems
# We are not loading Active Record, nor Active Resources etc.
# We can do this in any app by simply replacing the rails gem
# by the parts we want to use.
gem "actionpack", "~> 3.2"
gem "railties", "~> 3.2"
gem "tzinfo"
# Let's use thin
@jakcharlton
jakcharlton / .gitignore
Created September 12, 2011 11:48
Git ignore for VS
*.obj
*.pdb
*.user
*.aps
*.pch
*.vspscc
*_i.c
*_p.c
*.ncb
*.suo