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
@liluo
liluo / a.md
Last active December 16, 2015 05:29

name: inverse layout: true class: center, middle, inverse


Python 简介

su27


@liluo
liluo / test.py
Last active December 15, 2015 23:59
me = client.user.me print client.user.following(me['id'])
SCOPE = 'douban_basic_common,shuo_basic_r,shuo_basic_w,community_advanced_doumail_r'
client = DoubanClient(API_KEY, API_SECRET, CALLBACK, SCOPE)
print 'Go to the following link in your browser:'
print client.authorize_url
code = raw_input('Enter the verification code:')
access_token = client.auth_with_code(code)
#!/bin/sh
git filter-branch --env-filter '
an="$GIT_AUTHOR_NAME"
am="$GIT_AUTHOR_EMAIL"
cn="$GIT_COMMITTER_NAME"
cm="$GIT_COMMITTER_EMAIL"
if [ "$GIT_COMMITTER_EMAIL" = "[email protected]" ]
@liluo
liluo / clients.md
Created February 14, 2013 11:53 — forked from defunkt/clients.md

Gist Clients

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

Editor Support

def thrice
yield
yield
yield
end
x = 5
puts "value of x before: #{x}" # 5
thrice { x += 1 }
puts "value of x after: #{x}" #
@liluo
liluo / readme.md
Last active December 10, 2015 01:48
Git Internals(for gist)

init

mkdir proj
cd proj
git init

config

git config user.name 'username'
@liluo
liluo / ghfmd.rb
Created December 18, 2012 07:51 — forked from capnslipp/ghfmd.rb
test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test
#!/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
@liluo
liluo / gist:4176272
Created November 30, 2012 15:02
Douban API v2 上传图片 length mismatch
class Faraday::Parts::FilePart
def initialize(boundary, name, io)
file_length = io.respond_to?(:length) ? io.length : File.size(io.local_path)
@head = build_head(boundary, name, io.original_filename, io.content_type, file_length,
io.respond_to?(:opts) ? io.opts : {})
@length = @head.length + file_length
@io = CompositeReadIO.new(StringIO.new(@head), io, StringIO.new("\r\n"))
end
end
@liluo
liluo / gist:4015981
Created November 5, 2012 08:17
去除豆瓣导航黑条背景
var navBgc = $($('.nav-wrap')[0].parentNode).css('background-color');
$('#db-global-nav').css('background', navBgc);
$('#db-global-nav ul li a').css('color', '#566D5E');
$('#db-global-nav ul li.on a').css({'color': '#219A44', 'font-weight': 800});
$('#db-global-nav .bd').css({'width': 960, 'margin': 'auto'});
1, 获取 access token
get '/auth/douban/callback' do
auth = env['omniauth.auth']
credentials = auth['credentials']
end
在这里可以拿到 credentials, 大致格式:
{"token"=>"xxxxxxxxxxxxxxxxx", "expires_at"=>1345640145, "expires"=>true}