Skip to content

Instantly share code, notes, and snippets.

View zhaoyou's full-sized avatar
💭
Search

zhaoyou zhaoyou

💭
Search
View GitHub Profile
@zhaoyou
zhaoyou / getResponse.java
Last active March 9, 2017 15:06
根据URL获取HTTP Response的整个结果字符串
/*
** 不同的方式获取结果 [InputStream -> String] : http://stackoverflow.com/questions/309424/read-convert-an-inputstream-to-a-string
*/
public static String getResponseFromHttpUrl(URL url) throws IOException {
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
try {
InputStream in = urlConnection.getInputStream();
Scanner scanner = new Scanner(in);
scanner.useDelimiter("\\A");
@zhaoyou
zhaoyou / getDaysFromMonth
Created November 27, 2016 13:19
关于“获得某月份的天数”
/**
* from Weibo http://weibo.com/haoel?from=feed&loc=at&nick=%E5%B7%A6%E8%80%B3%E6%9C%B5%E8%80%97%E5%AD%90&is_all=1#1480252617643
**/
days = (month === 2) ? (28 + isLeapYear) : 31 - (month - 1) % 7 % 2;
@zhaoyou
zhaoyou / 12306.user.js
Created January 11, 2012 01:51 — forked from quietlynn/12306.user.js
12306 Auto Query => A javascript snippet to help you book ticket
/*
12306 Auto Query => A javascript snippet to help you book tickets online.
Copyright (C) 2011-2012 Jingqin Lynn
Includes jQuery
Copyright 2011, John Resig
Dual licensed under the MIT or GPL Version 2 licenses.
http://jquery.org/license
Includes Sizzle.js