Skip to content

Instantly share code, notes, and snippets.

@wiky
wiky / db-v01.md
Created July 29, 2012 13:21
NanoDB Design 0.1 (draft)

#NanoDB Design (draft)

定位:跨应用,跨平台

##Creating Database

####Memory Database

创建内存数据库,只需要提供库名(此名字用于标识数据库在内存中的名字)和数据源(数据源为空则是一个空数据库)。数据源的来源不关心,只要是完整的JSON数据对象即可。

@wiky
wiky / design.md
Created July 26, 2012 17:53
NanoDB Design (draft)

#NanoDB Design (draft)

定位:跨应用,跨平台

##Creating Database

####Memory Database

创建内存数据库,只需要提供库名(此名字用于标识数据库在内存中的名字)和数据源(数据源为空则是一个空数据库)。数据源的来源不关心,只要是完整的JSON数据对象即可。

@wiky
wiky / api.md
Created July 25, 2012 18:53
json api

#api

##JSON Reference

var family = {
	father: {
		name: 'Jim',
		son: {
			'$ref': '$.son'

},

@wiky
wiky / checkType.js
Created June 28, 2012 04:25
check the js variable type
(function(global) {
var type = (function() {
var cache = {};
return function(obj) {
var key;
return obj === null ? 'null' // null
: obj === global ? 'global' // global
: (key = typeof obj) !== 'object' ? key // array, boolean, function, number, undefined
: obj.nodeType ? 'object' // DOM element
: cache[key = ({}).toString.call(obj)] // cached [object XXXX]
@wiky
wiky / event-target.js
Created June 6, 2012 11:22
Custom Event
/**
* Custom Event
*
* @example
* <pre>
* function Foo() {}
* Foo.prototype.render = function() {
* this.fire('rendered');
* };
* EventTarget.mixin(Foo);