This file contains hidden or 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
//TWIN WHEELER MODIFIED FOR ARDUINO SIMPLIFIED SERIAL PROTOCOL TO SABERTOOTH V2 | |
//With nunchuck potentiometers controlling it | |
//or could use two regular 10K potentiometers, one for steering and one for fine tuning of balance point | |
//J. Dingley For Arduino 328 Duemalinove or similar with a 3.3V accessory power output | |
//i.e. the current standard Arduino board. | |
//XXXXXXXXXXXXXXXXX UPDATES Feb 2012 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | |
// If you open serial view window at 9600 baud, you can see values for angle etc (once tiltstart has engaged) | |
//REMEMBER: Put one end down on floor, turn on, count to 5 (while it calibrates itself) |
This file contains hidden or 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 File.join(__FILE__, '../../../../Desktop/sms_list') | |
user = User.all[5] | |
mobiles = sms_list.uniq | |
members = user.members.in('receivers.receiver_mobile' => mobiles ) | |
buyers = members.only(:buyer_nick).distinct(:buyer_nick) |
This file contains hidden or 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
# sudo ln -s ~/nginx.conf unicorn.conf | |
upstream app_server { | |
server unix:/tmp/unicorn_padrino.sock fail_timeout=0; | |
} | |
server { | |
listen 80; | |
charset utf-8; | |
server_name db.innshine.com; |
This file contains hidden or 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 'digest/md5' | |
require 'nestful' | |
class Smsbao | |
def initialize(login, passwd) | |
@login = login | |
@passwd = Digest::MD5.hexdigest(passwd.to_s) | |
end |
This file contains hidden or 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
class Issue | |
# Referenced | |
belongs_to :user, foreign_key: 'seller_nick' # 店铺 | |
belongs_to :eventable, polymorphic: true # | |
has_many :changesets | |
field :seller_nick, type: String | |
field :memo, type: String | |
field :status, type: String |
This file contains hidden or 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 'savon' | |
client = Savon.client('http://interface.youruijin.com/RaybanCodeServer.php?wsdl') | |
code = "TES#{Time.now.to_i}" | |
response = client.request :rsync_code, body: { | |
code: code, | |
buydate: '2012-08-09 16:56:35', | |
channel: 1, | |
trade_id: '测试', | |
sku_id: '测试', |
This file contains hidden or 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 mobile_specs(mobile) | |
mobile = mobile.to_s[0..2].to_i # 号段 | |
china_mobile = { | |
'2G' => [134, 135, 136, 137, 138, 139, 150, 151, 152, 157, 158, 159, 182], | |
'3G' => [187, 188] | |
} | |
china_unicom = { | |
'2G' => [130, 131, 132, 155, 156], | |
'3G' => [185, 186] | |
} |
This file contains hidden or 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 filter_meta(filter) | |
{ name: filter.name, num: 0, children: {}, item_ids: filter.item_ids} | |
end | |
def filter_tree(filter, node, filters) # 构建层级 | |
key = filter._id.to_s | |
unless node.has_key?(key) | |
node[key] = filter_meta(filter) | |
if filter.child_ids.count > 0 | |
children = node[key][:children] = {} | |
filters.also_in(_id: filter.child_ids).each do |child| |
This file contains hidden or 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
user=User.all[5] | |
reply_nicks=[] | |
non_reply_nicks=[] | |
date='2012-07-10'.to_date | |
user.subusers.all[1].chatpeers.where(date: date).each do |chatpeer| | |
# 定义基础变量 | |
questions = 0 # 提问数 | |
answers = 0 # 答复数 | |
qna_rate = 0 # 问答率 | |
avg_waiting_times = 0 # 平均等待时间 |
This file contains hidden or 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
user = User.all[2] | |
# 同步最新的店铺会员 | |
user.members_sync | |
# 设定时间区间 | |
start_at='2012-04-01'.to_date | |
end_at='2012-05-09'.to_date | |
range = start_at.beginning_of_day..end_at.end_of_day | |
members = user.members.where(last_trade_time: range) | |
# 获得交易集合 | |
trade_ids = members.distinct(:biz_order_id) |