Skip to content

Instantly share code, notes, and snippets.

View .drone.yml
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
View agent-deployment.yml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: agent
spec:
replicas: 1
template:
metadata:
labels:
name: agent
View drone-server.yml
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 Sep 3, 2015 — forked from olalonde/docker-machine-use-nfs.sh
Use NFS instead of vboxsf in Docker Machine
View docker-machine-use-nfs.sh
#!/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 Aug 29, 2015
Highlight code for keynote
View higlight.md

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

View initializer.rb
Tod.configure do |config|
config.repo = TasksRepository::ActiveRecord
end
View active_record.rb
class TasksRepository::ActiveRecord
def persist(task_entity)
task = Task.create({ title: task_entity.title })
serialize task
end
def count
Task.count
end
View in_memory.rb
module Tod
module TasksRepository
class InMemory
def initialize
@tasks = {}
@id = 0
end
def persist(task)
@id += 1
View task.rb
module Tod
module Entities
class Task
attr_accessor :id
attr_reader :title
def initialize(title: '')
@title = title
end
View add_task.rb
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
You can’t perform that action at this time.