name: inverse layout: true class: center, middle, inverse
su27
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]" ] |
def thrice | |
yield | |
yield | |
yield | |
end | |
x = 5 | |
puts "value of x before: #{x}" # 5 | |
thrice { x += 1 } | |
puts "value of x after: #{x}" # |
#!/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 |
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 |
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} |