This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'active_record' | |
def temporary_table_class(name, sql = nil, primary_key: nil, &block) | |
name = name.to_s.tableize | |
if block | |
ActiveRecord::Schema.define do | |
create_table(name, :temporary => true, &block) | |
end | |
elsif sql |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>org.jenkins-ci.node.plist</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>/usr/bin/java</string> | |
<string>-Dfile.encoding=UTF-8</string> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# vim: ft=ruby | |
# Run me with: | |
# ovservr build.observr | |
# ovservr については https://github.com/kevinburke/observr | |
require 'terminal-notifier-guard' | |
def notify(message, succeeded = true) | |
type = succeeded ? "success" : "failed" | |
system("terminal-notifier-#{type} -message '#{message}' -title 'Docker'") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! | |
VAGRANTFILE_API_VERSION = "2" | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
config.vm.box = "centos65-x86_64-20131205" | |
config.vm.box_url = "https://github.com/2creatives/vagrant-centos/releases/download/v6.5.1/centos65-x86_64-20131205.box" | |
#config.vm.network :public_network, ip: "192.168.1.99", bridge: "en0: Ethernet" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'json' | |
require 'msgpack' | |
print JSON.load(ARGF.read).to_msgpack |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'hashie' | |
require 'pry' | |
class CoercionError < StandardError; end | |
class ValueCoercer | |
def initialize(name, klass) | |
@name = name | |
@klass = klass | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def define_print_routes(sinatra_class) | |
def sinatra_class.print_routes(io = $stdout) | |
routes.each do |verb, signatures| | |
next if verb == "HEAD" | |
signatures.each do |signature| | |
path = signature.first.source | |
path.gsub!(/(\A\\A|\\z\z)/, '') | |
puts "%-6s %s" % [verb, path] | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module AttrAccessorWithDefault | |
extend ActiveSupport::Concern | |
module ClassMethods | |
def attr_accessor_with_default(key, &block) | |
define_method(key) do | |
instance_variable_get("@#{key}") || instance_eval(&block) | |
end | |
define_method("#{key}=") do |v| | |
instance_variable_set("@#{key}", v) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
agrant.configure("2") do |config| | |
# ... 省略されています | |
config.vm.network :public_network, ip: "192.168.1.10", bridge: "en0: Ethernet" | |
config.vm.provision :chef_solo do |chef| | |
chef.json = { | |
:route => { | |
:gateway => '192.168.1.1' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -u username https://api.github.com/orgs/organizationname/members | jq '.[].login' |