Skip to content

Instantly share code, notes, and snippets.

View Gaubee's full-sized avatar
🫐
Growing

Gaubee Gaubee

🫐
Growing
View GitHub Profile
@Gaubee
Gaubee / Capture DOM.MD
Last active March 1, 2018 02:58
Capture DOM
domToImg.dom = document.body;
domToImg.download(location.protocol + "//" + location.host + "/build/main.css");
@Gaubee
Gaubee / Flow of Find PWD.js
Last active October 7, 2017 16:46
基于Generator的流程控制实践
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* 流程的状态机
*/
var FLOW_PROCESS_STATUS;
(function (FLOW_PROCESS_STATUS) {
FLOW_PROCESS_STATUS[FLOW_PROCESS_STATUS["BEFORE_START"] = 0] = "BEFORE_START";
FLOW_PROCESS_STATUS[FLOW_PROCESS_STATUS["INPUT_EMAIL"] = 1] = "INPUT_EMAIL";
FLOW_PROCESS_STATUS[FLOW_PROCESS_STATUS["INPUT_CODE"] = 2] = "INPUT_CODE";
@Gaubee
Gaubee / firebase-pagination.js
Last active April 9, 2017 08:13
Firebase pagination
const admin = require("./firebase-admin");
admin.initializeApp({
credential: **yourCredential**
databaseURL: **yourDatabaseURL**
});
const db = admin.database();
const dbPromise = (db_ref, options = {}) => {
const {
can_null,
@Gaubee
Gaubee / mide-pact.event.test.js
Last active October 29, 2016 09:23
Mind Pact加入事件监听功能
// 事件监听
var MP = require("../mind-pact");
var eve = new MP({});
[
"a",
"a.b",
"a.b2",
"a.b.c",
"a.b.c1",
"a.b.c2"
@Gaubee
Gaubee / index.html
Last active September 26, 2016 06:46
[ route → selectTabs → viewPage ]Best Practices
<link rel="import" href="/bower_components/app-layout/app-drawer/app-drawer.html">
<link rel="import" href="/bower_components/app-layout/app-drawer-layout/app-drawer-layout.html">
<link rel="import" href="/bower_components/app-layout/app-header/app-header.html">
<link rel="import" href="/bower_components/app-layout/app-header-layout/app-header-layout.html">
<link rel="import" href="/bower_components/app-layout/app-scroll-effects/app-scroll-effects.html">
<link rel="import" href="/bower_components/app-layout/app-toolbar/app-toolbar.html">
<link rel="import" href="/bower_components/polymer/polymer.html">
<link rel="import" href="/bower_components/app-route/app-route.html">
<link rel="import" href="/bower_components/iron-pages/iron-pages.html">
<link rel="import" href="/bower_components/paper-button/paper-button.html">
@Gaubee
Gaubee / mind-pact.js
Last active August 8, 2018 07:15
Mind Pact.JS——JS的灵魂契约
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
define(['MP'], factory);
} else {
root.MP = factory(root.b);
}
}(this, function(__global) {
var QuotedString = /"(?:\.|(\\\")|[^\""\n])*"|'(?:\.|(\\\')|[^\''\n])*'/g, //引号字符串
$NULL = null,
$UNDEFINED,
@Gaubee
Gaubee / gist:76542bd6d0458a7126868d76837639d2
Created May 4, 2016 03:12 — forked from zz85/gist:1193068
Triangle Blur - ShaderUtils
/**
* @author alteredq / http://alteredqualia.com/
*
* ShaderExtras currently contains:
*
* screen
* convolution
* film
* bokeh
* sepia
@Gaubee
Gaubee / GaussianBlur.js
Last active March 1, 2018 02:59
PIXI.js gaussian triangle blur
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
__.prototype = b.prototype;
d.prototype = new __();
};
define(["require", "exports"], function (require, exports) {
var GaussianBlur = (function (_super) {
__extends(GaussianBlur, _super);
function GaussianBlur() {
@Gaubee
Gaubee / assert_parseInt.js
Last active March 15, 2016 15:18
Safe ParseInt. 安全的ParseInt函数,不使用JS中已经内置的任何函数来实现
const parseInt = require("./parseInt");
const assert = require("assert");
const assertEquals = assert.deepStrictEqual;
const assertTrue = assert.ok;
/*
* https://github.com/v8/v8/blob/01590d660d6c8602b616a82816c4aea2a251be63/test/mjsunit/parse-int-float.js
*/
assertEquals(0, parseInt('0'));
assertEquals(0, parseInt(' 0'));
assertEquals(0, parseInt(' 0 '));
@Gaubee
Gaubee / test_express_error_handle.js
Created October 9, 2015 03:29
测试Express的错误处理
/*
* 创建类似DB服务
*/
var net = require("net");
var server = net.createServer(function(c) {
console.log('DB-SERVER: client connected');
c.on('end', function() {
console.log('DB-SERVER: client disconnected');
});
c.on('data', function(chunk) {