Vagrant Multiple Box Config

Vagrant Multiple Box Config

随着不同框架的不同技术栈,导致一个Vagrant Box显然无法适应所有情况.所以多Box设置势在必行,Google后整理结果如下:

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

    config.vm.define "magento" do |web|
        web.vm.box = "ubuntu/xenial64"
        web.vm.hostname = 'magento'

        web.vm.network "private_network", ip: "192.168.33.11"

        web.vm.provider :virtualbox do |v|
            v.customize ["modifyvm", :id, "--memory", "2048"]
            v.customize ['modifyvm', :id, '--natdnshostresolver1', 'on']
            v.customize ['modifyvm', :id, '--natdnsproxy1', 'on']
        end
    end


    config.vm.define "php" do |php|
        php.vm.box = "ubuntu/trusty64"
        php.vm.hostname = 'php'

        php.vm.network :private_network, ip: "192.168.33.10"

        php.vm.provider :virtualbox do |v|
            v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
            v.customize ['modifyvm', :id, '--natdnsproxy1', 'on']
            v. memory = 1024 
        end
    end
    
end

感谢Scott Keck-Warren的文章,简单粗暴直接的解决问题.

展开阅读

图片处理利器 ImageMagic

图片处理利器 ImageMagic

ImageMagick is a suite of command-line utilities for modifying and working with images. ImageMagick can quickly perform operations on an image from a terminal, perform batch processing of many images, or be integrated into a bash script.

日常开发工作需要经常处理图片,作为一名程序员绝壁不能忍受GUI工具一个一个的处理,遂搜索一番,发现这货ImageMagic,果然是处理图片的神器.

开发中最需要的几个功能,更改图片尺寸,更改图片格式及批处理,命令行如下:

展开阅读

[DogFooding] WordPress AJAX Contact Form&Email Part I

[DogFooding] WordPress AJAX Contact Form&Email Part I

"Eating your own dog food"是科技公司最常见的一个态度,在WordPress开发中也应该遵循这种哲学,所谓插件一时爽,性能一团糟.个人认为插件最大的两个弊端一是添加依赖,二是降低性能.每次打开Firebug的时候,那画面简直太美不敢看.所以这次下定决心从最常见的功能Contact Form入手,彻底告别各种插件.

Contact Form的整体流程

  1. HTML - Bootstrap HTML Form

    展开阅读