Skip to content

Instantly share code, notes, and snippets.

View zheeeng's full-sized avatar
🎈
blowing balloons

Zheeeng zheeeng

🎈
blowing balloons
View GitHub Profile
@zheeeng
zheeeng / README.md
Created October 26, 2015 02:30 — forked from agnoster/README.md
My ZSH Theme

agnoster.zsh-theme

A ZSH theme optimized for people who use:

  • Solarized
  • Git
  • Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)

For Mac users, I highly recommend iTerm 2 + Solarized Dark

@zheeeng
zheeeng / stackoverflow.js
Created November 4, 2015 14:52
JS collection from stackoverflow.com
// jQuery Bounce Effect on click no jQuery UI -- <http://stackoverflow.com/a/10363828/4494083>
// Require jQuery
function doBounce(element, times, distance, speed) {
for(var i = 0; i < times; i++) {
element.animate({marginTop: '-='+distance}, speed)
.animate({marginTop: '+='+distance}, speed);
}
}
@zheeeng
zheeeng / 0_reuse_code.js
Created November 7, 2016 01:04
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@zheeeng
zheeeng / rAF.js
Created November 9, 2016 07:17 — forked from paulirish/rAF.js
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
@zheeeng
zheeeng / filter.js
Created November 14, 2016 07:20
filter function
var isArrayLike = function (arg) {
return arg && typeof arg.length === 'number' && arg.length > -1 && arg.length % 1 === 0 && typeof arg !== 'function'
}
var filter = (function () {
if (Array.prototype.filter) {
return function (arrayLikeList, filter, thisArg) {
return Array.prototype.filter.call(arrayLikeList, filter, thisArg)
}
} else { // Array.prototype.filter fallback
@zheeeng
zheeeng / cloudSettings
Last active August 20, 2017 13:05
Visual Studio Code Settings Sync Gist
{"lastUpload":"2017-08-20T13:05:44.793Z","extensionVersion":"v2.8.3"}
%YAML 1.2
---
name: HTML
file_extensions:
- html
- htm
- shtml
- xhtml
- inc
- tmpl
@zheeeng
zheeeng / Status Code Message
Created January 11, 2018 13:30
Status Code Message
const codeMessage = {
200: '服务器成功返回请求的数据',
201: '新建或修改数据成功。',
202: '一个请求已经进入后台排队(异步任务)',
204: '删除数据成功。',
400: '发出的请求有错误,服务器没有进行新建或修改数据,的操作。',
401: '用户没有权限(令牌、用户名、密码错误)。',
403: '用户得到授权,但是访问是被禁止的。',
404: '发出的请求针对的是不存在的记录,服务器没有进行操作',
406: '请求的格式不可得。',
const { CreateView, CreateComponent } = Buz
const data = {
account: {
userId: 000001,
username: 'Bob',
email: 'Bob@',
avatar: 'https://avatars.com/a-handsome-man',
isLogin: true,
services: ['calendar', 'mailbox', 'game-center']
class Refs extends React.PureComponent<IProps> {
private references: React.ReactInstance[] = []
componentDidMount () {
console.log('references', this.references)
}
setRef = (ref: React.ReactInstance) => {
this.references.push(ref)
}