Skip to content

Instantly share code, notes, and snippets.

View nuysoft's full-sized avatar
💭
I may be slow to respond.

高云 墨智 nuysoft

💭
I may be slow to respond.
View GitHub Profile
@nuysoft
nuysoft / AJAX 队列
Last active December 20, 2015 05:19
队列 Queue - 如何使用: 事实上,队列模块可以应用于任何需要顺序执行函数的场景。下面是几个典型示例。
<div id="ajaxqueue"></div>
<script>
$('#ajaxqueue')
.queue( 'ajax', function( next ){
var $this = $(this).append('$.ajax 1 loading...');
$.ajax( '/queue.do?method=queue1', { dataType: "json" } )
.done( function(){ $this.append('done!<br>'); })
.done( function(){ next(); } ) // 请求成功后执行下一个
.fail( function(){ $this.append('fail!<br>'); });
} )
@nuysoft
nuysoft / gist:6305603
Created August 22, 2013 10:22
转义 CSS 中的点号
<style>
.a\.c\/b {
color: red;
}
</style>
<div class="a.c/b">
佛主对虾说:阿弥陀佛,煮红了,就不疼了。
</div>
@nuysoft
nuysoft / d3-treemap-flare.json
Last active December 21, 2015 12:28
模拟 D3 Treemaps 的数据
{
"name": "flare",
"children": [
{
"name": "analytics",
"children": [
{
"name": "cluster",
"children": [
{
@nuysoft
nuysoft / Mock._mocked
Last active December 21, 2015 19:19
Mock Doc
{
rurl.toString(): {
rurl: rurl,
template: template
},
...
}
Random.extend({
constellations: ['白羊座', '金牛座', '双子座', '巨蟹座', '狮子座', '处女座', '天秤座', '天蝎座', '射手座', '摩羯座', '水瓶座', '双鱼座'],
constellation: function(date){
return this.pick(this.constellations)
}
})
Random.constellation()
// => "水瓶座"
Mock.mock('@CONSTELLATION')
// => "天蝎座"
(function(){
try{
return 1
} finally {
return 2
}
})()
// => 2
@nuysoft
nuysoft / ux-watch
Created September 3, 2013 07:52
监听开发目录下文件的变化,自动更新文件到部署目录。可以解决发开过程中: 1) Window 下 build、deploy、debug 繁琐的步骤, 2) Mac 下 JBoss 不支持软链接(ln -s)。
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
dev: {
files: ['../dev/zuanshi-site-web/src/main/webapp/**/**'],
tasks: ['copy']
}
},
copy: {
@nuysoft
nuysoft / State.java
Last active December 22, 2015 06:38
package com.nuysoft.util;
public enum State {
// 环境
RUN, // 生产环境
DEBUG, // 测试环境
// 状态
NEW, // 新建
READY, // 初始化
@nuysoft
nuysoft / btn.css
Created September 4, 2013 03:05
button from c9.io
.not-ie .btn-big-red{background-color:#C63702;background-image:linear-gradient(167deg, rgba(255,255,255,0.1) 50%, transparent 55%),linear-gradient(top, rgba(255,255,255,0.15), transparent);border-radius:6px;box-shadow:0 0 0 1px #c63702 inset,0 0 0 2px rgba(255,255,255,0.15) inset,0 8px 0 0 #ad3002,0 8px 0 1px rgba(0,0,0,0.4),0 8px 8px 1px rgba(0,0,0,0.5);color:white;display:block;font-family:"Lucida Grande", Arial, sans-serif;font-size:22px;font-weight:bold;height:61px;letter-spacing:-1px;line-height:61px;margin:28px 0 10px;position:relative;text-align:center;text-shadow:0 1px 1px rgba(0,0,0,0.5);text-decoration:none !important;transition:all .2s linear;width:186px}
.not-ie .btn-big-red:hover{background-color:#d13902;box-shadow:0 0 0 1px #c63702 inset,0 0 0 2px rgba(255,255,255,0.15) inset,0 10px 0 0 #ad3002,0 10px 0 1px rgba(0,0,0,0.4),0 10px 8px 1px rgba(0,0,0,0.6);margin-top:26px;margin-bottom:12px}
.not-ie .btn-big-red:active{box-shadow:0 0 0 1px #ad3002 inset,0 0px 0 2px rgba(255,255,255,0.15) inset,0 0
;
(function() {
$.extend({
unparam: function(param) {
if (param[0] === '?') param = param.slice(1)
var re = {}
for (var i = 0, arr = param.split('&'), kv; kv = arr[i]; i++) {
kv = kv.split('=')
re[kv[0]] = kv[1]
}