Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
feythin committed Jan 7, 2013
0 parents commit 0918258
Show file tree
Hide file tree
Showing 68 changed files with 7,765 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
run: compile
jekyll --server
compile:
lessc --compress css/screen.less > css/screen.css
jekyll
cp _site/index_src.html index.html
cp _site/archives/tags_src.html archives/tags.html
upload: compile
git add .
echo "Enter commit message: "
git commit -a -m "post"
git push


14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
THIS IS MY PERSONAL BLOG
========================

This blog is forked from [mojombo.github.com](https://github.com/mojombo/mojombo.github.com)

License
-------
The following directories and their contents are Copyright Sheimi.
You may not reuse anything therein without my permission:

* _posts/
* images/

All other directories and files are MIT Licensed. Feel free to use the HTML and CSS as you please.
3 changes: 3 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
markdown: rdiscount
pygments: true
paginate: 5
81 changes: 81 additions & 0 deletions _layouts/default.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>{{ page.title }}</title>
<meta name="author" content="Liufeiyu" />
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<!-- syntax highlighting CSS -->
<link rel="stylesheet" href="/en/css/syntax.css" type="text/css" />
<!-- Homepage CSS -->
<link rel="stylesheet" href="/en/css/screen.css" type="text/css" media="screen, projection" />
<script src="/en/js/jquery-1.7.1.min.js"></script>
<script src="/en/js/modernizr.js"></script>
</head>
<body>
<header class="header">
<h1><a href="/en/" title="Home">Liufeiyu's Hive</a></h1>
<div class="container sdw"></div>
</header>
<section class="container about">
<h4>
<span><a href="/en/">Home</a></span>
</h4>
<hr>
</section>
<section class="container main-content row">
<section class="site-main span9 offset1">
{{ content }}
</section>
</section>
<footer class="footer">
<div class="container">
<div class="row">
<section class="contact span3">
<p>
Liufeiyu | Student of <br>
<a href="http://www.uestc.edu.cn/">University of Electronic Science and Technology of China</a><br>
<a href="http://www.ccse.uestc.edu.cn/">School of Computer Science & Engineering</a><br>
</p>
</section>
<section class="contact span3">
<p>
Weibo: <a href="http://weibo.com/feiyuliu">@SolrJ</a><br>
Email: <a href="[email protected]">[email protected]</a><br>
</p>
</section>
<section class="copyleft span3">
<p>
Copyleft&copy; <a href="http://liufeiyu.cn/">Liufeiyu's Hive</a><br>
Forked from <a href="https://github.com/mojombo/mojombo.github.com">mojombo.github.com</a><br>
Modified by Liufeiyu <br>
</p>
</section>
<!--
<section class="rss span2 offset1">
<a href="http://feeds.feedburner.com/sheimi-hive">
<img src="/images/rss.png" alt="Subscribe to RSS Feed">
</a>
</section>
-->
</div>
</div>
</footer>

<script src="/en/js/global.js"></script>
<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-29300274-1']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

</script>

</body>
</html>
45 changes: 45 additions & 0 deletions _layouts/post.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
layout: default
---

<article id="post">

<h1><a href="{{page.url}}">{{ page.title }}</a></h1>
<section class="meta">
<div class="inline">
<span class="date">{{page.date | date_to_string}}</span><span>At {{page.meta.location}}</span>
</div>
</section>
<section class="content">
{{ content }}
<p>~~~ That's All ~~~ *^o^* ~~~<p>
</section>
<section class="end-tag">
<span class="author">Posted by Sheimi</span>
<span class="tags">
Tags:
{% for tag in page.tags %}
{% if forloop.index != 1 %}
:
{% endif %}
<a href="/en/archives/tags.html#{{tag}}">{{tag}}</a>
{% endfor %}
</span>
</section>
</article>
<hr>
<div id="disqus_thread"></div>
<script src="/en/js/disqus.js"></script>
<hr>
<div id="related">
<h2>Related Posts</h2>
<ul class="posts">
{% for post in site.related_posts limit:3 %}
<li class="row">
<span class="span2">{{ post.date | date_to_string }} &raquo;</span>
<span class="span4 offset1"><a href="{{ post.url }}">{{ post.title }}</a></span>
</li>
{% endfor %}
</ul>
</div>
<hr>
16 changes: 16 additions & 0 deletions _layouts/resume.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Resume</title>
<meta name="author" content="Liufeiyu" />
<link rel="stylesheet" href="/en/css/resume.css" type="text/css" media="all"/>
<link rel="stylesheet" href="/en/css/resume-print.css" type="text/css" media="print"/>
</head>
<body>
{{content}}
<div class="footer update">
Last Update: {{page.update}}
</div>
</body>
</html>
66 changes: 66 additions & 0 deletions _plugins/html_filters.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# encoding: utf-8
require 'rubygems'
require 'nokogiri'

module Liquid
module StandardFilters

def truncatehtml(raw, max_length = 15, continuation_string = "...")
doc = Nokogiri::HTML(Iconv.conv('UTF8//TRANSLIT//IGNORE', 'UTF8', raw))
current_length = 0;
deleting = false
to_delete = []

depth_first(doc.children.first) do |node|

if !deleting && node.class == Nokogiri::XML::Text
current_length += node.text.length
end

if deleting
to_delete << node
end

if !deleting && current_length > max_length
deleting = true

trim_to_length = current_length - max_length + 1
node.content = node.text[0..trim_to_length] + continuation_string
end
end

to_delete.map(&:remove)
doc.children.children.inner_html
end

private

def depth_first(root, &block)
parent = root.parent
sibling = root.next
first_child = root.children.first

yield(root)

if first_child
depth_first(first_child, &block)
else
if sibling
depth_first(sibling, &block)
else
# back up to the next sibling
n = parent
while n && n.next.nil? && n.name != "document"
n = n.parent
end

# To the sibling - otherwise, we're done!
if n && n.next
depth_first(n.next, &block)
end
end
end
end

end
end
105 changes: 105 additions & 0 deletions _plugins/tag-cloud.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# Copyright (C) 2011 Anurag Priyam - MIT License

module Jekyll

# Jekyll plugin to generate tag clouds.
#
# The plugin defines a `tag_cloud` tag that is rendered by Liquid into a tag
# cloud:
#
# <div class='cloud'>
# {% tag_cloud %}
# </div>
#
# The tag cloud itself is a collection of anchor tags, styled dynamically
# with the `font-size` CSS property. The range of values, and unit to use for
# `font-size` can be specified with a very simple syntax:
#
# {% tag_cloud font-size: 16 - 28px %}
#
# The output is automatically formatted to use the same number of decimal
# places as used in the argument:
#
# {% tag_cloud font-size: 0.8 - 1.8em %} # => 1
# {% tag_cloud font-size: 0.80 - 1.80em %} # => 2
#
# Tags that have been used less than a certain number of times can be
# filtered out from the tag cloud with the optional `threshold` parameter:
#
# {% tag_cloud threshold: 2%}
#
# Both the parameters can be easily clubbed together:
#
# {% tag_cloud font-size: 50 - 150%, threshold: 2%}
#
# The plugin randomizes the order of tags every time the cloud is generated.
class TagCloud < Liquid::Tag
safe = true

# tag cloud variables - these are setup in `initialize`
attr_reader :size_min, :size_max, :precision, :unit, :threshold

def initialize(name, params, tokens)
# initialize default values
@size_min, @size_max, @precision, @unit = 70, 170, 0, '%'
@threshold = 1

# process parameters
@params = Hash[*params.split(/(?:: *)|(?:, *)/)]
process_font_size(@params['font-size'])
process_threshold(@params['threshold'])

super
end

def render(context)
# get an Array of [tag name, tag count] pairs
count = context.registers[:site].tags.map do |name, posts|
[name, posts.count] if posts.count >= threshold
end

# clear nils if any
count.compact!

# get the minimum, and maximum tag count
min, max = count.map(&:last).minmax

# map: [[tag name, tag count]] -> [[tag name, tag weight]]
weight = count.map do |name, count|
# logarithmic distribution
weight = (Math.log(count) - Math.log(min))/(Math.log(max) - Math.log(min))
[name, weight]
end

# shuffle the [tag name, tag weight] pairs
weight.sort_by! { rand }

# reduce the Array of [tag name, tag weight] pairs to HTML
weight.reduce("") do |html, tag|
name, weight = tag
size = size_min + ((size_max - size_min) * weight).to_f
size = sprintf("%.#{@precision}f", size)
html << "<a style='font-size: #{size}#{unit}' href='/archives/tags.html##{name}'>#{name}</a>\n"
end
end

private

def process_font_size(param)
/(\d*\.{0,1}(\d*)) *- *(\d*\.{0,1}(\d*)) *(%|em|px)/.match(param) do |m|
@size_min = m[1].to_f
@size_max = m[3].to_f
@precision = [m[2].size, m[4].size].max
@unit = m[5]
end
end

def process_threshold(param)
/\d*/.match(param) do |m|
@threshold = m[0].to_i
end
end
end
end

Liquid::Template.register_tag('tag_cloud', Jekyll::TagCloud)
28 changes: 28 additions & 0 deletions about/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
layout: default
title: About
---
<article id="about">
<section id="about-site">
<h2>About This Site</h2>
This site will include the following things:
</section>
<section id="about-me">
<h2>About Me</h2>
<ul>
<li class="more-info">For more information, <a href="/en/about/resume.html">here is my resume</a>, <a href="/en/about/resume_cn.html">中文简历</a></li>
<li class="row"><label class="span2">Online Name:</label><span class="span5">Liufeiyu</span></li>
<li class="row"><label class="span2">Gender:</label><span class="span5">Male</span></li>
<li class="row"><label class="span2">Birthday:</label><span class="span5">03-23</span></li>
<li class="row"><label class="span2">Hometown:</label><span class="span5">Wuxue, Huanggang, Hubei, China</span></li>
<li class="row">
<label class="span2">Education:</label>
<ul id="education" class="span5">
<li><span class="time">2010- now </span> <a href="http://www.ccse.uestc.edu.cn/">School of Computer Science & Engineering</a>, <a href="http://www.uestc.edu.cn/">University of Electronic Science and Technology of China</a></li>
<li><span class="time">2006 - 2010</span> <a href="http://www.wfu.edu.cn/">WeiFang University</a></li>
</ul>
</li>
</ul>
</section>
</article>

15 changes: 15 additions & 0 deletions about/notes.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
layout: default
title: Liufeiyu's Hive
---

<div id="home">
<h1>Notes</h1>
<ul class="posts">
{% for post in site.posts %}
{% if post.category == 'note' %}
<li><span>{{ post.date | date_to_string }}</span> &raquo; <a href="{{ post.url }}">{{ post.title }}</a></li>
{% endif %}
{% endfor %}
</ul>
</div>
Loading

0 comments on commit 0918258

Please sign in to comment.