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
Random.extend({
constellations: ['白羊座', '金牛座', '双子座', '巨蟹座', '狮子座', '处女座', '天秤座', '天蝎座', '射手座', '摩羯座', '水瓶座', '双鱼座'],
constellation: function(date){
return this.pick(this.constellations)
}
})
Random.constellation()
// => "水瓶座"
Mock.mock('@CONSTELLATION')
// => "天蝎座"
@nuysoft
nuysoft / Mock._mocked
Last active December 21, 2015 19:19
Mock Doc
{
rurl.toString(): {
rurl: rurl,
template: template
},
...
}
@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 / gist:6305603
Created August 22, 2013 10:22
转义 CSS 中的点号
<style>
.a\.c\/b {
color: red;
}
</style>
<div class="a.c/b">
佛主对虾说:阿弥陀佛,煮红了,就不疼了。
</div>
@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>'); });
} )