Skip to content

Instantly share code, notes, and snippets.

pipeline:
build:
image: ruby:2.4.2
commands:
- bundle install
- bundle exec rspec spec
slack:
image: plugins/slack
channel: codebuilds
webhook: https://hooks.slack.com/services/xxx
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: agent
spec:
replicas: 1
template:
metadata:
labels:
name: agent
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: server
spec:
replicas: 1
template:
metadata:
labels:
name: server
@bezelga
bezelga / docker-machine-use-nfs.sh
Last active September 3, 2015 01:26 — forked from olalonde/docker-machine-use-nfs.sh
Use NFS instead of vboxsf in Docker Machine
#!/bin/bash
#
# This script will mount /Users in the boot2docker VM using NFS (instead of the
# default vboxsf). It's probably not a good idea to run it while there are
# Docker containers running in boot2docker.
#
# Usage: sudo ./boot2docker-use-nfs.sh
#
@bezelga
bezelga / higlight.md
Last active August 29, 2015 14:15
Highlight code for keynote

highlight --font-size 20 --font Inconsolata --style fine_blue -W -J 140 --src-lang ruby -O rtf highlight.rb | pbcopy

Tod.configure do |config|
config.repo = TasksRepository::ActiveRecord
end
class TasksRepository::ActiveRecord
def persist(task_entity)
task = Task.create({ title: task_entity.title })
serialize task
end
def count
Task.count
end
module Tod
module TasksRepository
class InMemory
def initialize
@tasks = {}
@id = 0
end
def persist(task)
@id += 1
module Tod
module Entities
class Task
attr_accessor :id
attr_reader :title
def initialize(title: '')
@title = title
end
module Tod
module UseCases
class AddTask
def self.add(title)
task = Entities::Task.new(title: title)
if task.valid?
Tod.repo.persist(task)
else
false