Skip to content

Instantly share code, notes, and snippets.

@alanland
alanland / build.gradle
Created August 6, 2013 02:36
Gradle Setting
rootProject.name = 'project1'
archivesBaseName = 'project1'
jar.baseName = 'project1'
// -- full file
apply plugin: 'java'
apply plugin: 'maven'
archivesBaseName = 'project1'
version = '1.0-SNAPSHOT'
@alanland
alanland / client-data.html
Last active December 20, 2015 06:29
gridx
<script type="text/javascript">
require([
"gridx/Grid",
"gridx/core/model/cache/Sync",
"gridx/modules/VirtualVScroller",
"gridx/modules/ColumnResizer",
"gridx/modules/extendedSelect/Row",
"gridx/modules/SingleSort",
"dojo/store/Memory"
], function(){
@alanland
alanland / timeout.js
Created July 24, 2013 06:35
Javascript 延迟
//Call a javascript function after 5 sec of last key press
var timeout;
$(document).ready(function(){
$('input[type=text]').keypress(function() {
if(timeout) {
clearTimeout(timeout);
timeout = null;
}
timeout = setTimeout(myFunction, 5000);
@alanland
alanland / ExcelBuilder.groovy
Last active January 17, 2019 08:44
Groovy Excel. Groovy读写Excel文件
package extract.excel
import org.apache.poi.hssf.usermodel.HSSFWorkbook
import org.apache.poi.hssf.usermodel.HSSFSheet
import org.apache.poi.hssf.usermodel.HSSFRow
import org.apache.poi.hssf.usermodel.HSSFCell
import org.apache.poi.hssf.usermodel.HSSFDateUtil
/**
@alanland
alanland / RowSet.groovy
Last active December 19, 2015 10:09
Groovy MOP
package mop
class RowSet {
Map map = [:]
void update(key,value){
map.put(key,value)
}
def get(key){
map.get(key)
}
@alanland
alanland / boolean.java
Created June 28, 2013 04:38
Java Boolean 操作符
The boolean logical operators are : | , & , ^ , ! , || , && , == , != , ?:
| the OR operator
& the AND operator
^ the XOR operator
! the NOT operator
@alanland
alanland / CHexConver.java
Last active September 7, 2017 08:57
java 中 Hex的转换
package mobi.dzs.util;
/**
* 16进制值与String/Byte之间的转换
* @author JerryLi
* @email lijian@dzs.mobi
* @data 2011-10-16
* */
public class CHexConver
{
@alanland
alanland / joda-time
Created June 27, 2013 03:28
joda-time 例子
//Joda-Time 的一个小例子,计算一天的工作时间,
//每天工作8小时,1小时休息:
package com.alzhang.workingtime;
import org.joda.time.DateTime;
import org.joda.time.Duration;
import org.joda.time.Hours;
import org.joda.time.Period;
import org.joda.time.format.DateTimeFormat;
@alanland
alanland / 文件操作
Last active August 6, 2023 04:59
Groovy 文件操作
// 创建文件夹
wasCreated = new File('mydir').mkdir()
wasCreated = new File('mydir/subdir').mkdirs()
// 写文件
f = new File('myfile.txt')
f.write('hello world!')
// 写文件2
f = new File(‘myfile.txt’)
@alanland
alanland / index.html
Last active December 17, 2015 23:58
仓位图
<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="storeroom.js"></script>
<style>
body, html, #allmap {
width: 100%;
height: 100%;