Skip to content

Instantly share code, notes, and snippets.

View bastengao's full-sized avatar
🏠
Working from home

Basten Gao bastengao

🏠
Working from home
View GitHub Profile
@bastengao
bastengao / jqplot_hex_colors
Created August 28, 2014 02:02
convert rgba color to hex color
require 'color'
jqplot_colors = [
"240, 192, 19, 1",
"217, 135, 20, 1",
" 16, 178, 199, 1",
" 15, 153, 168, 1",
"235, 155, 220, 1",
"247, 57, 197, 1",
"220, 237, 203, 1",
@bastengao
bastengao / verify_url_echostr.rb
Last active August 29, 2015 14:14
微信公众平台企业号验证URL (处理 echostr)
require 'openssl'
require 'base64'
# 参考 http://qydev.weixin.qq.com/wiki/index.php?title=加解密方案的详细说明
AES_KEY = 'aaaa'
encrypted_enchostr = 'bbbb'
def parse_msg(text)
random = text[0..16]
@bastengao
bastengao / buildagent.sh
Created April 23, 2015 02:47
Teamcity buildagent init start script
#!/bin/bash
# Teamcity buildagent daemon start/stop script.
### BEGIN INIT INFO
# Provides: Teamcity buildagent
# Required-Start: $local_fs $network $remote_fs
# Should-Start: ypbind nscd ldap ntpd xntpd
# Required-Stop: $local_fs $network $remote_fs
# Default-Start: 2 3 4 5
public class HelloWorld {
public static void main(String[] args){
System.out.println("hello world");
}
}
@bastengao
bastengao / FollowingMousePopover
Created August 27, 2012 03:33
bootstram popover following mouse
$(function () {
$("#stage").mousemove(function (event) {
var pageX = event.pageX;
var pageY = event.pageY;
$("#tooltip-ele").offset({ left:pageX + 10, top:pageY })
.popover({
title:"提示",
content:"<i class='icon-book'></i>内容内容内容内容内容内容内容",
html:true,
animation:false,
@bastengao
bastengao / ImageNaturalSize
Created September 3, 2012 06:07
get image natural width and height.
window.Images = {
naturalSize:function (imgSrc, callback) {
jQuery("<img/>").load( function () {
var naturalWidth = this.width;
var naturalHeight = this.height;
callback(naturalWidth, naturalHeight);
}).attr("src", imgSrc);
}};
/**
* User: Administrator
* Date: 11-11-4
* Time: 下午11:32
*
* @author Basten Gao
*/
public class EmailUtil {
private static final Map<String, String> EMAILS = loadEmails();
@bastengao
bastengao / full-window-layout.html
Created December 15, 2012 05:39
占满屏幕的布局
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>占满屏幕</title>
<style type="text/css">
aside {
position: absolute;
top: 0;
left: 0;
@bastengao
bastengao / pom.xml
Created February 19, 2013 13:44
auto deploy war to tomcat
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.gaohui.cargo-test</groupId>
<artifactId>cargo-test</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
@bastengao
bastengao / stylesheet.css
Last active December 14, 2015 07:09
javadoc 使用更清析的字体
/* Javadoc 样式表 */
/* 在此处定义颜色、字体和其他样式属性以覆盖默认值 */
* { font-family: "Helvetica Neue",Helvetica,Arial,sans-serif; }
/* 页面背景颜色 */
html, body { background-color: #FFFFFF; color:#000000; font-family: "Helvetica Neue",Helvetica,Arial,sans-serif; font-size:13px;}
/* 标题 */
h1 { font-size: 145% }