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
" don't bother with vi compatibility | |
set nocompatible | |
" enable syntax highlighting | |
syntax enable | |
" configure Vundle | |
filetype off | |
set rtp+=~/.vim/bundle/Vundle.vim/ |
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
import com.alibaba.fastjson.JSON; | |
import org.codehaus.jackson.map.ObjectMapper; | |
import org.codehaus.jackson.map.ser.StdSerializerProvider; | |
import org.codehaus.jackson.type.TypeReference; | |
import org.junit.BeforeClass; | |
import org.junit.Test; | |
import java.io.IOException; | |
import java.util.ArrayList; | |
import java.util.List; |
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
public ModelAndView gotoManageAccount(HttpServletRequest req, HttpServletResponse res) throws BusinessException, IOException { | |
Map resultMap = new HashMap(); | |
Date testdate = new Date(System.currentTimeMillis()); | |
if(testdate.getHours()>16&&testdate.getHours()<=24){ | |
resultMap.put("above5", "yes"); | |
} | |
StringBuffer sb = req.getRequestURL(); | |
String domain = "vip"; | |
try{domain = sb.toString().replace("http://", "").split("\\.")[0];}catch(Exception e){} |
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
(define (sum-max x y z) | |
(+ (max x y) | |
(max (min x y) z) | |
) | |
) | |
(sum-max 1 10 20) | |
(sum-max 1 20 10) | |
(sum-max 10 1 20) | |
(sum-max 10 20 1) | |
(sum-max 20 1 10) |
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
if(StringUtils.isBlank(script)) { | |
String jsPath = "http://cdn.tanx.com/t/tanxclick.js"; | |
script = "<script type=\"text/javascript\" src=\"" + jsPath + "\"></script>"; | |
} | |
velocityContext.put("extra_html", script); |
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
static public AdList get_list(Injector injector, Request r, String backend, Context context) { | |
ThriftClient client = injector.getInstance(ThriftClient.class); | |
if (client == null) { | |
return null; | |
} | |
try { | |
client.setThriftTimeout(1000); // debug interface, 1s timeout | |
client.init(backend, 0); // ignore port | |
context.put("backendHost",backend); | |
if (client != null) { |
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
public class AdmemberHandlerTest { | |
private AdmemberHandler admemberHandler; | |
private DailyAccountService dailyAccountService; | |
private AdmemberService admemberService; | |
private int admemberId; |
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
@Service("admemberHandler") | |
public class AdmemberHandler { | |
@Resource | |
private AdmemberService admemberService; | |
@Resource | |
private DailyAccountService dailyAccountService; | |
public void setDailyAccountService(DailyAccountService dailyAccountService) { |
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
@RequestMapping("/jsonp") | |
public void jsonp(HttpServletResponse response, HttpServletRequest request) throws IOException { | |
String name = getStringValue(request, "name"); | |
int age = getIntValue(request, "age"); | |
// do anything you want | |
// foo(name, age) | |
logger.info("name:" + name + " age:" + age); | |
response.setContentType("application/javascript;charset=utf-8"); |
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
app.all('/setAttrPrice/:adgroupid/:attrid/:price', function(req, res) { | |
var adgroup_id = req.params.adgroupid; | |
var attr_id = req.params.attrid; | |
var price = req.params.price; | |
if (price < 10000) { | |
send(res, 'price must greater than 10000'); | |
return; | |
} | |
if(adgroup_id <=0) { | |
send(res, 'adgroup id must greater than 0'); |
NewerOlder