View .kitchen.yml
---
driver_plugin: vagrant
provisioner: chef_zero
driver_config:
require_chef_omnibus: 11.6.0
http_proxy: http://10.0.3.1:8123
https_proxy: https://10.0.3.1:8123
provider: lxc
platforms:
View 1-without_callbacks.rb
# uses exception-throwing !-methods in lower level code to communicate errors
class ApiController < ApplicationController
def update
publisher = PublishingService.new
publisher.update(params[:article], params[:author])
render_success
rescue => e
render_failure("Failed to publish article: #{e.message}")
end
View prime_factors_2_spec.rb
module PrimeFactors
def decompose(number)
if number <= 3
[number]
else
prime_factors = []
(2..number / 2).each do |prime|
while(number % prime).zero? do
number = number / prime
prime_factors << prime
View custom_server.rb
include_recipe "sample_app::_group"
include_recipe "sample_app::_user"
include_recipe "apt::add_company_repository"
include_recipe "sample_app::_server_install_from_package"
include_recipe "sample_app::_server_runit"
include_recipe "sample_app::_server_config"
View database.tddium.yml
foo: &foo
adapter: <%= ENV['TDDIUM_DB_ADAPTER'] %>
database: <%= ENV['TDDIUM_DB_NAME'] %>
username: <%= ENV['TDDIUM_DB_USER'] %>
password: <%= ENV['TDDIUM_DB_PASSWORD'] %>
<%= "socket: #{ENV['TDDIUM_DB_SOCKET']}" if ENV['TDDIUM_DB_SOCKET'] %>
development: &development
adapter: <%= ENV['TDDIUM_DB_ADAPTER'] %>
database: <%= ENV['TDDIUM_DB_NAME'] %>
View gist:1397967
# in Rails
class BarCollection
def initialize
@bars = [Bar.new, Bar.new]
end
def get_bars
@bars
end
end
View exported_resources.feature
Feature: storeconfigs
Scenario: export resource
Given a node of class "exporting"
When I compile its catalog
Then it should export a resource "File[foo]"
Scenario: collect resource
Given a node of class "collecting"
And an exported resource "File[bar]"
View pomodoro.lua
-- pomodoro timer widget
pomodoro = {}
-- tweak these values in seconds to your liking
pomodoro.pause_duration = 300
pomodoro.work_duration = 1200
pomodoro.pause_title = "Pause finished."
pomodoro.pause_text = "Get back to work!"
pomodoro.work_title = "Pomodoro finished."
pomodoro.work_text = "Time for a pause!"
View category_list.rb
# place this file in your plugins directory and add the tag to your sidebar
#$ cat source/_includes/custom/asides/categories.html
#<section>
# <h1>Categories</h1>
# <ul id="categories">
# {% category_list %}
# </ul>
#</section>
module Jekyll