Single core
cat /dev/zero > /dev/null
Multiple cores (1 2 3 4 - change as needed)
for i in 1 2 3 4; do while : ; do : ; done & done
docker volume ls | cut -d' ' -f16 | xargs docker volume rm |
# For use case and usage notes, see https://coderwall.com/p/wvsndw/directory-specific-bash-aliases | |
function on_leave_dir() { | |
if [ -e .aliases ]; then | |
export OLD_ALIAS_DIR="$PWD" | |
fi | |
} | |
function on_enter_dir() { | |
if [ -n "$OLD_ALIAS_DIR" ] && ! is_subdirectory "$PWD" "$OLD_ALIAS_DIR" ; then |
FROM atlashealth/ruby:2.1.2 | |
ENV DEBIAN_FRONTEND noninteractive | |
# Install any dependencies needed by Rails | |
RUN apt-get update -q && \ | |
apt-get install -qy curl libpq-dev libqt4-dev xvfb imagemagick --no-install-recommends && \ | |
# install Node for asset minification | |
curl -sL https://deb.nodesource.com/setup | bash - && \ |
# RSpec matcher to spec delegations. | |
# | |
# Usage: | |
# | |
# describe Post do | |
# it { should delegate(:name).to(:author).with_prefix } # post.author_name | |
# it { should delegate(:month).to(:created_at) } | |
# it { should delegate(:year).to(:created_at) } | |
# end | |
RSpec::Matchers.define :delegate do |method| |
require 'rubygems' | |
ENV["RAILS_ENV"] ||= 'test' | |
require File.expand_path("../../config/environment", __FILE__) | |
require 'rspec/rails' | |
require 'capybara/rspec' | |
require 'capybara/rails' | |
require 'database_cleaner' | |
require 'email_spec' | |
# uncomment if you're using Sidekiq |
# config/initializers/mail.rb | |
ActionMailer::Base.register_interceptor(MailInterceptor) if Rails.env.staging? |
class TelapiResponsesController < ApplicationController | |
skip_before_filter :verify_authenticity_token | |
def show | |
xml = Telapi::InboundXml.new do | |
Say('Hi there', :loop => 3, :voice => 'man') | |
Say('Hello, my name is Sally.', :voice => 'woman') | |
Say('Now I will not stop talking.', :loop => 0) | |
end |
Rack::Utils.parse_nested_query("foo=bar&ale=good").symbolize_keys | |
# => {:ale=>"good", :foo=>"bar"} | |
# Compared to CGI.parse approach: | |
CGI.parse("foo=bar&ale=good").symbolize_keys | |
# => {:ale=>["good"], :foo=>["bar"]} |
city = 'San Francisco' | |
state = 'CA' | |
[city, state].compact * ', ' | |
# => 'San Francisco, CA' | |
city = nil | |
state = 'CA' | |
[city, state].compact * ', ' | |
# => 'CA' |