Skip to content

Instantly share code, notes, and snippets.

View yicone's full-sized avatar

yicone

View GitHub Profile
@yicone
yicone / 0:log4net_most_simple_sample.md
Last active August 29, 2015 14:00
使用log4net 历经纠结, 却也**从没有享受过纠结的好处**!
We couldn’t find that file to show.
@yicone
yicone / zrx-1-GenericTypeSpecialization.cs
Last active August 29, 2015 14:04
泛型特化时,一般会遭遇无法用集合法来消除针对类型参数的 if 语句。通过使用匿名委托(需要静态泛型类作为 Holder),可以避免。其效果可以形容为作用于类型参数的模式匹配。如此也避免了可能存在的类型转换所带来的装箱/拆箱操作。
void Main()
{
IRecord record = new Record1();
Console.WriteLine (record.Get<int>("aaa"));
}
public interface IRecord {
string GetString(string field);
int GetInt(string field);
long GetLong(string field);
@yicone
yicone / cardPayView.js
Last active August 29, 2015 14:12
async waterfall sample
async.waterfall([
function (cb) {
app.service.pay(this.data, {
headers: {
"Session-Id": app.sessionId
},
success: function (data, textStatus, jqXHR) {
console.log('pay resp textStatus:' + textStatus);
console.log('pay resp data', data);
cb(null, data);
@yicone
yicone / gulpfile.js
Created January 12, 2015 09:22
My first gulpfile
var gulp = require('gulp');
var shell = require('gulp-shell');
var preprocess = require('gulp-preprocess');
var template = require('gulp-template');
var os = require('os');
var _ = require('underscore');
//var replace = require('gulp-replace');
//var inject = require('gulp-inject');
gulp.task('redis', shell.task('redis-server > /dev/null &'))
@yicone
yicone / gist:163e7359aa73121c8f16
Created April 12, 2015 04:32
"variable @form-group-margin-bottom is undefined"
# old version is 3.3.2, update to 3.3.4
bower update bootstrap --save
@yicone
yicone / a.java
Created August 3, 2015 17:04
演示响应结果(Response)包含正文(Body),以及正文包含返回码(code)的接口风格中,正文不应为空
public class Order {
public int orderId;
}
public static class OrderService {
private static Order[] s_orders = new Order[3];
public static Response findOrder(final int orderId) {
Response resp = new Response();
@yicone
yicone / PagerProduct.cs
Created November 23, 2012 07:51
Do sort and pager for both IQueryable<T> and IEnumerable<T> meanwhile.
public class Foo
{
public virtual IEnumerable<Product> Page(IEnumerable<Product> list, Model.Pager pager)
{
IEnumerable<Product> b;
if (pager == null)
{
throw new ArgumentNullException("pager");
}
var q = list as IQueryable<Product>;
@yicone
yicone / EnumExtensions.cs
Created November 27, 2012 14:51
enum value map to string
/// <summary>
/// http://stackoverflow.com/questions/2787506/cast-string-to-enum-with-enum-attribute
/// todo: http://www.cnblogs.com/smalldust/archive/2006/04/25/384657.html 利用缓存优化
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static string GetDescription(this Enum value)
{
if (value == null)
{
@yicone
yicone / Controller.js
Created December 3, 2012 08:27
MVC pattern applied in javascript (like ASP.NET MVC Style) http://www.cnblogs.com/yicone/archive/2010/08/17/1801125.html
/* construct */
function Controller() {
this.viewModel = new ViewModel();
}
/* public methods */
Controller.prototype.index = function () {
var controller = this;
controller._bindEventList();
};

业务人员的愿景

  • 客户在预定过程中会提出更换酒店的需求,由此带来客服人员的沟通成本的增加。
  • 产品经理设定航班时在售价和是否高端方面的两难抉择,希望能由客人来自行选择。

需求描述

客户在预定过程中:

  • 如果行程中的某一天,有可选酒店,客户可以根据偏好和价格进行选择。
  • 如果出发日、中转日、回程日,有可选航班,客户可以根据偏好和价格进行选择。

对领域模型的影响