Skip to content

Instantly share code, notes, and snippets.

View L3au's full-sized avatar
🥑

Ben L3au

🥑
  • Australia
View GitHub Profile
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>
// 获取学生信息
public ArrayList getRecords(Hashtable ht) {
ArrayList<HashMap> list = null;
String stu_dept = "<select id=\"BO_STUDENT_DEPT\" width=\"100px\" >";
String linkStr = "";
String[] depts = { "计算机", "经管", "英语" };
try {
list = stuDao.getRecords(ht);
int j = 0;
for (HashMap map : list) {
@L3au
L3au / xiami_decode.js
Created April 30, 2012 12:06 — forked from fanzeyi/xiami_decode.js
Xiami URL Decoder
function decode(loca) {
var result = [], url = "";
var line, rows, extra;
loca = loca.trim();
if(loca === "") {
return "";
}
line = Number(loca[0]);
rows = Math.floor((loca.length - 1) / line);
extra = (loca.length - 1) % line;
@L3au
L3au / jquery.xiami.js
Created April 30, 2012 12:06
Xiami music direct link getter for nodejs
//For jQuery
$.xiami = function (songId, callback) {
function decoder (sourceString) {
var _loc9 = Number(sourceString[0]);
var _loc7 = sourceString.substr(1);
var _loc5 = Math.floor(_loc7.length / _loc9);
var _loc6 = _loc7.length % _loc9;
var _loc2 = new Array();
for (var _loc3 = 0; _loc3 < _loc6; ++_loc3) {
@L3au
L3au / gist:2190675
Created March 25, 2012 01:48 — forked from lamengao/gist:1560715
dl.cuoluo.me nginx config
server {
listen 80;
server_name dl.cuoluo.me;
location / {
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://dl.dropbox.com/u/1812807/dl.cuoluo.me/index.html;
if ($request_method = POST) {
@L3au
L3au / RandomTrial.java
Created March 17, 2012 16:25
从(Min,Max)的范围内产生Num个随机数,而且还不能重复的。。(ArrayList,Iterator)
import java.util.ArrayList;
import java.util.Iterator;
public class RandomTrial{
public static void main(String[] args){
String [] s = {"one","two","three","four","five","six","seven","eight","nine","ten"};
ArrayList<Integer> al = new ArrayList<Integer>();
while(al.size() < 3){
int num = (int)(Math.random() * 10);
if (!al.contains(num)) {
@L3au
L3au / CapitalLowerTrial.java
Created March 17, 2012 16:16
使用String中的split拆分字符串,先输出大写字符在输出小写字符
public class CapitalLowerTrial{
public static void main(String[] args) {
String s = "jiURbFpLOeWBDpoHyJM";
String [] ss1 = s.split("\\p{Lower}");
String [] ss2 = s.split("\\p{Upper}");
for (String str : ss1) {
System.out.print(str);
}
for (String str : ss2) {
System.out.print(str);
layout title date comments categories
post
Installing Octopress (Fedora Version)
2012-02-05 06:13
true
fedora linux octopress ruby rvm jekyll rubygems

I (rather obviously) recently found myself attempting to install Octopress. Sure, it has great documentation, but some areas were lacking -- specifically, initial setup. As someone who has not worked with Ruby before other than a rather limited Windows install for a jekyll project, I had virtually no experience installing Ruby, using RVM, or even playing with RubyGems.

@L3au
L3au / Multiplication.java
Created March 11, 2012 12:11
我靠刚才写的表述没了。。。就一些判断完全权平方数,回文数神马的。
public class Multiplication{
//输出左对齐,给定字符串长度,不足补空格
public static String len(String str, int i){
String tmp = "";
if(str.length() < String.valueOf(i).length() * 4 + 8){
for (int j = 0; j < String.valueOf(i).length() * 4 + 8 - str.length();j++ ) {
tmp += " ";
}
}
str += tmp;