Kris Leech krisleech

View 01-initial-server-side-render.html
1 2 3 4 5 6 7 8 9 10
<div id="results">
<div class="result" data-result-id='1'>
<div data-attr="title">Result 1</div>
</div>
<div class="result" data-result-id='2'>
<div data-attr="title">Result 2</div>
</div>
<div class="result" data-result-id='3'>
View grab
1 2 3 4 5 6 7
#!/usr/bin/env bash
 
HOST=localhost:3000
 
webkit2png -F -o page1 "http://${HOST}/..."
webkit2png -F -o page2 "http://${HOST}/..."
webkit2png -F -o page3 "http://${HOST}/..."
View comp-fails
1 2 3 4 5 6 7 8 9 10
#!/usr/bin/env bash
 
# manual steps
# Download raw output of master cuke to master-cuke-ci.raw as plain text
# Download raw output of another cuke branch to branch-cuke-js.raw as plain text
 
set -e
 
MASTER_RAW_FILE=master-cukes-ci.raw
BRANCH_RAW_FILE=branch-cukes-ci.raw
View 00-register_interest_controller.rb
1 2 3 4 5 6 7 8 9
class RegisterInterestController < ApplicationController
skip_before_filter :ensure_logged_in
 
def create
@interest_form = RegisterInterest::InterestForm.new(form_params)
register_interest = RegisterInterest.new
register_interest.subscribe(EventResponser.new(self))
register_interest.with_form(@interest_form)
end
View 00-helper.rb
1 2 3 4 5 6 7 8 9
class MyPresenter
def initialize(user)
@user = user
end
 
def admin_only(&block)
yield if user.admin?
end
end
View 01-interactor.rb
1 2 3 4 5 6 7 8 9 10
# without new Wisper feature:
 
# interactor
class CreateDelivery
include Wisper::Publisher
# alternative constructor which also adds some listeners
def self.with_default_listeners
new.tap(&:add_default_listeners)
end
View anniversary.rb
1 2 3 4 5 6 7 8 9
def anniversary_of(date)
this_year = Date.today.year
_date = Date.parse("#{date.day}-#{date.month}-#{this_year}")
if _date < Date.today
_date + 1.year
else
_date
end
end
View gems_from_git.rb
1 2 3
Bundler::LockfileParser.new(Bundler.read_file(Rails.root.join("Gemfile.lock"))).dependencies
.reject { |dep| dep.source.nil? }
.map { |dep| [dep.name, dep.source.path.to_s.split('-').last] }
View Vagrantfile
1 2 3 4 5 6 7 8 9 10
raise "Set CHEF_PATH to the root of the build-server project" unless ENV['CHEF_PATH']
 
CHEF_ROOT = Pathname(ENV['CHEF_PATH'])
 
vagrant_json = JSON.parse(CHEF_ROOT.join('nodes', 'vagrant.json').read)
 
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = [CHEF_ROOT.join('site-cookbooks'), CHEF_ROOT.join('cookbooks')]
chef.roles_path = CHEF_ROOT.join('roles')
chef.data_bags_path = CHEF_ROOT.join('data_bags')
View 01-Vagrantfile
1 2 3 4 5 6 7
vagrant_json = JSON.parse(Pathname(__FILE__).dirname.join('nodes', 'vagrant.json').read)
 
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = ["site-cookbooks", "cookbooks"]
chef.json.merge!(vagrant_json)
chef.add_recipe "default"
end
Something went wrong with that request. Please try again.