Skip to content

Instantly share code, notes, and snippets.

View njleonzhang's full-sized avatar
💭
I may be slow to respond.

Leon Zhang njleonzhang

💭
I may be slow to respond.
View GitHub Profile
@njleonzhang
njleonzhang / data-tables-hoc.js
Last active November 30, 2017 13:49
try vue hoc
import {DataTables as oDataTables, DataTablesServer as oDataTablesServer} from 'vue-data-tables'
import Vue from 'vue'
let dataTablesHoc = Component => {
return {
components: {
[Component.name]: Component
},
render() {
@njleonzhang
njleonzhang / my vue template change.md
Last active November 16, 2017 03:38
my vue template change
  1. sass
cnpm install sass-loader node-sass --save-dev
  1. pug
cnpm install pug --save-dev
@njleonzhang
njleonzhang / vue2.md
Last active November 2, 2016 09:30
Vue 2.0 reactive principle
class Vue {
  constructor(options) {
    this.$options = options
    this._data = options.data
    // proxy所有的data属性
    Object.keys(options.data).forEach(key => this._proxy(key))
    // 递归的为数据定义get和set
    observer(options.data)
    // 通过调用render进行依赖收集,从而将_render方到相关data属性的watcher队列中 (1)
"use strict";
/*use in config.xml <hook type="after_platform_add" src="../path/to/cordova-ios-disable-push.js"/>*/
var fs = require("fs");
var path = require("path");
var COMMENT_KEY = /_comment$/;
function nonComments(obj) {
var newObj = {};
Object.keys(obj).forEach(function(key) {
if (!COMMENT_KEY.test(key)) {
@njleonzhang
njleonzhang / append_8_to_version_code.js
Created September 7, 2016 05:41
append extend 8 to android code version.
#!/usr/bin/env node
var path = require('path');
var fs = require('fs');
var xml2js = require('xml2js');
function xmlFileToJs(filename, cb) {
var filepath = path.normalize(path.join(__dirname, filename));
fs.readFile(filepath, 'utf8', function (err, xmlStr) {
if (err) throw (err);
@njleonzhang
njleonzhang / vue2.0 --- cached.md
Last active August 27, 2016 08:44
vue2.0 source code - cached
/**
 * Create a cached version of a pure function.
 */
export function cached (fn: Function): Function {
  const cache = Object.create(null)
  return function cachedFn (str: string): any {
    const hit = cache[str]
    return hit || (cache[str] = fn(str))
 }
@njleonzhang
njleonzhang / Free_Beyond_Compare.md
Last active April 22, 2025 14:37
Free Beyond Compare by unlimited trail

1 . goto beyond compare folder

 cd "/Applications/Beyond Compare.app/Contents/MacOS/"

2 . rename BCompare to BCompare.real

 mv BCompare BCompare.real