为AJAX添加等待效果(spin.js)

在WEB开放中,如果使用了AJAX,那么如果服务器不能马上返回结果,希望能有个等待的东西来提示用户。

spin.js就是专门用来实现等待的效果,一个效果图如下:

它主要有以下特点

  • 非图片和CSS的扩展
  • 不需要额外的依赖(如jQuery)
  • 能自由的配置效果
  • 能在绝大多数浏览器下运行(包括IE6)

Continue reading


leetcode Mini Parser

leetcode Mini Parser

Given a nested list of integers represented as a string, implement a parser to deserialize it.

Each element is either an integer, or a list — whose elements may also be integers or other lists.

Note: You may assume that the string is well-formed:

  • String is non-empty.
  • String does not contain white spaces.
  • String contains only digits 0-9, [, ,, ].

Example 1:

Example 2:

Continue reading


leetcode Shuffle an Array

leetcode Shuffle an Array

Shuffle a set of numbers without duplicates.

Example:

Continue reading


leetcode Ransom Note

leetcode Ransom Note

Given
 an 
arbitrary
 ransom
 note
 string 
and 
another 
string 
containing 
letters from
 all 
the 
magazines,
 write 
a 
function 
that 
will 
return 
true 
if 
the 
ransom 
 note 
can 
be 
constructed 
from 
the 
magazines ; 
otherwise, 
it 
will 
return 
false.

Each 
letter
 in
 the
 magazine 
string 
can
 only 
be
 used 
once
 in
 your 
ransom
 note.

Note:
You may assume that both strings contain only lowercase letters.

Continue reading