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 java.io.IOException; | |
| import java.io.PrintWriter; | |
| import javax.servlet.ServletException; | |
| import javax.servlet.http.HttpServlet; | |
| import javax.servlet.http.HttpServletRequest; | |
| import javax.servlet.http.HttpServletResponse; | |
| import org.liufeng.course.service.CoreService; | |
| import org.liufeng.course.util.SignUtil; |
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 BaseMessage { | |
| // 开发者微信号 | |
| private String ToUserName; | |
| // 发送方帐号(一个OpenID) | |
| private String FromUserName; | |
| // 消息创建时间 (整型) | |
| private long CreateTime; |
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
| /** | |
| * 图文model | |
| */ | |
| public class Article { | |
| // 图文消息名称 | |
| private String Title; | |
| // 图文消息描述 | |
| private String Description; | |
| // 图片链接,支持JPG、PNG格式,较好的效果为大图640*320,小图80*80,限制图片链接的域名需要与开发者填写的基本资料中的Url一致 | |
| private String PicUrl; |
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
| /* | |
| * Array utility | |
| */ | |
| function isArray(myArray) { | |
| return myArray.constructor.toString().indexOf("Array") > -1; | |
| } |
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
| /** | |
| * @OnlyCurrentDoc Limits the script to only accessing the current spreadsheet. | |
| */ | |
| var DIALOG_TITLE = 'Example Dialog'; | |
| var SIDEBAR_TITLE = 'Example Sidebar'; | |
| /** | |
| * Adds a custom menu with items to show the sidebar and dialog. | |
| * |
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
| #/bin/bash -ex | |
| # General settings | |
| PWD=`pwd` | |
| #DATE=`date +%Y-%m-%d:%H:%M:%S` | |
| DATE=`date +%Y-%m-%d_%H%M%S` | |
| # Log file | |
| logfile="${PWD}/${DATE}.log" |
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
| #/bin/sh -ex | |
| egrep -lRZ "http://rubygems.org|https://rubygems.org" . \ | |
| | xargs -0 -l sed -i -e 's/http:\/\/rubygems.org/http:\/\/ruby.taobao.org/g' | |
| egrep -lRZ "http://rubygems.org|https://rubygems.org" . \ | |
| | xargs -0 -l sed -i -e 's/https:\/\/rubygems.org/http:\/\/ruby.taobao.org/g' |
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
| #!/bin/sh -ex | |
| xmllint --format $@ |
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
| /** | |
| * | |
| * @param lat1 The y coordinate of the first point, in radians | |
| * @param lon1 The x coordinate of the first point, in radians | |
| * @param lat2 The y coordinate of the second point, in radians | |
| * @param lon2 The x coordinate of the second point, in radians | |
| * @return The distance between the two points, as determined by the Haversine formula, in radians. | |
| */ | |
| public static double distHaversineRAD(double lat1, double lon1, double lat2, double lon2) { | |
| //TODO investigate slightly different formula using asin() and min() http://www.movable-type.co.uk/scripts/gis-faq-5.1.html |
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
| var tz = 'GMT+10'; | |
| console.log(new Date( new Date().getTime() + tz.replace( "GMT", "" ) * 3600 * 1000).toUTCString().replace( / GMT$/, "" )); | |
| // ------------------------------ | |
| var offset = +8; | |
| console.log(new Date( new Date().getTime() + offset * 3600 * 1000).toUTCString().replace( / GMT$/, "" )); | |
| console.log(new Date( new Date().getTime() + offset * 3600 * 1000).toUTCString()); |