Skip to content

Instantly share code, notes, and snippets.

View liluo's full-sized avatar
:octocat:
Hey, there ~

liluo liluo

:octocat:
Hey, there ~
View GitHub Profile
@defunkt
defunkt / clients.md
Created April 18, 2010 14:09
A list of Gist clients.

Gist Clients

Want to create a Gist from your editor, the command line, or the Services menu? Here's how.

Editor Support

@saberma
saberma / douban.rb
Created July 16, 2011 10:24
douban api ruby
# -----------------------------------------------------------------
# 本程序提供最基本的Douban OAuth认证的Ruby示例代码
# 更多其他语言版本的Douban OAuth认证示例代码在 http://code.google.com/p/douban-oauth-sample/ 上提供
# 有任何疑问,可以到 http://www.douban.com/group/dbapi/ 上提问
# -----------------------------------------------------------------
# Douban OAuth认证包括以下四步内容
#
# 1. 获取Request Token
# 2. 用户确认授权
@clvrobj
clvrobj / douban.com.js
Created October 28, 2011 08:05
douban.com dotjs plugin
// 2012 new version
// 点击logo到广播
$('.site-nav-logo a').attr('href', 'http://www.douban.com/update/');
// 按"."刷新广播,与twitter快捷键一致
$('body').keypress(
function (e) {
var code = e.charCode ? e.charCode : e.keyCode;
if (code === 46 && !$(':focus').is(':input')) {
// '.' to reload
@capnslipp
capnslipp / ghfmd.rb
Created February 19, 2012 03:03
Markdown Renderer, avec GitHub-Flavor™
#!/usr/bin/env ruby
# ^ 1.8.x or 1.9, folks!
require 'rubygems'
require File.expand_path('./md_izer', File.dirname(__FILE__))
render_options = {
:fenced_code_blocks => true,
:autolink => true,
:space_after_headers => true
@nowa
nowa / douban.rb
Created March 13, 2012 12:30 — forked from saberma/douban.rb
douban api ruby
# -----------------------------------------------------------------
# 本程序提供最基本的Douban OAuth认证的Ruby示例代码
# 更多其他语言版本的Douban OAuth认证示例代码在 http://code.google.com/p/douban-oauth-sample/ 上提供
# 有任何疑问,可以到 http://www.douban.com/group/dbapi/ 上提问
# -----------------------------------------------------------------
# Douban OAuth认证包括以下四步内容
#
# 1. 获取Request Token
# 2. 用户确认授权
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active November 15, 2024 09:51
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@liluo
liluo / gist:2964598
Created June 21, 2012 08:32
labs.douban.com
while [ $? -eq 0 ];do nc -vlp 8888 -c'(r=read;e=echo;$r a b c;z=$r;while [ ${#z} -gt 2 ];do $r z;done;f=`$e $b|sed "s/[^a-z0-9_.-]//gi"`;h="HTTP/1.1";o="$h 200 OK";c="Content";hd="$c-Type: text/html; charset=utf-8";if [ -z $f ];then($e "$o";$e $hd;$e;ls|(while $r n;do if [ -f "$n" ]; then $e "<a href=\"/$n\">`ls -gh $n`</a><br>";fi;done););elif [[ $f =~ eggs ]];then($e "$o";$e $hd;$e;curl http://labs.douban.com/doublo/eggs?k=`$e $f|sed "s/eggs//gi"` 2>/dev/null;);elif [ -f $f ];then $e "$o";$e "$c-Type: `file -ib $f`";$e "$c-Length: `stat -c%s $f`";$e;cat $f;else $e -e "$h 404 Not Found\n\n404\n";fi)';done
@liluo
liluo / gist:2965927
Created June 21, 2012 14:04
ruby 图表库
http://tioga.rubyforge.org/index.html
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@tototoshi
tototoshi / rownum.sql
Created December 26, 2012 01:14
Grouped LIMIT in PostgreSQL: show the first N rows for each group
-- http://stackoverflow.com/questions/1124603/grouped-limit-in-postgresql-show-the-first-n-rows-for-each-group
-- http://www.postgresql.jp/document/9.2/html/tutorial-window.html
CREATE TABLE empsalary (
depname varchar(10) not null
, empno integer not null
, salary integer not null
);
INSERT INTO empsalary (depname, empno, salary) VALUES ('develop', 11, 5200);