Skip to content

Instantly share code, notes, and snippets.

View rainux's full-sized avatar

Rainux Luo rainux

View GitHub Profile
@rainux
rainux / packages
Created September 27, 2010 21:55
My favorite Arch Linux packages
anthy
chmsee
chromium
cmus
colordiff
colorgcc
ctags
evince
fam
ffmpeg
(function($) {
$.fn.draggable = function() {
var move = $.proxy(function(event) {
if (this.data('mouseMove')) {
var changeX = event.pageX - this.data('mouseX');
var changeY = event.pageY - this.data('mouseY');
var newX = parseInt(this.css('left')) + changeX;
@rainux
rainux / README.markdown
Created April 23, 2010 19:36
Grab latest Angel Beats from bbs.sumisora.com automatically

说明

此脚本用于从澄空学园(bbs.sumisora.com)自动下载当天发布的 Angel Beats。运行后将会每隔 10 分钟检查是否有当天发布的种子,直到找到后获取种子并调用外部 BT 工具完成下载。在 Windows 里运行会使用系统默认的 BT 下载工具(关联 .torrent 文件的程序);Linux / Mac OS X 里则是使用 transmission,可以修改脚本最后一行改成你使用的其它工具。

由于澄空学园需要登录才能下载种子附件,因此运行此脚本需要一个澄空学园的账户。如果担心账户安全,你可以使用任何新创建的马甲账户。

为什么这点小事都要写脚本来完成?因为 Angel Beats 是周五夜间播放,澄空周六早晨就会发布中文字幕版本。而我想要周六中午醒来立即就能观看,如此而已。

安装运行环境以及依赖库

@rainux
rainux / Gemfile
Created March 17, 2010 09:47 — forked from samgranieri/Gemfile
How to get Rails 2.3.5 working with bundler 0.9.3
source :gemcutter
gem 'rails', '~> 2.3.5', :require => nil
@rainux
rainux / find_reachable.exe
Created March 8, 2010 14:33
Find out reachable IP addresses for given host.
@rainux
rainux / gist:325129
Created March 8, 2010 12:40 — forked from rails/gist:58761
Rails DateHelper (partially) ported to Javascript.
var DateHelper = {
// Takes the format of "Jan 15, 2007 15:45:00 GMT" and converts it to a relative time
// Ruby strftime: %b %d, %Y %H:%M:%S GMT
time_ago_in_words_with_parsing: function(from_time, include_seconds) {
var date = new Date;
date.setTime(Date.parse(from_time));
return this.time_ago_in_words(date, include_seconds);
},
time_ago_in_words: function(from_time, include_seconds) {
# mongo_template.rb
# fork of Ben Scofield's Rails MongoMapper Template (http://gist.github.com/181842)
#
# To use:
# rails project_name -m http://gist.github.com/gists/219223.txt
# remove unneeded defaults
run "rm public/index.html"
run "rm public/images/rails.png"
run "rm public/javascripts/controls.js"

Git Workflow

Consider three remote branches origin/master, origin/staging and origin/production. The master is the shared developers' edge. Staging is what is tested before a push to production and production is the code that gets deployed.

New Development

@rainux
rainux / Debian Packages
Created April 11, 2009 17:08
My favorite debian packages.
autoconf
bison
build-essential
checkgmail
colordiff
colorgcc
colormake
curl
cvs
devtodo