Skip to content

Instantly share code, notes, and snippets.

View rubyonrailsworks's full-sized avatar

RubyonRailsWorks rubyonrailsworks

  • Shanghai,China
View GitHub Profile
#!/usr/bin/env /usr/local/rvm/wrappers/ruby-1.9.2-p290@puppet/ruby
## Used by M/Monit to send prowl alerts
require 'rubygems'
require 'optparse'
# everyone's API keys
contact_info = {
"grant"=>{"key"=>"my_api_key"}
require 'mechanize'
@username = '[email protected]'
@password = 'hi2u'
@download_path = File.expand_path 'downloads'
@wget_cookie = File.expand_path(File.dirname(__FILE__)) + '/wget-cookies.txt'
unless File.directory? @download_path
puts "@{download_path} doesn't exist!"
exit
<ASNDetails><ASNs><ASNNo>1000000050</ASNNo><CustmorOrderNo>LES20130422</CustmorOrderNo><Type>IR</Type><ExpectedArriveTime>2013-04-23 11:04:00</ExpectedArriveTime><Details><Detail><SkuCode>T3PBC1-6806</SkuCode><ReceivedTime>2013-04-22 14:04:26</ReceivedTime><ExpectedQty>1000</ExpectedQty><ReceivedQty>1000</ReceivedQty><Lotatt01></Lotatt01><Lotatt02></Lotatt02><Lotatt03></Lotatt03><Lotatt04></Lotatt04><Lotatt05></Lotatt05><Lotatt06>null</Lotatt06><Lotatt07></Lotatt07><Lotatt08></Lotatt08><Lotatt09></Lotatt09><Lotatt10></Lotatt10><Lotatt11></Lotatt11><Lotatt12></Lotatt12></Detail><Detail><SkuCode>C2IBGE14IPE14-6850<
/SkuCode><ReceivedTime>2013-04-22 14:04:26</ReceivedTime><ExpectedQty>1000</ExpectedQty><ReceivedQty>1000</ReceivedQty><Lotatt01></Lotatt01><Lotatt02></Lotatt02><Lotatt03></Lotatt03><Lotatt04></Lotatt04><Lotatt05></Lotatt05><Lotatt06>null</Lotatt06><Lotatt07></Lotatt07><Lotatt08></Lotatt08><Lotatt09></Lotatt09><Lotatt10></Lotatt10><Lotatt11></Lotatt11><Lotatt12></Lotatt12></Detail><Detail><SkuCode>C2
@rubyonrailsworks
rubyonrailsworks / apri11.rb
Last active December 16, 2015 02:39
2013年学习笔记
#Include vs. Extend
#You can either use include or extend to mix in a module’s functionality into a class. The difference is this:
#include makes the module’s methods available to the instance of a class, while
#extend makes these methods available to the class itself.
require "benchmark"
include Benchmark
@rubyonrailsworks
rubyonrailsworks / bml.rb
Last active December 16, 2015 02:09
标杆对接
# 推送入库通知单至仓库 可以返回 SKU不存在
1.9.3p327 :144 > Bml.new.ans_to_wms
HTTPI GET request to 58.210.118.230 (net_http)
SOAP request: http://58.210.118.230:9021/order/BMLservices/BMLQuery
SOAPAction: "ansToWms", Content-Type: text/xml;charset=UTF-8, Content-Length: 1030
@rubyonrailsworks
rubyonrailsworks / query.rb
Last active October 31, 2018 03:21
淘宝物流公司对应编码
response = TaobaoQuery.get({method: 'taobao.logistics.companies.get', fields: 'code,name'}, 100)
@rubyonrailsworks
rubyonrailsworks / sources.list
Created January 24, 2013 03:41
ubuntu 10.10不再提供支持后的source list 更新
## Major bug fix updates produced after the final release of the
## distribution.
deb http://old-releases.ubuntu.com/ubuntu/ maverick main restricted
deb-src http://old-releases.ubuntu.com/ubuntu/ maverick main restricted
deb http://old-releases.ubuntu.com/ubuntu/ maverick-updates main restricted
deb-src http://old-releases.ubuntu.com/ubuntu/ maverick-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://old-releases.ubuntu.com/ubuntu/ maverick universe
@rubyonrailsworks
rubyonrailsworks / log.js
Last active December 11, 2015 10:08
优化
Started GET "/api/trades?trade_type=all" for 127.0.0.1 at 2013-01-21 16:38:32 +0800
Processing by TradesController#index as JSON
Parameters: {"trade_type"=>"all"}
User Load (0.3ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 6 LIMIT 1
(0.2ms) SELECT COUNT(*) FROM `roles` INNER JOIN `users_roles` ON `roles`.`id` = `users_roles`.`role_id` WHERE `users_roles`.`user_id` = 6 AND (((roles.name = 'seller') AND (roles.resource_type IS NULL) AND (roles.resource_id IS NULL)))
(0.2ms) SELECT COUNT(*) FROM `roles` INNER JOIN `users_roles` ON `roles`.`id` = `users_roles`.`role_id` WHERE `users_roles`.`user_id` = 6 AND (((roles.name = 'interface') AND (roles.resource_type IS NULL) AND (roles.resource_id IS NULL)))
(0.2ms) SELECT COUNT(*) FROM `roles` INNER JOIN `users_roles` ON `roles`.`id` = `users_roles`.`role_id` WHERE `users_roles`.`user_id` = 6 AND (((roles.name = 'logistic') AND (roles.resource_type IS NULL) AND (roles.resource_id IS NULL)))
MOPED: 127.0.0.1:27017 COMMAND
@rubyonrailsworks
rubyonrailsworks / trade_cols.rb
Last active December 11, 2015 09:08
MagicOrders js variables
# 所有订单列
{
'trade_source' => '订单来源',
'tid' => '订单编号',
'status' => '当前状态',
'status_history' => '状态历史',
'receiver_name' => '客户姓名',
'receiver_mobile_phone' => '联系电话',
'receiver_address' => '联系地址',
'buyer_message' => '客户留言',