diandian82的专栏

Welcome to my blog. Hope you can get what you want.

使用Docker快速搭建Kafka开发环境

创建 docker-compose.yml version: '2' services: zoo1: image: wurstmeister/zookeeper restart: unless-stopped hostname: zoo1 ports: ...

2018-11-03 07:15:21

阅读数:126

评论数:0

What you don't know about template string.

var a = 1, b = 2; var d = 'abc'; function tag(strings, ...values) { console.log(strings); // "Hello " console.log(values);...

2018-09-21 11:42:59

阅读数:25

评论数:0

Implemented Iterator in ES6

class Fruits { constructor() { this.items = []; } add(item) { this.items.push(item); } [Symbol.iterator]() { ...

2018-09-21 11:40:12

阅读数:21

评论数:0

Service worker coding test

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

2018-04-13 07:06:03

阅读数:41

评论数:0

自制ES6 Promise

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

2017-12-23 01:51:26

阅读数:81

评论数:0

Jquery PlugIn for lazy loading items.

//use it with slider control and lister onChange event (function($) { $.fn.sliderthumbs = function(options) { var myOptions = { ...

2017-08-15 16:50:14

阅读数:164

评论数:0

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. Select a folder on Windows. e.g...

2015-07-24 16:52:12

阅读数:380

评论数:0

C# play with json in dynamic

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

2014-12-09 15:03:59

阅读数:572

评论数:0

Diskpart 删除分区

管理员打开cmd diskpart sel disk 0 list part 看好分区号 sel part 分区号 del part override

2014-11-13 23:00:03

阅读数:4688

评论数:0

Working with promise and generators

var Q = require('q'); function asyncSquare(n) { var defer = Q.defer(); setTimeout(function(){ if(n>5) defer.reject(888) d...

2014-08-23 07:32:05

阅读数:433

评论数:0

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'}, function (error, response, body) {...

2014-08-09 02:16:07

阅读数:870

评论数:0

通过Wiston创建log,一天一文件

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

2014-03-24 11:18:24

阅读数:1704

评论数:0

Javascript format numbers

Round to a certain number of places For rounding decimals you can use the built-in JavaScript methods toFixed or toPrecision. var num = 10; var res...

2013-07-10 13:13:41

阅读数:488

评论数:0

use nodemailer to send gmail

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

2013-06-07 14:07:11

阅读数:1523

评论数:0

js正则表达式笔记

1. 匹配整个单词列表 var reg = /\b(shoes|shirt|pants)\b/;

2013-06-06 15:25:04

阅读数:719

评论数:0

示例:js使用正则表达式group来提取字符串中的数据

var linkStr = "/black-mountain/35-cotton-creek-cir-black-mountain-nc-421_537763.html"; // 括号表示组。访问可以用group[index]来访问每组的信息 var linkRegx = /\...

2013-06-04 16:58:28

阅读数:15262

评论数:0

构造函数+原型混合方式实现js的继承

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

2013-05-26 19:30:36

阅读数:1505

评论数:0

Hogan.js 使用pratial示例

var hogan = require("hogan.js"); var template = hogan.compile('{{#list}}{{foo}}{{> par}}\n{{/list}}'); var partial = hogan.compile('/*{{...

2013-05-24 15:40:48

阅读数:3175

评论数:0

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.length;i++) console.l...

2013-05-23 10:45:12

阅读数:1411

评论数:0

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 = function(...

2013-05-18 13:26:57

阅读数:1010

评论数:0

提示
确定要删除当前文章?
取消 删除
关闭
关闭