原创 Diskpart 刪除分區

管理員打開cmddiskpartsel disk 0list part看好分區號sel part 分區號del part override

原创 C# play with json in dynamic

var jsonString = @"{ 'id': '4', 'first_name': 'Ma

原创 Service worker coding test

var version = '4.0'; self.addEventListener('install', function (event) { event.waitUntil(caches.open(version)); })

原创 Jquery PlugIn for lazy loading items.

//lazy load image(function ($) { $.fn.onScroll = function (options) { var defaultOpt = { callback: null,

原创 Working with promise and generators

An example for working with Q and generators. You can run it in nodejs 0.11 harmony model var Q = require('q'); funct

原创 Using HTTP Proxy in Node.js with request package

const request = require('request'); request({'url':'http://example.com', 'proxy':'http://127.0.0.1:8888'}, func

原创 自制ES6 Promise

Checked all Promise sample, none of them is in ES6 syntax, this is weird, which age are we now. Simplest verison class

原创 use nodemailer to send gmail

1. sudo npm install nodemailer 2. Import the following class to your source code var nodemailer = require("nodemailer")

原创 構造函數+原型混合方式實現js的繼承

function ClassA(sColor){ this.color = sColor; } ClassA.prototype.sayColor = function(){ console.log(this.color); }

原创 js正則表達式筆記

1. 匹配整個單詞列表 var reg = /\b(shoes|shirt|pants)\b/;

原创 通過Wiston創建log,一天一文件

/** * User access, app run and error log. * * @module Logger */ //import var fs = require('fs'); var util = requir

原创 示例:js使用正則表達式group來提取字符串中的數據

var linkStr = "/black-mountain/35-cotton-creek-cir-black-mountain-nc-421_537763.html"; // 括號表示組。訪問可以用group[index]來訪問每組的

原创 Adding timeout support for http request in Node.JS

This is HttpUtil Module, you need "require" it before using the module. var http= require("http"); var HttpUtil = fun

原创 Use command line arguments in Node.js

var args = process.argv.splice(2); if(!args || args.length ==0){ console.log("no params"); } for(var i=0;i<args.lengt

原创 Share folder between windows and ubuntu linux vm from Virtual Box

1. Click“settings” on the toolbar of VM VirtualBox Manager 2. Click“Shared Folders” from left side of settings page. Se