Skip to content

Instantly share code, notes, and snippets.

View NevenLeung's full-sized avatar
🤣
Learing, working and thinking.

Neven Leung NevenLeung

🤣
Learing, working and thinking.
  • GuangZhou, China
View GitHub Profile
@NevenLeung
NevenLeung / object-watch.js
Created June 16, 2017 08:05 — forked from eligrey/object-watch.js
object.watch polyfill in ES5
/*
* object.watch polyfill
*
* 2012-04-03
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
var gulp =require('gulp'),
useref = require('gulp-useref'),
uglify = require('gulp-uglify'),
cleancss = require('gulp-clean-css'),
rev = require('gulp-rev'),
revReplace = require('gulp-rev-replace'),
gulpif = require('gulp-if');
gulp.task('pack', function () {
return gulp.src('./src/**/*.html')
@NevenLeung
NevenLeung / README-Template.md
Created November 7, 2017 20:42 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@NevenLeung
NevenLeung / README.md
Created November 7, 2017 20:42 — forked from jxson/README.md
README.md template

Synopsis

At the top of the file there should be a short introduction and/ or overview that explains what the project is. This description should match descriptions added for package managers (Gemspec, package.json, etc.)

Code Example

Show what the library does as concisely as possible, developers should be able to figure out how your project solves their problem by looking at the code example. Make sure the API you are showing off is obvious, and that your code is short and concise.

Motivation

@NevenLeung
NevenLeung / indexeddb-error-case-step-1.js
Last active May 10, 2018 16:52
indexedDB error case
// 尝试连接indexedDB,得到一个‘响应’
let request;
request = indexedDB.open('testing', 1.0);
request.onerror = function (event) {
alert('Something bad happened while trying to open: ' + event.target.errorCode);
};
request.onsuccess = function () {
const indexedDBModule = function(dbName, version, objectStorage) {
window.indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
const dbOpenRequest = window.indexedDB.open(dbName, version);
// 模块中的局部变量,用于存储连接成功的数据库连接
let db;
dbOpenRequest.onerror = function (event) {
console.log('Something bad happened while trying to open: ' + event.target.errorCode);
@NevenLeung
NevenLeung / vue-component.js
Last active May 14, 2018 07:36
A vue component object
{
data() {
return {
}
},
methods: {
},
compontents: {
@NevenLeung
NevenLeung / indexedDB-module-reconnect-db-everytime.js
Created August 4, 2018 14:36
IndexedDB Module in two different uasges
/**
* @module indexedDBModule 使用indexedDB管理数据
*
* @param {String} dbName 数据库名称
* @param {Number} version 数据库版本
* @param {String} objectStorage 对象存储空间(相当于table name)
* @param {Function} afterDataBaseConnected 需要在数据库初始化完成后执行的函数,一般为应用的初始化函数
*
* @return {Object} {init, getAll, get, create, update, delete, removeAll}
*
@NevenLeung
NevenLeung / counter-in-ES6-module.js
Last active August 4, 2018 20:19
IIFE module VS. ES6 module
let count = 0;
function get() {
return count;
}
function add() {
count += 1;
}
@NevenLeung
NevenLeung / gist:67a7ab862dc3057a448a835ffe085787
Created October 12, 2018 21:18 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue: