Skip to content

Instantly share code, notes, and snippets.

Yang He abruzzihraig

Block or report user

Report or block abruzzihraig

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
abruzzihraig / jQuery.reduce patch
Last active Aug 29, 2015
This is a patch that supports reduce function for jQuery.
View jQuery.reduce patch
$.reduce = function(arr, reduce_cb, prev) {
arr = arr.toArray();
if (Array.prototype.reduce) {
return, reduce_cb, prev);
$.each(arr, function(i, cur) {
result =, prev, cur, i, arr);
prev = cur;
return result;
abruzzihraig / index.html
Last active Aug 29, 2015
A Pen by abruzzi.
View index.html
<img class="pic" src="" alt="github" />
<div class="scroller-container">
<div class="scroller"></div>
abruzzihraig / font-family.css
Last active Aug 29, 2015
View font-family.css
font-family: Helvetica, Tahoma, Arial, STXihei, "华文细黑", "Microsoft YaHei", "微软雅黑", SimSun, "宋体", Heiti, "黑体", sans-serif;
abruzzihraig / simple_slider
Created Nov 10, 2014
View simple_slider
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'); = _.slider_tag.find('.next');
_.dots = _.slider_tag.find('.slider-dotted');
_.cursor = 0;
_.width = slider_width;
_.jump = function(dist_cursor) {
abruzzihraig / fibonacci
Last active Aug 29, 2015
Fibonacci tail recursion
View fibonacci
function fib(n) {
var s = n1 = n2 = i = 1;
for (; i < n; i++) {
s = n1 + n2;
n1 = n2;
n2 = s;
return n1;
View index.html
<!DOCTYPE html>
<script src=""></script>
<meta charset="utf-8">
<title>JS Bin</title>
<style id="jsbin-css">
.outer {
width: 400px;
height: 400px;
abruzzihraig / replace
Created Jun 2, 2015
Shell script for replace words with sed
View replace
alias rep='function _replace(){ eval "find . -type f -name \"*.$1\" -exec sed -i \"\" s/$2/$3/g {} +";};_replace'
abruzzihraig / attach-events.js
Last active Jun 18, 2016 — forked from idiotWu/attach-events.js
attach-events decorator for react
View attach-events.js
* @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')
abruzzihraig / angular-amap.js
Last active Jul 5, 2016
AMap/高德地图 module wrapper with angular
View angular-amap.js
* 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.
* 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', {
You can’t perform that action at this time.