Skip to content

Instantly share code, notes, and snippets.

@mimosz
mimosz / pi.rb
Created March 13, 2013 09:18
raspberry pi
# -*- encoding: utf-8 -*-
require 'wiringpi'
class Pi
def initialize(pins)
@pins = pins
@io = WiringPi::GPIO.new
@io.wiringPiMode(WPI_MODE_GPIO)
@mimosz
mimosz / gist:5530810
Created May 7, 2013 07:20
达尔文计划,整理宝贝SKU配图
user = User.all[11]
def get_value(cid, properties)
prop_ids = properties.split(':')
prop = ItemProp.where(_id: "#{cid}-#{prop_ids[0]}").first
return nil if prop.nil?
prop_value = prop.prop_values.where(vid: prop_ids[1]).first
return nil if prop_value.nil?
prop_value.name
@mimosz
mimosz / README.md
Last active December 17, 2015 03:49

API 调用说明

HTTP Header(必须包括):

{
  "Content-Type":"application/json",
  "X-App-Token":"应用密钥"
}
@mimosz
mimosz / gist:5656491
Last active December 17, 2015 18:50
同步逻辑
String today = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
String seller = "onitsukatiger官方旗舰店";
// 同步队列
SyncQueue ot = OT.orderQueue(seller, today);
Query sql = dbconn.createQuery("from Trade where seller_nick = ? and status = ? and (end_time between ? and ?)");
sql.setString(0, seller);
sql.setString(1, "TRADE_FINISHED");
sql.setString(2, today + " 00:00:00");
sql.setString(3, today + " 23:59:59");