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
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% }
@bastengao
bastengao / give-me-money.rb
Last active December 17, 2015 06:18
双色球机选
#encoding:utf-8
def gen_balls
final_balls = []
red_ball_poll = (1..33).to_a
6.times do
index = rand(red_ball_poll.length)
red_ball = red_ball_poll.delete_at(index)
final_balls << red_ball
end
@bastengao
bastengao / update-hosts.rb
Created June 21, 2013 13:15
自动更新 smart hosts 文件的小工具,暂时只支持 Windows
#encoding: utf-8
require "uri"
require "net/http"
# 自动更新 smart hosts 文件的小工具
# 暂时只支持 Windows
# 抓取最新的 hosts 内容
def fetch_latest_hosts
Net::HTTP.get('smarthosts.googlecode.com', '/svn/trunk/hosts')
end
@bastengao
bastengao / OsCheck.java
Created December 8, 2013 04:50
load sigar library
/**
* helper class to check the operating system this Java VM runs in
* http://stackoverflow.com/questions/228477/how-do-i-programmatically-determine-operating-system-in-java
* compare to http://svn.terracotta.org/svn/tc/dso/tags/2.6.4/code/base/common/src/com/tc/util/runtime/Os.java
* http://www.docjar.com/html/api/org/apache/commons/lang/SystemUtils.java.html
*/
public final class OsCheck {
/**
* types of Operating Systems
*/