prefix = 'origin/' # 前缀(可看做目录/路径)
resp = Qiniu::Fop::Av.convert_to(prefix + 'n03-0620.mp4')
resp = Qiniu::Fop::Av.convert_to(prefix + 'Robi_tw.mp4')
resp = Qiniu::Fop::Av.convert_to(prefix + 'Robi_vs_jp.mp4')
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% # app/views/orders/_filter_form.html.erb %> | |
<%= t '.provider' %> | |
<%= t '.start_at' %> | |
<%= t '.end_at' %> | |
<%= t '.no' %> | |
<%= t '.mobile' %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a href="javascript:location.href=document.referrer;">支持 target=' _blank' </a> | |
<a href="javascript:history.back();">不支持</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'faraday', require: false | |
gem 'typhoeus', require: 'typhoeus/adapters/faraday' # Faraday adapter | |
gem 'oj', require: false # MultiJson adapter | |
gem 'multi_json' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- encoding: utf-8 -*- | |
require 'mime/types' | |
require 'nestful' | |
require 'uri' | |
module Nestful | |
class MultiPart | |
def initialize(url, parts, crlf = nil) | |
@crlf = crlf || "\r\n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
seller = User.all[11] | |
trades = seller.trades.where(:pay_time.ne => nil).only(:tid, :pay_time, :payment, :total_fee, 'orders.oid', 'orders.total_fee', 'orders.outer_sku_id', 'orders.num', 'orders.price') | |
require 'csv' | |
header_row = ['交易ID', '订单ID', 'SKU编码', '数量', '价格', '数量', '实付价', '支付时间'] | |
CSV.open('tttttttt.csv', "wb:GB18030", col_sep: ',') do |csv| | |
csv << header_row | |
trades.each do |trade| | |
row = {} | |
puts "#{trade.payment} / #{trade.total_fee}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- encoding: utf-8 -*- | |
require 'csv' | |
cities = {} | |
# 有联系方式的用户 | |
users = User.any_of(:mobile.ne =>nil, :email.ne => nil).desc(:rank).only(:nickname, :name, :email, :mobile, :location) | |
# 指定城市 | |
keys = "北京、天津、石家庄、太原、呼和浩特、沈阳、大连、长春、哈尔滨、上海、南京、杭州、宁波、合肥、福州、厦门、南昌、济南、青岛、郑州、武汉、长沙、广州、深圳、南宁、海口、重庆、成都、贵阳、昆明、西安、兰州、西宁、银川、乌鲁木齐" | |
users = users.in( 'location.city' => keys.split('、') ) | |
# 构造 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def leaderboards_check(board_id, top=3, num=5) | |
board = Leaderboard.find_by_id(board_id) | |
return false if board.nil? | |
user_ids = board.rank.members.reverse[0, top] # 排名 | |
user_ids.each do |uid| | |
u = board.users[uid] | |
unless u.nil? | |
puts "#{uid}, #{u[:nickname]}, #{u[:city]}" # 推荐人 | |
puts '_'*88 | |
referring_ids = u[:referring].keys.sample(num) # 随机取下线ID |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% prop = @prop || @photo.face_prop %> | |
<% unless prop.blank? %> | |
<svg height='<%= @photo.img_height %>' width='<%= @photo.img_width %>' version='1.1' | |
xmlns='http://www.w3.org/2000/svg' xmlns:xlink= 'http://www.w3.org/1999/xlink'> | |
<style type='text/css'> | |
<![CDATA[ | |
polyline { | |
fill: none; | |
stroke: #00C4FF; | |
stroke-opacity: 0.8; |