jekyll如何管理图片

http://otaku-elite.com/code/2012/01/31/managing-images-with-jekyll/

我们的目标是通过脚本生成如下图所示的目录结构:

The CSS Spy in action

首先在根目录建立images目录,把需要的图片存入这个文件夹内。

然后我们在Rakefile文件末添加下面代码。

    desc 'Move all images in images/ to the current date image directory'
    task :images do
      images = FileList['images/*.*']
      time = Time.new
      target = Rake.application.original_dir + time.strftime('/%Y/%m/%d/')
      #unless the file list is empty

      unless images.existing.empty?
          puts 'Cleaning images: ' + images.existing.to_s + ' => ' + target
          begin
            Dir::mkdir(target)
          rescue
          end
          mv images.existing, target
      end
    end

进入images目录,执行rake images,脚本会把图片移动到对应的日期目录文件夹下。

最后在编辑文件时,如下添加图片:

/images/2013/09/08/image004.png

google提供了一个工具,只要输入网址,就可以分析页面存在的问题

首先:打开谷歌在线验证页,输入我的首页URL,点击验证

http://developers.google.com/speed/pagespeed/insights/

google web tools 验证出好多问题,逐一解决:

一、 把不需要每次都加载的资源缓存到客户端。这个可以直接更改nginx的配置。

增加压缩gzip。减少带宽传输

server {
gzip  on;
gzip_http_version 1.1;
gzip_vary on;
gzip_comp_level 6;
gzip_proxied any;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; 
gzip_buffers 16 8k;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";		

增加缓存时间

location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {	
        proxy_pass http://172.16.11.154:4000;
        proxy_cache_min_uses 1;
        proxy_cache_valid 200 301 302 120m;
        proxy_cache_valid 404 1m;
        expires max;	
}

二、 合并压缩css

为了减少http请求次数,需要把多个css 文件和 js文件合并起来,利用yahoo的 YUI Compressor可以把多个ccs文件或者js文件合并成一个单一文件,降低请求次数。

http://refresh-sf.com/yui/

三、 最后一步

异步加载css和js ,TODO
异步加载评论模块(disqus),此模块为国外组织开发,每次打开都耗时极长。
可以调整为异步加载,当有客户需要评论是,按需打开评论模块。
但这个很矛盾,如果客户想评论时,这个时候点击评论,打开还是很慢的。
如果客户看完文章在评论,这个时候评论已经是打开状态,反而体验要好一点。
这个目前还没有别的方案。暂时先这样吧。

如何收纳蚊帐?

问题分析: image001

问题一、

纸箱子到处放的都是,用的时候不知道尺寸,需要一个一个翻,放的时候太随意,导致用的时候没法取。明知道蚊帐的箱子在家里,但就是找不到。 ## 问题二、 ##
原始箱子的好处,原始箱子经过精心设计,尺寸,大小,还有铁杆子防潮的塑料袋都是很好的。还不占地方,如果丢了就很不好找。
现在未合理利用的空间
阳台和客厅的鱼缸都可以存储东西,但是如果把东西直接放在浴缸中,不美观。
阳台太乱。没有规划。阳台需要晾衣服,不能放太多东西。
纸箱子需要重新规划 ,最好把功能性的盒子收纳好后记在笔记中。在笔记中列一个条目。 ## 问题三、 ##
纸盒子放在沙发下并不很好?但是放在别的地方还没想好。要是像农村一样有个二层楼就好了。这种东西都可以放在楼上。

public class HelloWorld {
    public static void main(String args[]) {
      System.out.println("Hello World!");
    }
}

The C shell provides the following built-in commands:

# Marks a command.
alias Displays alias.
bg Resumes job in the background.
break Resumes execution after the loop.
breaksw Breaks from a switch command; resumes after the endsw command.
case Defines a label in a switch command.
cd Changes directory.
chdir Changes directory, same as cd.
continue Continues a loop.
default Specifies the default case in a switch.
dirs Displays the directory stack.
echo Writes arguments to the standard output of the shell.
eval Evaluates a command.
exec Executes the command in the current shell.
exit Exits the shell.
fg Brings a job in the foreground.
foreach Specifies a looping control statement and execute a sequence of commands until reaching an end command.
glob Writes arguments to the standard output of the shell, like the echo command, but without the new line.
goto Continues execution after the specified label.
hashstat Displays hash table statistics.
history Displays the history list.
if Executes a command if condition met.
jobs Lists active jobs.
kill Sends a signal to a process. term (terminate) is the default signal.

limit

Sets or list system resource limits.
login Logs on.
logout Logs out.
nice Changes the priority of commands run in the shell.
nohup Ignores the hangup signal.

notify

Notifies the user about changes in job status.
onintr Tells the shell what to do on interrupt.
popd Pops the top directory off the directory stack and changes to the new top directory.
pushd Exchanges the top two elements of the directory stack.
rehash Re-computes the hash table of the contents of the directories in the path shell variable.

repeat

Repeats the execution of a command.
set Displays or set the value of a shell variable.
setenv Sets environment variables.
shift Shifts shell arguments.
source Reads commands from a script.

stop

Stops a background job.
suspend Stops the current shell.
switch Starts a switch.
time Displays the time used to execute commands.
umask Shows or set file permissions.

unalias

Removes command alias.
unhash Disables the internal hash table.
unlimit Removes limitations on system Resource.
unset Deletes shell variables.
unsetenv Deletes environment variables.
wait Waits for background jobs to complete.

while …end

Executes the commands between the while and matching end statements repeatedly.
@ Displays or set the values of all the shell variables.