Skip to content

Instantly share code, notes, and snippets.

View ufologist's full-sized avatar

Sun ufologist

View GitHub Profile
@ufologist
ufologist / Foo.java
Created September 8, 2012 15:20
怎样通过ksoap2发送复杂参数给web service方法(How to send complex type using ksoap2)
/*
* copyright
*/
package com.ufologist.model;
/**
* 公用模型
*
* @author Sun
@ufologist
ufologist / get12306RemainTicket.js
Created January 17, 2013 08:06
获取12306余票信息
/**
* 获取12306余票信息
*
* 查询列车的余票信息
* GET https://dynamic.12306.cn/otsweb/order/confirmPassengerAction.do?method=getQueueCount&train_date=2013-02-05&train_no=240000D31307&station=D313&from=VNP&to=SHH
*
* URL参数解析
* train_date // 不用说了吧
* train_no // 列车ID, 在余票查询结果车次的span中可以得到
* station // 车次
@ufologist
ufologist / douban_reader.js
Created January 17, 2013 12:20
如何导出/下载豆瓣阅读中的电子书
/**
* 分析豆瓣阅读查看电子书的逻辑
*
* 主要用到的JavaScript为
* 1. OzJS(管理模块)
* 2. jQuery(base库)
* 3. Backbone.js(web application框架)
*
* 过程分析
* --------
/**
* 淘宝指数性别比例图
*
* @author Sun
* @version 2013-3-1
*
* 使用方法(依赖jQuery, raphael):
* NewSexView($('.male_female'), [2632430, 1265245]);
*
* DOM结构
@ufologist
ufologist / CryptoJS-DES.html
Created May 15, 2013 03:34
Use CryptoJS encrypt message by DES and direct decrypt ciphertext, compatible with Java Cipher.getInstance("DES")
<!-- test pass with CryptoJS v3.1.2 -->
<script src="rollups/tripledes.js"></script>
<script src="components/mode-ecb.js"></script>
<script>
/**
* Encrypt message by DES in ECB mode and Pkcs7 padding scheme
*
* NOTE: DES is weak, please use 3DES(Triple DES) or AES
*
* @param {String} message
@ufologist
ufologist / CryptString.java
Created May 15, 2013 03:36
Encrypting and decrypting strings using a DES encryption algorithm. Strings can be encrypted and then are returned translated into a Base64 Ascii String.
/*
* copyright
* http://timarcher.com/blog/2007/04/simple-java-class-to-des-encrypt-strings-such-as-passwords-and-credit-card-numbers/
*/
package com.tima.crypto;
import java.io.*;
import java.util.*;
import java.security.*;
@ufologist
ufologist / Base File.sublime-settings
Created May 16, 2013 09:14
Sublime Text User Preferences -- Eclipse shortcuts for Sublime Text
{
"alignment_chars" : ["=", ":"]
}
@ufologist
ufologist / app.js
Created June 20, 2013 07:47
SeaJS load module mechanism
seajs.use('./js/main', function(main) {
main.hello();
});
@ufologist
ufologist / app.js
Created June 20, 2013 07:51
RequireJS load module mechanism
require(['main'], function(main) {
main.hello();
});
@ufologist
ufologist / spacetree-mindmap-demo.html
Created September 17, 2013 07:21
参考SpaceTree的示例, 实现类似脑图(mindmap)效果
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Spacetree - Mindmap Demo</title>
<link rel="stylesheet" href="spacetree.css" />
<style>
#infovis {
height: 600px;
margin-left: auto;