Skip to content

Instantly share code, notes, and snippets.

View abruzzihraig's full-sized avatar
🤢

Yang He abruzzihraig

🤢
  • Melbourne
  • 05:53 (UTC -12:00)
View GitHub Profile
@abruzzihraig
abruzzihraig / jsdoit.css
Created January 23, 2018 04:11 — forked from obenjiro/jsdoit.css
Canvas Conical Gradient
body {
margin: 0;
padding: 0;
background-color: #fff;
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAANUlEQVQ4jWM8c+bMfwY8wNjYmBGfPBM+SWLAqAGDwQDG///xJgOGs2fP4lUw8F4YNYAKBgAA2NYKfxDn4ZUAAAAASUVORK5CYII=);
overflow: hidden;
}
@abruzzihraig
abruzzihraig / verify.js
Last active March 3, 2017 05:02
verifying script for checking templates from KDP
const path = require('path');
const fs = require('fs');
const Table = require('cli-table');
const mainDir = path.join(__dirname, 'templates');
function findPath(filePath) {
return new Promise(function(res, rej) {
fs.readdir(filePath, (err, filenames) => {
const filePaths = filenames
@abruzzihraig
abruzzihraig / ScatterMenu.js
Created August 17, 2016 12:51
ScatterMenu snippet
require('animate.css');
require('./ScatterMenu.styl');
import React, { PropTypes } from 'react';
import { Motion, StaggeredMotion, spring } from 'react-motion';
import cx from 'classnames';
import { BOUNCE, FADE } from '../../constant';
import { Button } from '../Button';
const VIRTUAL_AREA_RATIO = 0.95;
@abruzzihraig
abruzzihraig / angular-amap.js
Last active July 5, 2016 05:45
AMap/高德地图 module wrapper with angular
/*
* 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', {
@abruzzihraig
abruzzihraig / attach-events.js
Last active June 18, 2016 11:57 — forked from idiotWu/attach-events.js
attach-events decorator for react
/**
* @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
abruzzihraig / replace
Created June 2, 2015 06:31
Shell script for replace words with sed
alias rep='function _replace(){ eval "find . -type f -name \"*.$1\" -exec sed -i \"\" s/$2/$3/g {} +";};_replace'
@abruzzihraig
abruzzihraig / index.html
Created January 23, 2015 10:49
// source http://jsbin.com/buyeloyezu Fake the jquery.on
<!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;
@abruzzihraig
abruzzihraig / fibonacci
Last active August 29, 2015 14:13
Fibonacci tail recursion
function fib(n) {
var s = n1 = n2 = i = 1;
for (; i < n; i++) {
s = n1 + n2;
n1 = n2;
n2 = s;
}
return n1;
}
@abruzzihraig
abruzzihraig / simple_slider
Created November 10, 2014 08:44
一个简单封装的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');
_.next = _.slider_tag.find('.next');
_.dots = _.slider_tag.find('.slider-dotted');
_.cursor = 0;
_.width = slider_width;
_.jump = function(dist_cursor) {