Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I may be slow to respond.

Andor Chen AndorChen

💭
I may be slow to respond.
View GitHub Profile
@AndorChen
AndorChen / .gemrc
Created Nov 5, 2011
Howto Setting Up Rails Production Environment on VPS
View .gemrc
---
:verbose: true
:bulk_threshold: 1000
install: --no-ri --no-rdoc --env-shebang
:source:
- http://rubygems.org
- http://gemcutter.org
- http://gems.rubyforge.org/
- http://gems.github.com
:benchmark: false
@AndorChen
AndorChen / README.markdown
Created Nov 17, 2011
Howto Depoly Rails App to VPS
View README.markdown

#如何将 Rails 应用程序部署到 VPS 上

如果已经在 VPS 上假设好了 Rails 生产环境,接下来就可以将部署应用程序了。

###需要用到的工具


View README.markdown

#link 没有 charset 属性

相信不少人都见过下面的 link 代码片段:

<link rel="stylesheet" href="stylesheet.css" type="text/css" charset="utf-8" />

其中比较陌生的是 charset 属性。在 [HTML 4.01 的规范文档中][1]有这样的记述:

@AndorChen
AndorChen / jquery.html5.placeholder.js
Created Dec 9, 2011
jQuery HTML5 Placeholder fix
View jquery.html5.placeholder.js
/**
* jQuery.HTML5 placeholder - Placeholder plugin for input fields
* Written by Ludo Helder (ludo DOT helder AT gmail DOT com)
* Licensed under the WTFPL (http://sam.zoy.org/wtfpl/).
* Date: 2010/11/18
*
* @author Ludo Helder
* @version 1.0.1
*
**/
@AndorChen
AndorChen / README.textile
Created Dec 16, 2011
What fonts and charset do you use?
View README.textile

一些站点使用的字体统计

站点 html lang 编码 字体定义
Google utf-8 font-family: arial,sans-serif; font-size: small;
百度 gb2312 font: 12px arial;
必应 en utf-8 font-family: Arial,Sans-Serif; font-size: small;
MSN中文网 utf-8 font-family: Tahoma, 宋体, sans-serif;
搜狐 zh-CN GBK font: 12px '宋体';
搜狐微博 GBK font: normal 12px/1.667 Tahoma,Arial,"宋体b8b\4f53",sans-serif;
新浪 gb2312 font: 12px "SimSun","宋体","Arial Narrow";
View functions.php
<?php
add_action('after_setup_theme', 'ac_theme_setup');
function ac_theme_setup(){
// 自定义导航菜单
register_nav_menu('top', '顶部菜单');
}
?>
@AndorChen
AndorChen / functions.php
Created Jan 17, 2012
Add Links to WordPress 3.3 New Toolbar
View functions.php
<?php
/**
* Add Links to WP3.3+ New Toolbar
*
*/
add_action('admin_bar_menu', 'add_toolbar_items', 100);
function add_toolbar_items($admin_bar) {
// Top level menu
$admin_bar->add_menu( array(
'id' => 'my-item',
View fonts.css
/*
Prince - Fonts stylesheet
http://www.princexml.com
*/
/* standard "serif" font family */
@font-face {
font-family: serif;
src: local("Arial Unicode MS") /* last resort font */
View Rakefile
require 'fileutils'
# Usage: rake duokanify file=path/to/sample.epub
desc 'Adds dtb:depth to ncx file in an ePub'
task :duokanify do
unless ENV['file']
abort("ERROR: Please provide the ePub file path!\nexit")
end
unless ENV['file'].end_with?('.epub')
View pandocfilter.rb
require 'json'
class String
def camelize
string = self
string.split('_').map(&:capitalize).join('')
end
end
module PandocFilter