Skip to content

Instantly share code, notes, and snippets.

Avatar

Yanping Chen yanping

View GitHub Profile
@yanping
yanping / generate_archives.rb
Created Nov 27, 2011 — forked from stympy/generate_archives.rb
Archive generator plugin for jekyll
View generate_archives.rb
# Jekyll archive page generator with pagination.
#
# Based on the category generator from
# http://recursive-design.com/projects/jekyll-plugins/,
# which is copyright (c) 2010 Dave Perrett,
# http://recursive-design.com/ and is licensed under the MIT
# license (http://www.opensource.org/licenses/mit-license.php), and
# on the pagination code from Jekyll itself.
#
# This code is copyright (c) 2011 Benjamin Curtis, and is licensed
@yanping
yanping / error_shell.sh
Created Dec 1, 2011
Why I couldn't generate the Octopress blog
View error_shell.sh
root@ypchen-ubuntu:~/octopress# rake generate
## Generating Site with Jekyll
unchanged sass/screen.scss
/usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych.rb:148:in `parse': couldn't parse YAML at line 20 column 0 (Psych::SyntaxError)
from /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych.rb:148:in `parse_stream'
from /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych.rb:119:in `parse'
from /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych.rb:106:in `load'
from /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych.rb:205:in `load_file'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/jekyll-0.11.0/lib/jekyll.rb:119:in `configuration'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/jekyll-0.11.0/bin/jekyll:207:in `<top (required)>'
View default.html
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title> {% if page.title %} {{ page.title }} | {% endif %} John Doe, Photographer </title>
<link rel="stylesheet" href="/css/styles.css" />
</head>
<body>
<div id="main">
View if statement
{{ page.title }}{% if page.title %} | {% endif %}
View portfolio_entry.html
---
layout: default
---
<h2 class="content">{{page.title}}</h2>
<img src="{{ page.image }}" />
{{ content }}
View index.html
---
layout: default
title: Portfolio
---
<section class="content">
<h2>Portfolio</h2>
<p>Check out my images below!</p>
</section>
View table_test.html
<table border="1">
<tr>
<th>ID</th><th>Name</th><th>Rank</th>
</tr>
<tr>
<td>1</td><td>Tom Preston-Werner</td><td>Awesome</td>
</tr>
<tr>
<td>2</td><td>Albert Einstein</td><td>Nearly as awesome</td>
</tr>
View save-old-installed-packages.r
oldip <- installed.packages()[ ,1]
save(oldip, file="path/installedPackages.Rdata")
View install-new-packages.r
load("path/installedPackages.Rdata")
newip <- installed.packages()[,1]
for(i in setdiff(oldip, newip))
install.packages(i)
@yanping
yanping / Rprofile.site
Created Jan 9, 2012
Sample Rprofile.site file
View Rprofile.site
# 设置常用选项
options(papersize="a4")
options(editor="notepad")
options(pager="internal")
options(tab.width = 2)
options(width = 130)
options(graphics.record=TRUE)
options(show.signif.stars=FALSE)
# 设置R交互提示信息
You can’t perform that action at this time.