Skip to content

Instantly share code, notes, and snippets.

ZhenDong Wang zD98

Block or report user

Report or block zD98

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@zD98
zD98 / NodeJS-MD5
Created Aug 8, 2017
create md5 by using crypto
View NodeJS-MD5
crypto.createHash('md5').update(data).digest("hex");
@zD98
zD98 / CryptoJS-DES.html
Created Jul 13, 2017 — forked from ufologist/CryptoJS-DES.html
Use CryptoJS encrypt message by DES and direct decrypt ciphertext, compatible with Java Cipher.getInstance("DES")
View CryptoJS-DES.html
<!-- test pass with CryptoJS v3.1.2 -->
<script src="rollups/tripledes.js"></script>
<script src="components/mode-ecb.js"></script>
<script>
/**
* Encrypt message by DES in ECB mode and Pkcs7 padding scheme
*
* NOTE: DES is weak, please use 3DES(Triple DES) or AES
*
* @param {String} message
@zD98
zD98 / nodejs.errno.h
Created Jul 6, 2017 — forked from pbojinov/nodejs.errno.h
node.js errno descriptions. Useful for debugging.
View nodejs.errno.h
/* Pulled from https://github.com/joyent/node/blob/master/deps/uv/include/uv.h */
/* Expand this list if necessary. */
#define UV_ERRNO_MAP(XX) \
XX(E2BIG, "argument list too long") \
XX(EACCES, "permission denied") \
XX(EADDRINUSE, "address already in use") \
XX(EADDRNOTAVAIL, "address not available") \
XX(EAFNOSUPPORT, "address family not supported") \
XX(EAGAIN, "resource temporarily unavailable") \
XX(EAI_ADDRFAMILY, "address family not supported") \
@zD98
zD98 / Flyweight.md
Created Mar 23, 2016
设计模式-享元模式
View Flyweight.md

##Flyweight模式

###总结 用于优化重复, 缓慢及数据共享效率较低的代码, 通过与相关对象共享尽可能多的数据来减少应用程序中的内存使用 理解:将公用的数据抽象出来作为内层数据, 外层数据是对内层数据的一种处理与引用

###例子 //Book是享元的内层

@zD98
zD98 / Decorator.md
Created Mar 23, 2016
设计模式-装饰器模式
View Decorator.md

##Decorator模式(*) ###总结 向基本对象添加(装饰)属性或方法, 而不是进行子类化

###例子 eg.1简单实现-对对象的属性扩展 function vehicle(vehicleType) { this.xxx = ...; }

@zD98
zD98 / Mixin.md
Created Mar 23, 2016
设计模式-混入模式
View Mixin.md

##Mixin模式 ###总结 函数复用, 从其它对象原型中共享属性和方法的对象 子类化 ###例子

function augment(receivingClass, givingClass){
	//覆盖&扩展
	if(arguments[2]){
		for(var i=2,len=arguments.length; i<len;i++){
@zD98
zD98 / Factory.md
Created Mar 19, 2016
设计模式-工厂模式
View Factory.md

##Factory模式 ###总结 提供一个通用的接口来创造对象 ###例子 eg function Car(options){} function Truck(options){}

function VehicleFactory() {}
@zD98
zD98 / Facade.md
Last active Mar 19, 2016
设计模式-外观模式
View Facade.md

##Facade模式

###总结 提供了更简单的公有接口, 隐藏底层的真实复杂性 ###例子 eg.jQuery.ready() bindReady : function() { ... if(document.addEventListener){ document.addListener("DOMContentLoaded", DOMContentLoaded, false);

View Command.md

##Command模式 ###总结

将方法调用, 请求, 操作等封装到单一对象, 
从而根据不同的请求对客户进行参数化和传递可供执行的方法调用

###例子 eg.1 (function(){ var CarManager = {

@zD98
zD98 / Prototype.md
Created Mar 19, 2016
设计模式-原型模式
View Prototype.md

##Prototype模式 ###总结 在一个对象中定义一个函数, 它们都是由引用创建(所有子对象都指向相同的函数),而不是单独copy,提高了性能

###例子 eg 1. (规定)要求原型继承使用object.create

	var vechile= { 
		getModel:function () {}
You can’t perform that action at this time.