This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.reduce = function(arr, reduce_cb, prev) { | |
arr = arr.toArray(); | |
if (Array.prototype.reduce) { | |
return Array.prototype.reduce.call(arr, reduce_cb, prev); | |
} | |
$.each(arr, function(i, cur) { | |
result = reduce_cb.call(null, prev, cur, i, arr); | |
prev = cur; | |
}); | |
return result; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<img class="pic" src="https://help.github.com/assets/help/set-up-git-0340a11d480e51c09d6123569d3d1d31.gif" alt="github" /> | |
<div class="scroller-container"> | |
<div class="scroller"></div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
font-family: Helvetica, Tahoma, Arial, STXihei, "华文细黑", "Microsoft YaHei", "微软雅黑", SimSun, "宋体", Heiti, "黑体", sans-serif; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Slider(slider_class, animation_type, slider_width, page_counts) { | |
var _ = this; | |
_.slider_tag = $('.' + slider_class); | |
_.slider_content = _.slider_tag.find('.slider-content'); | |
_.prev = _.slider_tag.find('.prev'); | |
_.next = _.slider_tag.find('.next'); | |
_.dots = _.slider_tag.find('.slider-dotted'); | |
_.cursor = 0; | |
_.width = slider_width; | |
_.jump = function(dist_cursor) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fib(n) { | |
var s = n1 = n2 = i = 1; | |
for (; i < n; i++) { | |
s = n1 + n2; | |
n1 = n2; | |
n2 = s; | |
} | |
return n1; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
<style id="jsbin-css"> | |
.outer { | |
width: 400px; | |
height: 400px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias rep='function _replace(){ eval "find . -type f -name \"*.$1\" -exec sed -i \"\" s/$2/$3/g {} +";};_replace' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @decorator | |
* Attach events to DOM element | |
* | |
* @param {Element|Function} elemOrFunc: DOM Element, or a function returns element | |
* @param {String} events: a list events separated with ',' | |
* @param {String} preventDecorator: prevent decorate when it doesn't need | |
* | |
* Usage: | |
* @attachEvents(window, 'click') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* The module amap below is a simplest implementation, there is no any updated or proper libraries when I wrote it. | |
* Since there is a new full-feature library which wrote by another guy, so I just recommend it below. | |
* https://github.com/leftstick/angular-amap | |
* | |
* If you just want version with a few features like below, you could just build your version on top of it. | |
*/ | |
angular.module('amap', []) | |
.constant('amapConstant', { |
OlderNewer