<|start_filename|>vuejs练习Demo列表/github提交/index.js<|end_filename|>
var apiURL = 'https://api.github.com/repos/vuejs/vue/commits?per_page=3&sha='

var demo = new Vue({
	el:"#demo",

	data:{
		branches:['master','dev'],
		currentBranch:'master',
		commits:null
	},

	created:function () {
		this.fetchData()
	},

	watch:{
		currentBranch:'fetchData'
	},

	filters:{
		truncate: function (v) {
			var newline = v.indexOf('\n');
			return newline > 0 ? v.slice(0,newline):v;
		},
		formatDate: function (v) {
			return v.replace(/T|Z/g, ' ');
		}
	},
	
	methods:{
		fetchData:function () {
			var xhr = new XMLHttpRequest();
			var self = this;
			xhr.open('GET',apiURL + self.currentBranch);
			xhr.onload = function () {
				self.commits = JSON.parse(xhr.responseText);
			}
			xhr.send();
		}
	}
})

<|start_filename|>html&css练习Demo列表/电商项目模块化布局/100du第几讲结束/css/style.css<|end_filename|>
@charset "utf-8"
/*==========================样式重置===================*/

body,
h1,
h2,
h3,
h4,
h5,
p,
dl,
dd,
ul,
ol,
form,
input,
textarea,
th,
td,
select {
    margin: 0;
    padding: 0;
}


/*内边距和外边距都是0*/

em {
    font-style: normal;
}


/*强调内容不用斜体*/

li {
    list-style: none;
}

a {
    text-decoration: none;
}


/*去除下划线*/

img {
    border: none;
    vertical-align: top;
}


/*没有边框、靠顶部*/

table {
    border-collapse: collapse;
}


/*边框合并在一起*/

input,
textarea {
    outline: none;
}


/*不要轮廓*/

textarea {
    resize: none;
    overflow: auto;
}

body {
    font-size: 12px;
    font-family: "微软雅黑"
}


/*=============================公共样式=======================*/

.fl {
    float: left;
}


/*左浮动*/

.fr {
    float: right;
}


/*右浮动*/

.clear {
    zoom: 1;
    /*设置或检索对象的缩放比例，清除浮动、清除margin的重叠*/
}


/*清除浮动ie浏览器*/

.clear {
    content: '';
    display: block;
    /* 属性规定元素应该生成的框的类型。block表示此元素将显示为块级元素，此元素前后会带有换行符。*/
    clear: both;
}


/*清除浮动 非IE浏览器*/

.gradient {
    background: -webkit-linear-gradient(top, #FFFFFF, #f8f8f8);
    /*浏览器*/
    background: -moz-linear-gradient(top, #FFFFFF, #f8f8f8);
    /*火狐浏览器*/
    background: -ms-linear-gradient(top, #FFFFFF, #f8f8f8);
    /*ie浏览器*/
    background: linear-gradient(top, #FFFFFF, #f8f8f8);
    /*其他浏览器*/
    -ms-filter: "progid:DXImageTransform.Microsoft.gradient (GradientType=0, startColorstr=#FFFFFF, endColorstr=#f8f8f8)";
    /*IE9*/
    +background: #f9f9f9;
    /*IE6/7*/
}


/*=========================layout样式===========================*/


/*公共样式*/

#header,
#nav,
.content {
    width: 960px;
    margin: 0 auto;
}

#search,
.section,
.side_section,
.ad_border,
#footer {
    border: 1px solid #dbdbdb;
    border-radius: 6px;
}

.section,
.options,
.main_ad,
.side_section,
.ad_border,
.side_ad {
    margin-bottom: 10px;
}

body {
    margin-bottom: 30px;
}

#header {
    height: 30px;
    border-radius: 0 0 6px;
}

#nav {
    height: 100px;
    background: #FFC;
}

#search {
    width: 958px;
    height: 114px;
    margin: 0 auto 10px;
}

#search .bar {}

.main {
    width: 710px;
}

.section {
    width: 318px;
    height: 200px;
    /*3333*/
    padding: 0 15px;
}

.options {
    width: 350px;
    height: 200px;
    /*3333*/
}

.main_ad {
    border-radius: 6px;
    /*overflow: hidden;*/
}

.side {
    width: 240px;
}

.side_section {
    height: 60px;
    padding: 0 12px;
}

.ad_border {
    width: 238px;
    height: 88px;
    overflow: hidden;
}

.side_ad {
    border-radius: 6px;
    overflow: hidden;
}

#footer {
    width: 958px;
    height: 78px;
    position: relative;
    clear: both;
    background: #f9f9f9;
    margin: 0 auto;
    /*居中*/
}

.options .nav {
    height: 34px;
    position: relative;
}

.options .nav li {
    width: 172px;
    height: 33px;
    border: 1px solid #dbdbdb;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
}

.options .nav .active {
    width: 172px;
    height: 34px;
}

.options .con {
    width: 348px;
    border: 1px solid #dbdbdb;
    border-radius: 0 0 6px 6px;
    height: 80px;
}


<|start_filename|>vuejs练习Demo列表/表格组件的使用/index.js<|end_filename|>
/**
 * Created by huangchengdu on 16/10/18.
 */

Vue.component('demo-grid',{
	template:'#grid-template',
	props:{
		data:Array,
		columns:Array,
		filterKey:String
	},
	data:function () {
		var sortOrders = {};
		this.columns.forEach(function (key) {
			sortOrders[key] = 1;
		});//sortOrders有两个属性name和power。默认值都是1，也就是默认都是未选中状态的。
		return {
			sortKey:'',
			sortOrders:sortOrders
		};
	},
	methods:{
		//修改两个排列属性的值从而更改排序方式
		sortBy:function (key) {
			this.sortKey = key;
			this.sortOrders[key] = this.sortOrders[key] * -1;//根据不同的值，得到不同的class，改变头部的颜色
		}
	}
})

var demo = new Vue({
	el:"#demo",
	data:{
		searchQuery:'',
		gridColumns:['name','power'],
		gridData:[
			{ name: '<NAME>', power: Infinity },
			{ name: '<NAME>', power: 9000 },
			{ name: '<NAME>', power: 7000 },
			{ name: '<NAME>', power: 8000 }
		]
	}
})

<|start_filename|>构建工具之Webpack傻瓜指南之部署发布之多页面/app/sub.js<|end_filename|>
/*
 * @Author: huangchengdu
 * @Date:   2016-11-15 15:45:36
 * @Last Modified by:   huangchengdu
 * @Last Modified time: 2016-11-15 16:48:19
 */

// function generateText() {
//     var element = document.createElement('h2');
//     element.innerHTML = "Hello h2 world";
//     return element; 
// }
// module.exports = generateText;

//==========es6语法=================

export default function() {
    var element = document.createElement('h2');
    element.innerHTML = "Hello h2 world hahaha";
    return element;
}


<|start_filename|>vuejs练习Demo列表/Firebase实现实时的添加删除/index.css<|end_filename|>
body{
	font-family: Helvetica, Arial, sans-serif;
}

ul{
	padding: 0;
}

.user{
	height: 30px;
	line-height: 30px;
	padding: 10px;
	border-top: 1px solid #eee;
	overflow: hidden;
	transition: all .25s ease;
}

.user:last-child {
	border-bottom: 1px solid #ff0000;
}

/*如果 transition 特性没有值，类名默认是 .v-transition, .v-enter 和 .v-leave。*/
.v-enter, .v-leave {
	height: 0;
	padding-top: 0;
	padding-bottom: 0;
	border-top-width: 0;
	border-bottom-width: 0;
}

.errors {
	color: #f00;
}

<|start_filename|>书籍学习源码练习/Head First  html&css学习代码/chapter14/starbuzz/form.html<|end_filename|>
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>The Starbuzz Bean Machine</title>
  </head>
  <body>

    <h1>The Starbuzz Bean Machine</h1>
    <h2>Fill out the form below and click submit to order</h2>

    <form action="http://starbuzzcoffee.com/processorder.php" method="POST">
    	<p>Ship to:<br>
	    	Name:<input type="text" name="name"><br>
	    	Address:<input type="text" name="address"><br>
	    	City:<input type="text" name="city"><br>
	    	State:<input type="text" name="state"><br>
	    	Zip:<input type="text" name="zip"><br>
	    	Phone<input type="tel" name="phone"><br>
    	</p>
    	<p>
    		<input type="submit" value="Order Now">
    	</p>
    </form>
  </body>
</html>



<|start_filename|>OC与JS交互Demo列表/有趣的Demo/JavaScript-Objective-C-Bridge/JSBridgeTest/JavaScriptBridge/JavaScriptBridgeReceiver.h<|end_filename|>
//
//  JavaScriptBridgeReceiver.h
//  JSBridgeTest
//
//  Created by <NAME> on 11/03/25.
//  Copyright 2011 Kronecker's Delta Studio. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "JavaScriptBridge.h"

@interface JavaScriptBridgeReceiver : NSObject<UIWebViewDelegate> {
    JavaScriptBridge *bridge;
}

@property(nonatomic, retain) JavaScriptBridge *bridge;

- (void)feedInstructions:(NSArray *)instructions;

@end


<|start_filename|>vuejs练习Demo列表/数据流的双向绑定/index.js<|end_filename|>
new Vue({
	el:"#app",
	data:{
		newTodo:'',
		todos:[{text:"add some todos"}],

	},
	methods: {
		addTodo: function () {
			var text = this.newTodo.trim();
			if (text) {
				this.todos.push({text: text});
				this.newTodo = '';
			}
		},
		removeTodo: function (index) {
			this.todos.splice(index, 1);
		}
	},
	created:function () {
		console.log("create" + " a is:" + this.todos);
	},
	compiled:function () {
		console.log("compiled" + " a is:" + this.todos);
	},
	ready:function () {
		console.log("ready" + " a is:" + this.todos);
	},
	destroyed:function () {
		console.log("destroyed" + " a is:" + this.todos);
	}
})

<|start_filename|>书籍学习源码练习/javascript高级程序设计学习代码/chapter11.one.js<|end_filename|>
//=========================DOM扩展============================
//querySelector
//取得body元素
var body = document.querySelector("body");
//取得ID为"myDiv"的元素
var myDiv = document.querySelector("#myDiv");
//取得类为selected的第一个元素
var selected = document.querySelector(".selected");
//取得类为button的第一个图像元素
var img = document.body.querySelector("img.button");

//querySelectorAll();
//获取某div种的所有em元素
var ems = document.getElementById("myDiv").querySelectorAll("em");
//取得类为selected的所有元素
var selecteds = document.querySelectorAll(".selected");
//取得p元素中的所有strong元素
var strongs = document.querySelectorAll("p strong");




<|start_filename|>OC与JS交互Demo列表/有趣的Demo/JavaScript-Objective-C-Bridge/JSBridgeTest/JavaScriptBridge/JavaScriptBridge.h<|end_filename|>
//
//  JavaScriptBridge.h
//  Untitled
//
//  Created by <NAME> on 3/25/11.
//  Copyright 2011 Avatar Reality Inc. All rights reserved.
//

#import <Foundation/Foundation.h>


@interface JavaScriptBridge : NSObject {
	NSMutableArray *stack;
    UIWebView *webView;
    UIViewController *viewController;
}

@property(nonatomic, retain) NSMutableArray *stack;
@property(nonatomic, retain) UIWebView *webView;
@property(nonatomic, retain) UIViewController *viewController;

- (void)push:(id)operand;
- (id)pop;
- (int)stackDepth;
- (void)operate:(NSString*)op;
- (void)error:(NSString*)mesg;
- (void)eval:(NSString*)expr;

- (void)op_callback;

- (void)op_num;
- (void)op_int;
- (void)op_str;
- (void)op_hexstr;
- (void)op_hexifydata;
- (void)op_base64data;

- (void)op_hmac_sha1;
- (void)op_http_get;
- (void)op_http_post;
- (void)op_http_send;
- (void)op_store_twitter_credential;
- (void)op_twitter_credential;
- (void)op_open_url_in_new_browser;
- (void)op_close_browser;
- (void)op_close_browser;

- (void)op_create_instance;


@end



<|start_filename|>Less练习Demo/Less/style/main.css<|end_filename|>
@charset "UTF-8";
.box {
  width: 300px;
  height: 300px;
  background-color: yellow;
  border: solid 5px pink;
}
.border {
  border: solid 5px pink;
}
.test_hunhe {
  border: solid #ffff00 30px;
}
.test_hunhe_03 {
  border: solid #008000 20px;
}
.radius_test {
  width: 100px;
  height: 40px;
  background-color: green;
  -webkit-border-radius: 10px;
  -moz-border-radius: 10px;
  border-radius: 10px;
}
.sanjiao {
  border-width: 100px;
  border-color: transparent transparent #cccccc transparent;
  border-style: dashed dashed solid dashed;
  width: 0;
  height: 0;
  overflow: hidden;
}
.pipe {
  width: 200px;
  height: 200px;
  background-color: green;
  position: relative;
}
.box_02 {
  width: 1600px;
  color: #c2c2c2;
}
.list {
  width: 600px;
  margin: 30px auto;
  padding: 0;
  list-style: none;
}
.list li {
  height: 30px;
  line-height: 30px;
  background-color: pink;
  margin-bottow: 5px;
  padding: 0 10px;
}
.list a {
  float: left;
}
.list a:hover {
  color: red;
}
.list span {
  float: right;
}
.test_arguments {
  border: 40px #ff0000 solid;
}
.test_03 {
  width: calc(270px);
  height: calc(300px-30px);
}


<|start_filename|>构建工具之Webpack傻瓜指南之部署发布之多页面/app/plugin.js<|end_filename|>
/*
* @Author: huangchengdu
* @Date:   2016-11-15 17:13:07
* @Last Modified by:   huangchengdu
* @Last Modified time: 2016-11-15 17:15:13
*/

(function ( $ ) {
    const shade = "#556b2f";
    $.fn.greenify = function() {
        this.css( "color", shade );
        return this;
    };
}( jQuery ));

<|start_filename|>书籍学习源码练习/javascript高级程序设计学习代码/chapter7.one.js<|end_filename|>
//================================递归======================
// function factorial(num){
// 	if (num <= 1) {
// 		return 1;
// 	}else{
// 		return num * arguments.callee(num - 1);
// 	}
// }
// var factorial = (function f(num){
// 	if (num <= 1) {
// 		return 1;
// 	}else{
// 		return num * f(num - 1);
// 	}
// });

//================================闭包======================
// function createComparisonFunction(propertyName){
// 	return function(object1, object2){
// 		var value1 = object1[propertyName];
// 		var value2 = object2[propertyName];
// 		if (value1 < value2) {
// 			return -1;
// 		}else if(value1 > value2){
// 			return 1;
// 		}else{
// 			return 0;
// 		}
// 	};
// }
// //创建函数
// var compareNames = createComparisonFunction("name");
// //调用函数
// var result = compareNames({name:"Nicholas"}, {name:"Greg"});
// //解除对匿名函数的引用
// compareNames = null;

// function createFunctions() {
//     var result = new Array();
//     for (var i = 0; i < 10; i++) {
//         result[i] = function(num) {
//             return function() {
//                 return num;
//             };
//         }(i);
//     }
//     return result;
// }

// var name = "The Window";
// var object = {
// 	name: "My Object",
// 	getNameFunc:function(){
// 		var that = this;
// 		return function(){
// 			return that.name;
// 		};
// 	}
// };
// console.log(object.getNameFunc()());

//IE9之前
// function assignHandler(){
// 	var element = document.getElementById("someElement");
// 	var id = element.id;
// 	//闭包会引用element
// 	element.onclick = function(){
// 		console.log(id);
// 	}
// 	element = null;
// }

//================================模仿块级作用域======================
(function(){
	var now = new Date();
	if (now.getMonth() == 0 && now.getDate() == 1) {
		console.log("Happy new year!");
	}
})();

//================================私有变量======================
//我们把有权访问私有变量和私有函数的公有方法称为特权方法
// function MyObject(){
// 	var privateVariable = 10;
// 	function privateFunction(){
// 		return false;
// 	}
// 	//特权方法
// 	this.publicMethod = function(){
// 		privateVariable++;
// 		return privateFunction();
// 	};
// }
























<|start_filename|>vuejs练习Demo列表/表单控件绑定/index.js<|end_filename|>
new Vue({
	el:"#example",
	data:{
		checked:false,
		checkedNames:[],
		selectedoptions:"A",
		options:[{ text: 'One', value: 'A' },
				{ text: 'Two', value: 'B' },
				{ text: 'Three', value: 'C' }
				]
	},
	methods:{

	}
})

<|start_filename|>javascript练习Demo列表/Javascript的设计模式实现/原型模式/原型模式.js<|end_filename|>
var Plane = function(){
	this.blood = 100;
	this.attackLevel = 1;
	this.defenseLevel = 1;
};
var plane = new Plane();
plane.blood = 500;
plane.attackLevel = 10;
plane.defenseLevel = 7;

var clonePlane = Object.create(plane);
console.log(clonePlane);

//不支持create方法的浏览器中，则可以使用以下代码：
Object.create = Object.create || function(obj){
	var F = function(){};
	F.prototype = obj;
	return new F();
}

<|start_filename|>vuejs练习Demo列表/自定义指令/index.js<|end_filename|>
Vue.directive('demo', {
	bind: function () {
		console.log('demo bound!')
	},
	update: function (value) {
		this.el.innerHTML =
			'name - '       + this.name + '<br>' +
			'expression - ' + this.expression + '<br>' +
			'argument - '   + this.arg + '<br>' +
			'modifiers - '  + JSON.stringify(this.modifiers) + '<br>' +
			'value - '      + value
	}
})
var demo = new Vue({
	el: '#demo',
	data: {
		msg: 'hello!'
	}
})

Vue.directive('demotest', function (value) {
	console.log(value.color) // "white"
	console.log(value.text) // "hello!"
})

<|start_filename|>javascript练习Demo列表/Javascript的设计模式实现/单列模式/typeFive.登陆悬浮窗.js<|end_filename|>
//创建单列
var getSingle = function(fn){
	var result;
	return function(){
		return result||(result = fn.apply(this,arguments));
	}
};
//一个登陆悬浮窗对象
var createLoginLayer = function(){
	var div = document.createElement("div");
	div.innerHTML = "我是登陆悬浮窗";
	div.style.display = "none";
	document.body.append(div);
	return div;
};
//登陆悬浮窗的单列
var createSingleLoginLayer = getSingle(createLoginLayer);
document.getElementById('loginBtn').onclick = function(){
	var loginLayer = createSingleLoginLayer();
	loginLayer.style.display = "block";
};

createSingleLoginLayer();

<|start_filename|>OC与JS交互Demo列表/自己写/html5测试/html5测试/html5/offline-app/periodic.js<|end_filename|>
(function () {
  "use strict";

  require('require-kiss');

  function Periodic(fn, period) {
    this.fn = fn;
    this.period = period;
    this.interval = -1;
  }

  Periodic.prototype.run = function () {
    this.stop();
    this.start();
  };

  Periodic.prototype.start = function () {
    if (-1 !== this.interval) {
      return;
    }
    this.interval = setInterval(this.fn, this.period);
    this.fn();
  };

  Periodic.prototype.stop = function () {
    if (-1 === this.interval) {
      return;
    }
    clearInterval(this.interval);
    this.interval = -1;
  };

  function create(fn, period) {
    return new Periodic(fn, period);
  }

  module.exports.create = create;
  provide('periodic', module.exports);
}());


<|start_filename|>书籍学习源码练习/Head First Javascript学习代码/chapter7/bannerocity.css<|end_filename|>
body{
	font: 14px arial;
	text-align: center;
}

div.heading{
	margin-bottom: 25px;
}

div.field{
	margin-bottom: 5px;
	text-align: left;
}

span.help{
	color: #660000;
	font-style: italic;
}

<|start_filename|>书籍学习源码练习/javascript高级程序设计学习代码/chapter8.three.navigator对象.js<|end_filename|>
//检测所有浏览器中的插件
//非IE
function hasPlugin(name){
	name = name.toLowerCase();
	for(var i = 0; i < navigator.plugins.length; i++){
		if (navigator.plugins[i].name.toLowerCase().indexOf(name) > -1) {
			return true;
		}
	}
	return false;
}
alert(hasPlugin("Flash"));
alert(hasPlugin("QuickTime"));

//IE
function hasIEPlugin(name){
	try{
		new ActiveXObject(name);
		return true;
	}catch{
		return false;
	}
}
alert(hasIEPlugin("ShockwaveFlash.ShockwaveFlash"));
alert(hasIEPlugin("QuickTime.QuickTime"));

//针对特定插件的检测方法 Flash
function hasFlash(){
	var result = hasPlugin("Flash");
	if (!result) {
		result = hasIEPlugin("ShowckwaveFlash.ShockwaveFlash");
	}
	return result;
}
alert(hasFlash());

<|start_filename|>OC与JS交互Demo列表/有趣的Demo/JS-Call-OC/JS-Call-OC/AppDelegate.h<|end_filename|>
//
//  AppDelegate.h
//  JS-Call-OC
//
//  Created by Jakey on 14-8-6.
//  Copyright (c) 2014年 www.skyfox.org. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;

@end


<|start_filename|>html&css练习Demo列表/css练习之position.html<|end_filename|>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>position布局练习</title>
	<style type="text/css">
		h2.pos_left{
			position: relative;
			left: -20px;
		}
		h2.pos_right{
			position: relative;
			left: 50px;
		}

		h2.pos_abs{
			position: absolute;
			left: 100px;
			top: 800px;
		}

		p.one
		{
			position:fixed;
			left:5px;
			top:355px;
		}
		p.two
		{
			position:fixed;
			top:355px;
			right:5px;
		}
	</style>
</head>
<body>
<div>
	<h2>relative这是正常位置的标题,相对定位会按照元素的原始位置对该元素进行移动。</h2>
	<h2 class="pos_left">relative这个标题相对于其他正常位置的偏移</h2>
	<h2 class="pos_right">relative这个标题相对于其他正常位置的偏移</h2>
	<hr>
</div>
<div>
	<h2 class="pos_abs">这是带有绝对定位的标题</h2>
	<p>通过绝对定位，元素可以放置到页面上的任何位置。下面的标题距离页面左侧 100px，距离页面顶部 150px。</p>
	<hr>
</div>
<div>
	<p class="one">一些文本。</p>
	<p class="two">更多的文本。</p>
</div>
</body>
</html>

<|start_filename|>javascript练习Demo列表/Javascript的设计模式实现/策略模式/typeTwo.计算奖金js.js<|end_filename|>
//JavaScript 版本的策略模式

//策略类
var strategies = {
	"S":function(salary){
		return salary * 4;
	},
	"A":function(salary){
		return salary * 3;
	},
	"B":function(salary){
		return salary * 2;
	}
};
//上下环境类
var calculateBonus = function(level, salary){
	return strategies[level](salary);
};
console.log(calculateBonus("S", 2000));
console.log(calculateBonus("A", 1000));

<|start_filename|>vuejs练习Demo列表/Firebase实现实时的添加删除/index.js<|end_filename|>
/**
 * Created by huangchengdu on 16/10/18.
 */
var baseURL = 'https://vue-demo.firebaseIO.com/';
var emailRE = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;


var Users = new Firebase(baseURL + 'users')


Users.on('child_added',function (snapshot) {
	var item = snapshot.val();
	item.id = snapshot.key();
	app.users.push(item);
});
Users.on('child_removed',function (snapshot) {
	var id = snapshot.key();
	app.users.some(function (user) {
		if(user.id == id){
			app.users.$remove(user);
			return true;
		}
	});
});

var app = new Vue({
	el:'#app',
	data:{
		users:[],
		newUser:{
			name:'',
			email:''
		}
	},
	computed:{
		validation: function () {
			return {
				name: !!this.newUser.name.trim(),
				email:this.newUser.email//emailRE.test(this.newUser.email)
			}
		},
		isValid: function () {
			//通过计算数学获取当前的输入名字和邮箱
			var validation = this.validation;
			//获取所有的名字和邮箱，如果都返回true，则总体上返回true
			return Object.keys(validation).every(function (key) {
				return validation[key]
			})
		}
	},
	methods:{
		addUser:function () {
			if (this.isValid){
				Users.push(this.newUser);
				this.newUser.name = '';
				this.newUser.email = '';
			}
		},
		removeUser:function (user) {
			new Firebase(baseURL + 'users/' + user.id).remove();
		}
	}
});

<|start_filename|>vuejs练习Demo列表/表格组件的使用/index.css<|end_filename|>
body{
	font-family: Helvetica Neue, Arial, sans-serif;
	font-size: 14px;
	color: #444;
}

table{
	border: 2px solid #42b983;
	border-radius: 3px;
	background-color: #fff;
}

th{
	background-color: #42b983;
	color: rgba(255,255,255,0.66);
	cursor: pointer;
	-webkit-user-select: none;
  	-moz-user-select: none;
 	-user-select: none;
}

td{
	background-color: #f9f9f9;
}

th,td{
	min-width: 120px;
	padding: 10px 20px;
}

th.active {
  color: #fff;
}

th.active .arrow{
	opacity: 1;
}

.arrow {
  display: inline-block;
  vertical-align: middle;
  width: 0;
  height: 0;
  margin-left: 5px;
  opacity: 0.66;
}

.arrow.asc {
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 4px solid #fff;
}

.arrow.dsc {
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid #fff;
}

#search {
  margin-bottom: 10px;
}

<|start_filename|>构建工具之Webpack傻瓜指南之部署发布之多页面/app/imgs/mobile.js<|end_filename|>
import './main.scss';
import $ from 'jquery';
import 'imports?jQuery=jquery!./plugin.js';
$(document).ready(function() {
    let app = document.createElement('div');
    app.innerHTML = '<h1>Hello World</h1>';
    document.body.appendChild(app);
    $('h1').greenify(); });


<|start_filename|>OC与JS交互Demo列表/自己写/html5测试/html5测试/html5/accelerometer-and-gyroscope/style.css<|end_filename|>
#no {
  display: none;  
}

@media screen {
  html, body, div, span {
    margin: 0;
    padding: 0;
    border: 0;
    outline: 0;
    font-size: 100%;
    vertical-align: baseline;
  }     
  body {
    height: auto;
    -webkit-text-size-adjust:none;
    font-family:Helvetica, Arial, Verdana, sans-serif;
    padding:0px;
    overflow-x: hidden;   
  }   
  
  .outer {
    background: rgba(123, 256, 245, 0.9);
    padding: 0px;
    min-height: 48px;
    
  }
  
  .box {
    position: relative;
    float: left;
    width: 45%;
    padding: 7px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    background: rgba(178,215,255,0.75);
    min-height: 160px;
  } 
  
  .box2 {
    position: relative;
    float: left;
    width: 45%;
    padding: 7px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    background: rgba(178,215,255,0.75);
  } 
  
  .box span {
    display: block;
  }
  span.head {
    font-weight: bold;        
  }

}


<|start_filename|>书籍学习源码练习/Head First Javascript学习代码/chapter3/irock/cookie.js<|end_filename|>
function writeCookie (name, value, days) {
	var expires = "";
	if (days) {
		var date = new Date();
		date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
		expires = "; expires=" + date.toGMTString();
	};
	document.cookie = name + "=" + value + expires + "; path=/";
}

function readCookie(name){
	var searchName = name + "=";
	var cookies = document.cookie.split(';');
	for (var i = 0; i < cookies.length; i++) {
		var c = cookies[i];
		while(c.charAt(0) == ' ')
			c = c.substring(1, c.length);
		if (c.indexOf(searchName) == 0) {
			return c.substring(searchName.length, c.length);
		};
	};
	return null;
}

function eraseCookie(name){
	writeCookie(name, "", -1);
}



<|start_filename|>OC与JS交互Demo列表/自己写/html5测试/html5测试/html5/online-status/amionline-favinet.js<|end_filename|>
(function () {
  "use strict";

  //
  // Remote Favicon Loader Strategy
  //
  // This stragety relies on the ability to load cross-site images
  //
  // Note: When an Application Cache, this strategy will
  // only work if a NETWORK section specifies '*' or the prefix URLs
  // for each site. Using a prefix pattern will not work.

  function abort(img, i, imgs) {
    // The only way to really abort an image load
    // is with window.stop(), but this aborts any
    // ajax calls currently in progress and would
    // be a very bad idea to try here
    // http://stackoverflow.com/q/930237/151312
    // window.stop();

    // this probably doesn't do anything at all
    delete imgs[i];

    // this would have to be set to a known-good
    // cached image to have positive effect
    // img.src="";
  }

  function create(respond, options) {
    options = options || {};

    var favilist = options.favicons || []
      , tryatonce = favilist.length
      , waitfor = options.timeout || 5000
      , imgs = [];

    if (!(favilist.length > 0)) {
      tryatonce = 2;
      favilist = require('amionline-favinet-list').urls;
      favilist.sort(function() { return 0.5 - Math.random(); });
      favilist = favilist.slice(0, tryatonce);
      //throw new Error('List of favicons is empty!!!');
    }

    function request(favicon) {
      var img = new Image()
        , timeoutid = -1;

      img.src = favicon + "?_no_cache_=" + new Date().valueOf();

      // if any succeed, we're online
      function onLoad(ev) {
        clearTimeout(timeoutid);
        img.failed = false;
        // since we can't reliably abort images, we just
        // make the array size zero
        if (imgs.length !== tryatonce) {
          return;
        }
        imgs.forEach(abort);
        imgs = [];
        respond(null, 'online');
      }

      // if all fail, we're probably not online
      // if at least one succeeded, we're online
      function onError(ev) {
        var allFailed = true;
        img.failed = true;

        imgs.forEach(function (img) {
          if (true !== img.failed) {
            allFailed = false;
          }
        });

        // Also: check length for the case that one fails 
        // after another has succeeded and the array 
        // has already been cleared
        if (!allFailed || imgs.length !== tryatonce) {
          return;
        }

        imgs = [];
        // If all failed, we're probably offline
        respond(null, 'offline');
      }

      function onTimeout() {
        if (imgs.length !== tryatonce) {
          return;
        }
        imgs.forEach(abort);
        imgs = [];
        respond(new Error('timeout after ' + waitfor + 'ms'), 'offline');
      }

      img.onload = onLoad;
      img.onerror = onError;
      timeoutid = setTimeout(onTimeout, waitfor);
      imgs.push(img);
    }

    favilist.forEach(request);
  }

  exports.create = create;
  provide("amionline-favinet", exports);
}());


<|start_filename|>书籍学习源码练习/javascript高级程序设计学习代码/chapter8.one.window对象.js<|end_filename|>
//window对象同事扮演者ECMAScript中Global对象的角色，因此所有的全局作用域中声明的变量、函数、都回成为变成window对象的属性和方法。
// var age = 29;
// function sayAge(){
// 	alert(this.age);
// }
// alert(window.age);
// sayAge();
// window.sayAge();

var age = 29;
window.color = "red";
//删除失败
delete window.age;
//删除成功
delete window.color;
console.log(window.age);
console.log(window.color);


window.open("http://www.baidu.com", "topFrame");
var wroxWin = window.open("http://www.baidu.com", "wroxWindow", "height=400,width=400,top=10,left=10,resizable=yes");
wroxWin.close();
console.log(wroxWin.opener == window);//true

var blocked = false;
try{
	var wroxWin = window.open("http://www.wrox.com","_blank");
	if (wroxWin == null) {
		blocked = true;
	}
}catch(ex){
	blocked = true;
}
if (blocked) {
	console.log("弹框失败");
}

//超时调用
setTimeout("alert('Hello world')", 1000);

var timeoutId = setTimeout(function(){
	console.log("Hello world!");
},1000);
//取消
clearTimeout(timeoutId);


//间隔执行
setInterval("alert('Hello world!')",10000);
var intervalId = setInterval(function(){
	alert("hello world");
},10000);
//取消
clearInterval(intervalId);


if (confirm("Are you sure?")) {
	alert("确定");
}else{
	alert("取消");
}

var result = prompt("What is your name?","");
if (result !== null) {
	alert("Welcome, "+ result);
}
























<|start_filename|>OC与JS交互Demo列表/有趣的Demo/ObjectiveCToJavascript/Classes/calc.js<|end_filename|>
var area = function(diameter) {
	var radius = diameter/2,
	area = Math.PI * radius * radius;
	return Math.round(area*100)/100;
};

<|start_filename|>Webpack中文指南/moduleA.js<|end_filename|>
module.exports = function( value ){
    return value * 2;
}

<|start_filename|>OC与JS交互Demo列表/自己写/UIWebview、OC与JS交互/UIWebview、OC与JS交互/TestJSObject.h<|end_filename|>
//
//  TestJSObject.h
//  UIWebview、OC与JS交互
//
//  Created by huangchengdu on 15/11/19.
//  Copyright © 2015年 huangchengdu. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <JavaScriptCore/JavaScriptCore.h> 


//首先创建一个实现了JSExport协议的协议
@protocol TestJSObjectProtocol <JSExport>

//此处我们测试几种参数的情况
-(void)TestNOParameter;
-(void)TestOneParameter:(NSString *)message;
-(void)TestTowParameter:(NSString *)message1 SecondParameter:(NSString *)message2;

@end

@interface TestJSObject : NSObject<TestJSObjectProtocol>

@end


<|start_filename|>CSS3练习列表/CSS之3D立方体/index.html<|end_filename|>
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <link rel="stylesheet" type="text/css" href="./index.css">
    </head>
    <body>
    	<div class="cude">
    		<div class="surface front">
    			正面
    		</div>
    		<div class="surface left">
    			左面
    		</div>
    		<div class="surface right">
    			右面
    		</div>
    		<div class="surface bottow">
    			底面
    		</div>
    		<div class="surface top">
    			顶面
    		</div>
    		<div class="surface back">
    			背面
    		</div>
    	</div>
    </body>
</html>

<|start_filename|>javascript练习Demo列表/Javascript的设计模式实现/代理模式/typeFour.计算缓存.js<|end_filename|>
//==================计算乘积===================
var mult = function() {
    var a = 1;
    for (var i = 0, l = arguments.length; i < l; i++) {
        a = a * arguments[i];
    }
    return a;
};

//==================计算加和========================
var plus = function() {
    var a = 0;
    for (var i = 0, l = arguments.length; i < l; i++) {
        a = a + arguments[i];
    }
    return a;
};

//=====================创建缓存代理的工厂================
var createProxyFactory = function(fn) {
    var cache = {};
    return function() {
        var args = Array.prototype.join.call(arguments, ",");
        if (args in cache) {
            return cache[args];
        }
        return cache[args] = fn.apply(this, arguments);
    }
};

var proxyMult = createProxyFactory(mult);
var proxyPlus = createProxyFactory(plus);
alert(proxyMult(1, 2, 3, 4));
alert(proxyMult(1, 2, 3, 4));
alert(proxyPlus(1, 2, 3, 4));
alert(proxyPlus(1, 2, 3, 4));


<|start_filename|>javascript练习Demo列表/Javascript的设计模式实现/迭代器模式/typeone.上传控件.js<|end_filename|>
//迭代器模式是指提供一种方法顺序访问一个聚合对象中的各个元素,而又不需要暴露该对象的内部表示。
var getActiveUploadObj = function(){//IE插件上传
	try{
		return new ActiveXObject("TXFTNActiveX.FTNUpload");
	}catch(e){
		return false;
	}
};
var getFlashUploadObj = function(){//Flash上传
	if (supportFlash()) {
		var str = '<input type="application/x-shockwave-flash"></object>';
		return $(str).appendTo($('body'));
	}
	return false;
};
var getFormUploadObj = function(){//表单上传
	var str = '<input name="file" type="file" class="ui-file">';
	return $(str).appendTo($('body'));
};

//迭代器
var iteratorUploadObj = function(){
	for (var i = 0,fn; fn = arguments[i++];) {
		var uploadObj = fn;
		if (uploadObj() !== false) {
			return uploadObj;
		}
	}
};
//迭代返回正确的上传对象
var uploadObj = iteratorUploadObj(getActiveUploadObj,getFlashUploadObj,getFormUploadObj);







<|start_filename|>OC与JS交互Demo列表/有趣的Demo/OC与JS相互调用经典实例/NativeJsWebView/njwAppDelegate.h<|end_filename|>
//
//  njwAppDelegate.h
//  NativeJsWebView
//
//  Created by <NAME> on 5/27/13.
//  Copyright (c) 2013 <NAME>. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface njwAppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;

@end


<|start_filename|>Weex学习/WEEX入门/WEEX入门/SingleDefine.h<|end_filename|>
//
//  SingleDefine.h
//  Ticket
//
//  Created by huangchengdu on 17/2/22.
//  Copyright © 2017年 <NAME>. All rights reserved.
//

#ifndef SingleDefine_h
#define SingleDefine_h


//.h文件   ##表示拼接字符
#define SingletonH(methodName) +(instancetype)shared##methodName;
//.m文件
#define SingletonM(methodName)\
\
static id _instance = nil;\
+(instancetype)sharedSingleton{\
return [[self alloc] init];\
}\
+(instancetype)allocWithZone:(struct _NSZone *)zone{\
static dispatch_once_t onceToken;\
dispatch_once(&onceToken, ^{\
_instance = [super allocWithZone:zone];\
});\
return _instance;\
}\
- (instancetype)init{\
static dispatch_once_t onceToken;\
dispatch_once(&onceToken, ^{\
_instance = [super init];\
});\
return _instance;\
}\
- (id)copyWithZone:(NSZone *)zone{\
return  _instance;\
}\
+ (id)copyWithZone:(struct _NSZone *)zone{\
return  _instance;\
}

#endif /* SingleDefine_h */


<|start_filename|>书籍学习源码练习/Head First  html&css学习代码/chapter9/lounge-mobile.css<|end_filename|>
body{
	font-size: small;
	font-family: Verdana,Helvetica,Arical,sans-serif;
	line-height: 1.6em;
}
h1,h2{
	color: #007e7e;
}
h1{
	font-size: 150%;
}
h2{
	font-size: 130%;
}

#guarantee{
	line-height: 1.9em;
	font-style: italic;
	font-family: Georgia,"Times New Roman",Times,serif;
	color: #444444;
	border-color: white;
	border-width: 1px;
	border-style: dashed;
	background-color: #a7cece;
	padding: 25px;
	margin: 30px;
	/*
	padding-left: 80px;
	margin-right: 250px;
	background-image: url(images/background.gif);
	background-repeat: no-repeat;
	background-position: top left;
	*/
}

<|start_filename|>javascript练习Demo列表/Javascript的设计模式实现/命令模式/typeone.菜单程序.js<|end_filename|>
//命令模式最常见的应用场景是:有时候需要向某些对象发送请求,但是并不知道请求的接收 者是谁,也不知道被请求的操作是什么。此时希望用一种松耦合的方式来设计程序,使得请求发送者和请求接收者能够消除彼此之间的耦合关系。
var setCommand = function(button, func){
	button.onclick = function(){
		func();
	}
};
var MenuBar = {
	refresh:function(){
		console.log("刷新菜单界面");
	}
};
var RefreshMenuBarCommand = function(receiver){
	return function(){
		receiver.refresh();
	}
};

//初始化命令
var refreshMenuBarCommand = RefreshMenuBarCommand(MenuBar);
//发送命令
setCommand(button1,refreshMenuBarCommand);










<|start_filename|>构建工具之Webpack傻瓜指南之部署发布之多页面/webpack.production.config.js<|end_filename|>
/*
 * @Author: huangchengdu
 * @Date:   2016-11-15 15:52:36
 * @Last Modified by:   huangchengdu
 * @Last Modified time: 2016-11-15 18:06:53
 */


var path = require('path');
var HtmlwebpackPlugin = require('html-webpack-plugin');
var webpack = require('webpack');
//定义了一些文件夹的路径 
var ROOT_PATH = path.resolve(__dirname);
var APP_PATH = path.resolve(ROOT_PATH, 'app');
var BUILD_PATH = path.resolve(ROOT_PATH, 'build');
//Template的文件夹路径
var TEM_PATH = path.resolve(ROOT_PATH, 'templates');

module.exports = {
    //项目的文件夹 可以直接用文件夹名称 默认会找index.js 也可以确定是哪个文件名字
    entry: {
        app: path.resolve(APP_PATH, 'index.js'),
        //添加要打包在vendors里面的库
        vendors: ['jquery', 'moment'],
        mobile: path.resolve(APP_PATH, 'mobile.js'),
    },
    //输出的文件名 合并以后的js会命名为bundle.js 
    output: {
        path: BUILD_PATH,
        //注意 我们修改了bundle.js 用一个数组[name]来代替，他会根据entry的入口文件名称生成多个js文件，这里就是(app.js,mobile.js和vendors.js)
        filename: '[name].[hash].js'
    },
    //添加我们的插件 会自动生成一个html文件 
    plugins: [
        //这个使用uglifyJs压缩你的js代码
        new webpack.optimize.UglifyJsPlugin({ minimize: true }),
        //把入口文件里面的数组打包成verdors.js 
        new webpack.optimize.CommonsChunkPlugin('vendors', 'vendors.js'),

        //创建了两个HtmlWebpackPlugin的实例，生成两个页面 
        new HtmlwebpackPlugin({
            title: 'Hello World app',
            template: path.resolve(TEM_PATH, 'index.html'),
            filename: 'index.html',
            //chunks这个参数告诉插件要引用entry里面的哪几个入口 
            chunks: ['app', 'vendors'],
            //要把script插入到标签里 
            inject: 'body'
        }),
        new HtmlwebpackPlugin({
            title: 'Hello Mobile app',
            template: path.resolve(TEM_PATH, 'mobile.html'),
            filename: 'mobile.html',
            chunks: ['mobile', 'vendors'],
            inject: 'body'
        })

    ],
    //通过不同的模块处理不同类型的文件
    module: {
        perLoaders: [{
            test: /\.jsx?$/,
            include: APP_PATH,
            loader: 'jshint-loader'
        }],
        loaders: [{
            test: /\.scss$/,
            loaders: ['style', 'css', 'sass'],
            include: APP_PATH
        }, {
            test: /\.(png|jpg)$/,
            loader: 'url?limit=40000'
        }, {
            test: /\.jsx?$/,
            loader: 'babel',
            include: APP_PATH,
            query: {
                presets: ['es2015']
            }
        }]
    },
};


<|start_filename|>OC与JS交互Demo列表/自己写/html5测试/html5测试/html5/gyroscope/index.html<|end_filename|>
<!DOCTYPE html> 
<html manifest="main.manifest">
  <head> 
    <title>Accelerometer</title> 

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
    <meta name="apple-touch-fullscreen" content="yes" /> 
    <meta name="apple-mobile-web-app-capable" content="yes" /> 
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> 

    <!-- link rel="stylesheet" type="text/css" href="style.css" media="screen" /-->
    <link rel="apple-touch-icon" href="gyroscope.png" /> 
    <script src="app.js"></script> 
  </head> 
 
  <body> 
    This tests both the accelerometer and gyroscope of.
    <div id="bad-news">&nbsp;</div>
    <div id="no"> 
      Your browser does not support Device Orientation and Motion API. Try this sample with iPhone, iPod or iPad with iOS 4.2+.    
    </div> 
    <h2>Device Motion Events</h2>

    acceleration
    <br/>
    X: <span id="x">&nbsp;</span>
    <br/>
    Y: <span id="y">&nbsp;</span>
    <br/>
    Z: <span id="z">&nbsp;</span>
    <br/>

    rotationRate  
    <br/>
    alpha:<br/>
    <span id="r-alpha">&nbsp;</span>
    <br/>

    beta:<br/>
    <span id="r-beta">&nbsp;</span>
    <br/>

    gamma:<br/>
    <span id="r-gamma">&nbsp;</span>
    <br/>

    <br/>
    interval: <span id="interval">&nbsp;</span>
    <br/>

    <h2>Device Orientation Event</h2>

    alpha (z-axis) (0, 360):<br/>
    <span id="alpha">&nbsp;</span>

    <br/>

    beta (x-axis) (-180, 180):<br/>
    <span id="beta">&nbsp;</span>

    <br/>

    gamma (y-axis) (-90, 90):<br/>
    <span id="gamma">&nbsp;</span>
  </body> 
</html> 


<|start_filename|>vuejs练习Demo列表/模态组件/index.js<|end_filename|>
/**
 * Created by huangchengdu on 16/10/19.
 */


Vue.component('modal',{
	template:'#modal-template',
	props:{
		show:{
			type:Boolean,
			required:true,
			twoWay:true
		}
	}
})

new Vue({
	el:'#app',
	data:{
		showModal:false
	}
})

<|start_filename|>书籍学习源码练习/Head First Javascript学习代码/chapter12/untitled.js<|end_filename|>
function AjaxRequest () {
	if (window.XMLHttpRequest) {
		try{
			this.request = new XMLHttpRequest();
		}catch(e){
			this.request = nulll
		}
	}else if (window.ActiveXObject){
		try{
			this.request = new ActiveXObject("Msxml2.XMLHTTP");
		}catch(e){
			try {
		        this.request = new ActiveXObject("Microsoft.XMLHTTP");
		    } catch(e) {
		        this.request = null;
		    }
		}
		
	}
	if (this.request == null)
    	alert("Ajax error creating the request.\n" + "Details: " + e);`
}

<|start_filename|>OC与JS交互Demo列表/有趣的Demo/JavaScript-Objective-C-Bridge/JSBridgeTest/JavaScriptBridge/Util.h<|end_filename|>
/*
 *  Util.h
 *  JSBridgeTest
 *
 *  Created by <NAME> on 11/04/15.
 *  Copyright 2011 Kronecker's Delta Studio. All rights reserved.
 *
 */

#ifdef DEBUG_MODE
#define DebugLog( s, ... ) NSLog( @"<%s : (%d)> %@",__func__, __LINE__, [NSString stringWithFormat:(s), ##__VA_ARGS__] )
#else
#define DebugLog( s, ... ) 
#endif

#define ErrorLog( s, ... ) NSLog( @"<ERROR: %s : (%d)> %@",__func__, __LINE__, [NSString stringWithFormat:(s), ##__VA_ARGS__] )


<|start_filename|>书籍学习源码练习/Head First Javascript学习代码/chapter10/youcube/youcube.js<|end_filename|>
//Date类扩展一个类方法
Date.prototype.shortFormat = function() {
	return (this.getMonth() + 1) + "/" + this.getDate() + "/" + this.getFullYear();

};

//Blog类的初始化方法
function Blog (body, date, image) {
	this.body = body;
	this.date = date;
	this.image = image;
}
//Blog类的实例方法，所有实例对象都只有这么一份
Blog.prototype.toString = function(){
	return "[" + this.date.shortFormat() + "]" + this.body;
};
Blog.prototype.toHTML = function(highlight) {
    var blogHTML = "";
    blogHTML += highlight ? "<p style='background-color:#EEEEEE'>" : "<p>";
    //blog对象是否有image元素
    if (this.image) {
      blogHTML += "<strong>" + this.date.shortFormat() + "</strong><br /><table><tr><td><img src='" +
        this.image + "'/></td><td style='vertical-align:top'>" + this.body + "</td></tr></table><em>" +
        this.signature + "</em></p>";
    }
    else {
      blogHTML += "<strong>" + this.date.shortFormat() + "</strong><br />" + this.body +
        "<br /><em>" + this.signature + "</em></p>";
    }
    return blogHTML;
};
Blog.prototype.containsText = function(text){
	return (this.body.toLowerCase().indexOf(text.toLowerCase()) != -1);
};

//添加一个类属性,所有的Blog对象分享一份。
Blog.prototype.signature = "签名：黄成都你还";

//类方法。这个方法只有Blog类可以调用。Blog类的对象也不可以调用，而且不能访问Blog的成员属性
Blog.blogSorter = function(blog1, blog2){
	return blog2.date - blog1.date;
};


      var blog = [ new Blog("Got the new cube I ordered. It's a real pearl.", new Date("08/14/2008")),
                   new Blog("Solved the new cube but of course, now I'm bored and shopping for a new one.", new Date("08/19/2008")),
                   new Blog("Managed to get a headache toiling over the new cube. Gotta nap.", new Date("08/16/2008")),
                   new Blog("Found a 7x7x7 cube for sale online. Yikes! That one could be a beast.", new Date("08/21/2008")),
                   new Blog("Met up with some fellow cubers to discuss the prospect of a 7x7x7 cube. Mixed feelings.", new Date("08/29/2008")),
                   new Blog("Went ahead and ordered the scary 7x7x7 cube. Starting a mental exercise regimen to prepare.", new Date("09/01/2008")),
                   new Blog("Attended a rally outside of a local toy store that stopped carrying cube puzzles. Power to the puzzlers!", new Date("09/03/2008")),
                   new Blog("Got the new 7x7x7 cube. Could be my last blog post for a while...", new Date("09/05/2008")),
                   new Blog("Wow, it took me a couple of weeks but the new cube is finally solved!", new Date("09/19/2008"), "cube777.png") ];

      // Show the list of blog entries
      function showBlog(numEntries) {
        // First sort the blog
        blog.sort(Blog.blogSorter);

        // Adjust the number of entries to show the full blog, if necessary
        if (!numEntries)
          numEntries = blog.length;

        // Show the blog entries
        var i = 0, blogListHTML = "";
        while (i < blog.length && i < numEntries) {
          blogListHTML += blog[i].toHTML(i % 2 == 0);
          i++;
        }

        // Set the blog HTML code on the page
        document.getElementById("blog").innerHTML = blogListHTML;
      }

      // Search the list of blog entries for a piece of text
      function searchBlog() {
        var searchText = document.getElementById("searchtext").value;
        for (var i = 0; i < blog.length; i++) {
          // See if the blog entry contains the search text
          if (blog[i].containsText(searchText)) {
            alert(blog[i]);
            break;
          }
        }

        // If the search text wasn't found, display a message
        if (i == blog.length)
          alert("Sorry, there are no blog entries containing the search text.");
      }
      // Display a randomly chosen blog entry
      function randomBlog() {
        // Pick a random number between 0 and blog.length - 1
        var i = Math.floor(Math.random() * blog.length);
        alert(blog[i]);
      }

<|start_filename|>书籍学习源码练习/javascript高级程序设计学习代码/chapter11.three.html5.js<|end_filename|>
//取得所有类中包含username和current的元素、类名的先后顺序无所谓
var allCurrentUsernames = document.getElementsByClassName("username current");
//获取ID为myDIv的元素中带有类名selected的所有yuansu
var selected = document.getElementById("myDiv").getElementsByClassName("selected");

//<div class="bd user disabled">...</div>  这个元素有三个类  下面实现删除user类
var classNames = div.className.split(/\s+/);//取得类名字符串并拆分成数组
var pos = -1,
i,
len;
for (var i = 0 len = classNames.length; i < len; i++) {
	if (classNames[i] == "user") {
		pos = i;
		break;
	}
}
//删除类名
classNames.splice(i,1);
//把剩下的类名拼成字符串并重新设置
div.className = classNames.join(" ");


//html5 实现删除类名
div.classList.remove("disabled");
//添加current类
div.classList.add("current");


//焦点管理
var button = document.getElementById("myButton");
button.focus();
console.log(document.activeElement === button);

var button = document.getElementById("myButton");
button.focus();
console.log(document.hasFocus());//true

//文档状态
if (document.readyState == "complete") {
	console.log("文档加载完毕");
}else{
	console.log("文档正在加载");
}

//字符集属性
console.log(document.charset);
document.charset = "UTF-8";

<|start_filename|>WebPack经典入门学习/WebPack/builds/bundle.js<|end_filename|>
/******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};

/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {

/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId])
/******/ 			return installedModules[moduleId].exports;

/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			exports: {},
/******/ 			id: moduleId,
/******/ 			loaded: false
/******/ 		};

/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);

/******/ 		// Flag the module as loaded
/******/ 		module.loaded = true;

/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}


/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;

/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;

/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "";

/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {

	import './styles.scss';

	if (document.querySelectorAll('a').length) {
	    !/* require.ensure */(() => {
	        const Button = __webpack_require__(1);
	        const button = new Button('google.com');

	        button.render('a');
	    }(__webpack_require__));
	}

	if (document.querySelectorAll('h1').length) {
	    !/* require.ensure */(() => {
	        const Header = __webpack_require__(2);

	        new Header().render('h1');
	    }(__webpack_require__));
	}

/***/ },
/* 1 */
/***/ function(module, exports) {

	import $ from 'jquery';
	import template from './Button.html';
	import Mustache from 'mustache';
	import './Button.scss';

	export default class Button {
	    constructor(link) {
	        this.link = link;
	    }

	    onClick(event) {
	        event.preventDefault();
	        alert(this.link);
	    }

	    render(node) {
	        const text = $(node).text();

	        // Render our button
	        $(node).html(Mustache.render(template, {
	            text
	        }));

	        // Attach our listeners
	        $('.button').click(this.onClick.bind(this));
	    }
	}

/***/ },
/* 2 */
/***/ function(module, exports) {

	import $ from 'jquery';
	import Mustache from 'mustache';
	import template from './Header.html';
	import './Header.scss';

	export default class Header {
	    render(node) {
	        const text = $(node).text();

	        $(node).html(Mustache.render(template, { text }));
	    }
	}

/***/ }
/******/ ]);

<|start_filename|>书籍学习源码练习/Head First  html&css学习代码/chapter3/journal.html<|end_filename|>
<html>
	<head>
		<title>My Trip Around the USA on a Segway</title>
	</head>
	<body>
		<h1>Segway'n USA</h1>
		<p>
			Documenting my trip around the US on my very own Segway!
		</p>
		
		<h2>August 20, 2012</h2>
		<img src="images/segway2.jpg">
		<p>
			Well I made it 1200 miles already, and I passed through some interesing places on the way：Walla Walla,WA,Magic City,ID,Bountiful,UT,Last Chance,CO,Why,AZ,and Truth or Consequences,NM.
		</p>
		
		<h2>July 14,2012</h2>
		<p>
			I saw some Burma Shave style signs on the side of the road today:"Passing cars,when you can‘t see,dsf是大法官实打实地告诉对方公司打工。	
		</p>
		
		<h2>June 2, 2012</h2>
		<img src="images/segway1.jpg">
		<p>
			My first day of the trip! I can't believe I finally got everything packed and ready to go. Because I'm on a Segway, I wasn't able to bing a whole lot with me:
			<ul>
				<li>cell phone</li>
				<li>ipod</li>
				<li>digital camera</li>
				<li>and a protein bar</li>
			</ul>
			Just the essentials.AS Lao Tzu would have said,<q>A journey of a thousand miles begins with one Segway.</q>
		</p>
	</body>
</html>

<|start_filename|>html&css练习Demo列表/css练习之对齐.html<|end_filename|>
<!DOCTYPE html>
<html>
<head>
	<title>css练习之对齐</title>
	<meta charset="utf-8">
	<style type="text/css">
		body{
			margin: 0;
			padding: 0;
		}
		.center{
			margin: auto;
			width: 70%;
			background-color: #b0e0e6;
		}

		.container{
			position: relative;
			width: 100%;
			background-color: #b0e0d4;
		}
		.right{
			position: absolute;
			right: 0px;
			width: 300px;
			background-color: #b0e0e6;
		}
		.floatleft{
			float: left;
			width: 400px;
			background-color: #bff0e6;
		}
	</style>
</head>
<body>
	<div class="center">
		<p>这是一个段落、居中对齐、通过margin：auto实现，并且指定宽度是父容器的百分之七十</p>
		<p><b>注释：</b>除非已经声明了 !DOCTYPE，否则使用 margin:auto 在 IE8 以及更早的版本中是无效的。</p>
	</div>


	<div class="container">
		<div class="right">
			<p><b>注释：</b>当使用 position 属性进行对齐时，请始终包含 !DOCTYPE 声明！如果省略，则会在 IE 浏览器中产生奇怪的结果。</p>
		</div>
	</div>
	<div class="floatleft">
		<p>这是一个段落，靠左对齐。是通过flaot:left实现</p>
	</div>
</body>
</html>

<|start_filename|>OC与JS交互Demo列表/自己写/html5测试/html5测试/html5/flashcards/presentation.css<|end_filename|>
.landscape {background-color: #153279;}
.portrait {background-color: #793215;}


<|start_filename|>Weex学习/weexnew/src/css/index.css<|end_filename|>
/*
* @Author: huangchengdu
* @Date:   2017-03-07 11:03:49
* @Last Modified by:   huangchengdu
* @Last Modified time: 2017-03-07 11:30:51
*/
.fixed-button1 {
  position: absolute;
  bottom: 50px;
  right: 50px;
  background-color: #FC6621;
  border-radius: 10px;
  width: 120px;
  padding: 15px;
  color: white;
  text-align: center;
}

<|start_filename|>webpack官方Demo/HtmlCss/src/index.js<|end_filename|>
 import _ from 'lodash';
 import './style.less';
 import './style.css';
 import Icon from './icon.png';
 import Data from './data.xml';

 function component() {
     var element = document.createElement('div');
     element.innerHTML = _.join(['Hello', 'webpack'], ' ');
     element.classList.add('hello');
     element.classList.add('lessFont');
     document.body.appendChild(element);
     var element1 = document.createElement('div');
     element1.innerHTML = JSON.stringify(Data);
     document.body.appendChild(element1);
 }
 component();

<|start_filename|>OC与JS交互Demo列表/自己写/html5测试/html5测试/html5/config.js<|end_filename|>
(function () {
  "use strict";

  module.exports = {
    port: 3080
  };
}());


<|start_filename|>OC与JS交互Demo列表/自己写/html5测试/html5测试/html5/flashcards/behavior.js<|end_filename|>
(function (w, d, k) {
   var bkch;
   bkch = w[k] = {};
   bkch.w = w;
   bkch.d = d;
   bkch.f = (function () {
      return {
         init : function () {
            bkch.s = bkch.d.getElementsByTagName('BODY')[0];
            bkch.s.addEventListener("touchmove", function (e) { e.preventDefault(); }, false);
            bkch.w.setTimeout(bkch.f.orient, 0);
            bkch.w.onorientationchange = function () {
               bkch.f.orient();
            };
         },
         orient : function () {
            if (bkch.w.orientation === 0) {
               bkch.s.className = 'portrait';
            } else {
               bkch.s.className = 'landscape';
            }
            bkch.w.setTimeout(bkch.f.home, 0);
         },
         home : function () {
            bkch.w.scrollTo(0, 1);
         }
      };
   }());
   bkch.f.init();
}(window, document, 'backchannel'));


<|start_filename|>html&css练习Demo列表/手把手教你实现电商网站开发/ds/style/main.css<|end_filename|>
/*公用*/
.comWidth{
	width: 1000px;
	margin-left: auto;
	margin-right: auto;
}
.leftArea{
	float: left;
}
.rightArea{
	float: right;
}
.hide{
	display: none;
}
.show{
	display: block;
}

/*topBar*/
.topBar{
	height: 31px;
	background-color: #F7F7F7;
	line-height: 31px;
}
.collection{
	background: url(../images/icon/collection.jpg) left center no-repeat;
	padding-left: 19px;
	font-weight: bold;
}
.topBar a:hover{
	color: red;
}
/*logoBar*/
.logoBar{
	height: 85px;
	background-color: #1D7AD9;
}
.logo{
	padding-left: 41px;
	padding-top: 13px;
}
/*search*/
.search_box{
	width: 430px;
	padding-top: 23px;
	padding-left: 185px;
}
.search_text{
	width: 350px;
	height: 35px;
	line-height: 35px\9;/*css hack \9代表所有的IE浏览器*/
	padding: 0 5px;
	background-color: white;
}
.search_btn{
	width: 70px;
	height: 35px;
	font-size: 14;
	font-family: "Microsoft YaHei","微软雅黑";
	background-color: #FF8C00;
	color: #FFFFFF;
}
/*购物车*/
.shopCar{
	width: 145px;
	height: 35px;
	background-color: #FF8C00;
	margin-top: 23px;
	margin-right: 59px;

	font-size: 14px;
	font-family: "Microsoft YaHei" "微乳雅黑";
	color: #FFFFFF;
	line-height: 35px;
}
.shopText{
	height: 100%;
	width: 87px;
	border-right: #E27A00 solid 1px;
	background: url(../images/icon/shaoIcon.jpg) 10px center no-repeat;
	text-indent: 40px;/*首行缩进*/
}
/*87 + 1 + 27 + 1 + 29 = 145;*/
.shopNum{
	width: 27px;
	height: 35px;
	border-left: #FF9c01 solid 1px;
	background: url(../images/icon/sj.jpg) 33px center no-repeat;
	text-align: right;
	padding-right: 29px;
}

/*导航*/
.navBox{
	height: 35px;
	background-color: #1369C0;
	color: #FFFFFF;
}
.shopClass{
	width: 190px;
	position: relative;
}
.shopClass h3{
	line-height: 35px;
	text-align: center;
}
.shopClass i{
	width: 11px;
	height: 7px;
	overflow: hidden;
	background: url(../images/icon/down.jpg) left center no-repeat;
	display: inline-block;
	margin-left: 11px;
}
.nav,.shopClass{
	font-family: "Microsoft YaHei", "微软雅黑";
}
.nav{
	line-height: 35px;
}
.nav li{
	float: left;
}
.nav a{
	height: 35px;
	display: inline-block;
	padding: 0 35px;
	color: #FFFFFF;
}
.nav .active{
	background-color: #4593FD;
}

/*商品弹出列表*/
.shopClass_show{
	background-color: #4593FD;
	position: absolute;
	left: 0;
	top: 35px;
	width: 100%;
}
.shopClass_item{
	padding: 14px 10px;
	border-bottom: #3487F2 solid 1px;
	border-top: #5AA1FE solid 1px;
}
.shopClass_item dt{
	height: 22px;
	background: url(../images/icon/shop_sj.jpg) right center no-repeat;
}
.shopClass_item .b h3{
	font:14px/1 "Microsoft YaHei", "微软雅黑";
}
.shopClass_item a{
	color: #FFFFFF;
}
.shopClass_item .aLink{
	width: 48px;
	height: 20px;
	background: url(../images/icon/aLink_bg.png) left center no-repeat;
	display: inline-block;
	text-align: center;
	line-height: 20px;
	text-decoration: underline;
}
/*shopClass_item active 状态*/
.shopClass_active{
	background-color: #fff;
	border-left: #4593FD solid 1px;
}
.shopClass_active dt{
	background: none;
}
.shopClass_active a{
	color: #000;
}
.shopClass_active .aLink{
	color: #fff;
	text-decoration: none;
}

/*弹出的菜单*/
.shopClass_list{
	width: 568px;
	/*height: 378px;*//*让他自适应子视图的高度*/
	border:#ccc solid 1px;
	position: absolute;
	left: 190px;
	top: 35px;
	/*background: red;*/
}
.shopClass_count{
	padding: 0 20px;
}
.shopList_item{
	padding: 10px 0;
	border-bottom: #CCC solid 1px;
}
.shopList_item dt{
	color: #4b87d9;
	line-height: 24px;
	font-weight: bold;
	height: 24px;
}
.shopList_item dd{
	padding-left: 68px;
	line-height: 24px;
	margin-top: -24px;/*相当于上移24px与dt同级*/
}
.shopList_item dd a{
	margin-right: 12px;
}
.shopList_links{
	padding: 15px 0;
}
.shopList_links a{
	color: #fff;
	background-color: #2785E6;
	height: 26px;
	line-height: 26px;
	font-size: 12px;
	display: inline-block;
	padding: 0 14px 0 8px;
	margin-right: 10px;
}
.shopList_links span{
	width: 11px;
	height: 7px;
	background: url(../images/icon/shop_sj.jpg) left center no-repeat;
	display: inline-block;
	margin-left: 7px;
}

/*banner部分*/
.banner{
	margin-bottom: 15px;
}
.banner_bar{
	float: right;
	position: relative;
	overflow: hidden;
}
.imgBox{
	position: absolute;
	left: 0;
	top: 0;
}
.imgBox li{
	float: left;
}
.imgBox img{
	display: block;
}
.imgNum{
	position: absolute;
	left: 0;
	bottom: 15px;
	width: 100%;
	text-align: center;
}
.imgNum a{
	width: 20px;
	height: 5px;
	overflow: hidden;
	background-color: #fff;
	display: inline-block;
	margin: 0 3px;
}
.imgNum .active{
	background-color: #ff7700;
}
.banner_big,.banner_big img{
	width: 810px;
	height: 326px;
}
.banner_big .imgBox{
	width: 1620px;
	height: 326px;
}
.banner_sm,.banner_sm img{
	width: 190px;
	height: 400px;
}
.banner_sm .imgBox{
	width: 380px;
	height: 400px;
}

/*商品标题*/
.shopTit{
	height: 44px;
	font-family: "Microsoft YaHei","微软雅黑";
	line-height: 44px;
	margin-bottom: 15px;
}
.shopTit h3{
	font-size: 24px;
	float: left;
	font-weight: normal;
	padding-left: 15px;
}
.icon{
	width: 44px;
	height: 44px;
	background: url(../images/icon/shopIcon.jpg) left top no-repeat;
	float: left;
}
.more{
	float: right;
	font-family: "宋体";
}
.more:hover{
	text-decoration: underline;
}

/*商品列表*/
.shopList .leftArea{
	width: 190px;
}
.shopList .rightArea{
	width: 810px;
}








<|start_filename|>OC与JS交互Demo列表/有趣的Demo/JavaScript-Objective-C-Bridge/JSBridgeTest/Classes/JSBridgeTestAppDelegate.h<|end_filename|>
//
//  JSBridgeTestAppDelegate.h
//  JSBridgeTest
//
//  Created by <NAME> on 11/03/25.
//  Copyright 2011 Kronecker's Delta Studio. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface JSBridgeTestAppDelegate : NSObject <UIApplicationDelegate> {
    
    UIWindow *window;
    UINavigationController *navigationController;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UINavigationController *navigationController;

@end



<|start_filename|>OC与JS交互Demo列表/有趣的Demo/JavaScript-Objective-C-Bridge/JSBridgeTest/JavaScriptBridge/NSStringAdditions.h<|end_filename|>
//
//  NSStringAdditions.h
//  JSBridgeTest
//
//  Created by <NAME> on 11/03/27.
//  Copyright 2011 Kronecker's Delta Studio. All rights reserved.
//

// copied from http://stackoverflow.com/questions/392464/any-base64-library-on-iphone-sdk

#import <Foundation/NSString.h>

@interface NSString (NSStringAdditions)

+ (NSString *) base64StringFromData:(NSData *)data length:(int)length;

@end


<|start_filename|>OC与JS交互Demo列表/有趣的Demo/JavaScript-Objective-C-Bridge/JSBridgeTest/html/script.js<|end_filename|>
var connectionDelegate = {}

function __hex (hexdata) {
    var data = hexdata.replace (/([a-f0-9]){2}/ig, function (x) {
        return String.fromCharCode (parseInt (x, 16))
    })

    return data
}

// event must be one of following: fail, recv, response, sent, finish
function add_connection_handler (connid, event, func) {
    if (! connectionDelegate[connid])
        connectionDelegate[connid] = {}
    connectionDelegate[connid][event] = func
}

function connectionDidFailWithError (connid, err) {
    var hndl = connectionDelegate[connid]
    if (hndl && hndl.fail) {
        hndl.fail (connid, err)
    } else {
        $("pre").append ("\nconnectionDidFailWithError: " + connid + ": " + err)
    }
}

function connectionDidReceiveData (connid, data) {
    var hndl = connectionDelegate[connid]
    if (hndl && hndl.recv) {
        hndl.recv (connid, data)
    } else {
        $("pre").append ("\nconnectionDidReceiveData: " + connid + ": " + data)
    }
}

function connectionDidReceiveResponse (connid) {
    var hndl = connectionDelegate[connid]
    if (hndl && hndl.response) {
        hndl.response (connid)
    } else {
        $("pre").append ("\nconnectionDidReceiveResponse: " + connid)
    }
}

function connectionDidSendBodyData (connid) {
    var hndl = connectionDelegate[connid]
    if (hndl && hndl.sent) {
        hndl.sent (connid)
    } else {
        $("pre").append ("\nconnectionDidSendBodyData: " + connid)
    }
}

function connectionDidFinishLoading (connid) {
    var hndl = connectionDelegate[connid]
    if (hndl && hndl.finish) {
        hndl.finish (connid)
    } else {
        $("pre").append ("\nconnectionDidFinishLoading: " + connid)
    }
}

////////////////////

function create_stack () {
    return []
}

function stack_push_raw_string (st, val) {
    st.push ("-" + val)
}

function stack_push_operator (st, op) {
    st.push ("@" + op)
}

function hexify (str) {
    var hex = ""
    for (var i = 0; i < str.length; i ++) {
        hex += str.charCodeAt (i).toString (16)
    }

    return hex
}

function stack_push_string (st, op) {
    if (typeof (op) != "string")
        op = op.toString ()

    if (op.match (/^[a-zA-Z0-9!@#$%^&*()_+{}|\[\]\:";'<>?,]*$/)) {
        stack_push_raw_string (st, op)
    } else {
        stack_push_raw_string (st, hexify (op))
        stack_push_operator (st, "hexstr")
        stack_push_operator (st, "str")
    }
}

function stack_push_data (st, op) {
    if (typeof (op) != "string")
        op = op.toString ()

    stack_push_raw_string (st, hexify (op))
    stack_push_operator (st, "hexstr")
}

function stack_execute (st) {
    var uri = "bridge:///" + st.join ("/")

    setTimeout (function () {
        location.href = uri
    }, 100)
}

JSBridgeStack = function () {
    this.stack = create_stack ()
}

JSBridgeStack.prototype.push = function () {
    for (var i = 0; i < arguments.length; i ++) {
        stack_push_string (this.stack, arguments[i])
    }
    return this
}

JSBridgeStack.prototype.pushdata = function () {
    for (var i = 0; i < arguments.length; i ++) {
        stack_push_data (this.stack, arguments[i])
    }
    return this
}

JSBridgeStack.prototype.operate = function (op) {
    stack_push_operator (this.stack, op)
    return this
}

JSBridgeStack.prototype.pushcallback = function (name, numargs) {
    return this.push (name, numargs).operate ("callback")
}

JSBridgeStack.prototype.execute = function () {
    stack_execute (this.stack)
}

///////////////////

function escape_utf8 (str) {
    return encodeURIComponent (str)
}

function oauth_make_signature_base (url, method, params, request_body) {
    var params_sorted = []
    for (var i in params) {
        params_sorted.push ([i, params[i]])
    }
    params_sorted.sort (function (a, b) {return a > b ? 1 : -1})

    console.debug (params_sorted)

    var body = $.map (params_sorted, function (a) {
        return a[0] + "=" + escape_utf8 (a[1])
    }).join ("&")

    if (request_body)
        body += "&" + request_body

    var base = $.map ([method, url, body], escape_utf8).join ("&")

    return base
}

CALLBACK = []
var GLOBAL = this
function make_callback (func) {
    CALLBACK.push (func)
    var name = "CALLBACK_" + (CALLBACK.length - 1).toString ()
    GLOBAL[name] = function () {
        try {
            return func.apply (this, arguments)
        } catch (err) {
            alert (err)
        }
    }
    return name
}

function test_twitter_oauth () {
    var consumer_secret = "<KEY>"
    var url = "https://api.twitter.com/oauth/request_token"
    var method = "POST"
    var params = {
        oauth_callback: "http://localhost:3005/the_dance/process_callback?service_provider_id=11",
        oauth_consumer_key: "<KEY>",
        oauth_nonce: "QP70eNmVz8jvdPevU3oJD2AfF7R7odC2XJcn4XlZJqk",
        oauth_signature_method: "HMAC-SHA1",
        oauth_timestamp: "1272323042",
        oauth_version: "1.0"
    }

    var base = oauth_make_signature_base (url, method, params)
    console.assert (base == "POST&https%3A%2F%2Fapi.twitter.com%2Foauth%2Frequest_token&oauth_callback%3Dhttp%253A%252F%252Flocalhost%253A3005%252Fthe_dance%252Fprocess_callback%253Fservice_provider_id%253D11%26oauth_consumer_key%3DGDdmIQH6jhtmLUypg82g%26oauth_nonce%3DQP70eNmVz8jvdPevU3oJD2AfF7R7odC2XJcn4XlZJqk%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1272323042%26oauth_version%3D1.0")

        // console.assert (sig == "8wUi7m5HFQy76nowoCThusfgB+Q=")

}

function disassemble_response (res) {
    var dest = {}
    var arr = res.split ("&")
    for (var i in arr) {
        var namevalue = arr[i].split ("=", 2)
        dest[namevalue[0]] = namevalue[1]
    }

    return dest
}

function http_get (url, header, cont) {
    var cb2 = make_callback (function (connhandle, connid) {
        var res = ""

        add_connection_handler (connid, "recv", function (connid, data) {
            res += data.toString ()
        })

        add_connection_handler (connid, "finish", function (connid) {
            if (cont)
                cont (res)
        })

        new JSBridgeStack ().push (connhandle).operate ("http_send").execute ()
    })

    var jsb = new JSBridgeStack ()
    var n = 0
    for (var f in header) {
        jsb.push (header[f], f)
        n ++
    }
    jsb.push (n, url).operate ("http_get").pushcallback (cb2, 2).execute ()
}

function http_post (url, header, body, cont) {
    var cb2 = make_callback (function (connhandle, connid) {
        var res = ""

        add_connection_handler (connid, "recv", function (connid, data) {
            res += data.toString ()
        })

        add_connection_handler (connid, "finish", function (connid) {
            if (cont)
                cont (res)
        })

        new JSBridgeStack ().push (connhandle).operate ("http_send").execute ()
    })

    var jsb = new JSBridgeStack ()
    jsb.pushdata (body)
    var n = 0
    for (var f in header) {
        jsb.push (header[f], f)
        n ++
    }
    jsb.push (n, url).operate ("http_post").pushcallback (cb2, 2).execute ()
}

function make_oauth_header (params, sig) {
    var x = []
    for (var name in params) {
        var value = params[name]
        x.push (name + "=\"" + escape_utf8 (value) + "\"")
    }
    x.push ("oauth_signature" + "=\"" + escape_utf8 (sig) + "\"")
    var auth = "OAuth " + x.join (", ")

    return auth
}

function tweet (consumer_key, consumer_secret, oauth_token, oauth_token_secret, text, cont) {
    var params = {
        oauth_consumer_key: consumer_key,
        oauth_nonce: "tweet" + Date.now (),
        oauth_signature_method: "HMAC-SHA1",
        oauth_token: oauth_token,
        oauth_timestamp: Math.floor (Date.now () / 1000).toString (),
        oauth_version: "1.0"
    }

    var url = "http://api.twitter.com/1/statuses/update.json"
    var method = "POST"
    var body = "status=" + escape_utf8 (text)
    var base = oauth_make_signature_base (url, method, params, body)

    new JSBridgeStack ().push (base).push(consumer_secret + "&" + oauth_token_secret).operate ("hmac_sha1").operate ("base64data").pushcallback (
        make_callback (function (sig) {
            var auth = make_oauth_header (params, sig)

            http_post (url, {Authorization: auth}, body, function (res) {
                var data = eval ("(" + res + ")")

                if (cont)
                    cont (data)
            })
        }), 1).execute ()
}

function oauth_request_token_params (consumer_key, oauth_cb) {
    var params = {
        oauth_callback: "bridge-callback://" + oauth_cb + "/",
        oauth_consumer_key: consumer_key,
        oauth_nonce: "hoge" + Date.now (),
        oauth_signature_method: "HMAC-SHA1",
        oauth_timestamp: Math.floor (Date.now () / 1000).toString (),
        oauth_version: "1.0"
    }

    return params
}

function oauth_access_token_params (consumer_key, oauth_token, oauth_verifier) {
    var params = {
        oauth_consumer_key: consumer_key,
        oauth_nonce: "hoge2" + Date.now (),
        oauth_signature_method: "HMAC-SHA1",
        oauth_token: oauth_token,
        oauth_timestamp: Math.floor (Date.now () / 1000).toString (),
        oauth_verifier: oauth_verifier,
        oauth_version: "1.0"
    }

    return params
}

function oauth_access_token (consumer_key, consumer_secret, oauth_token_secret, oauth_token, oauth_verifier, cont) {
    var params = oauth_access_token_params (consumer_key, oauth_token, oauth_verifier)

    var url = "https://api.twitter.com/oauth/access_token"
    var method = "POST"
    var base = oauth_make_signature_base (url, method, params)

    new JSBridgeStack ().push (base, consumer_secret + "&" + oauth_token_secret).operate ("hmac_sha1").operate ("base64data").pushcallback (make_callback (function (sig) {
        var auth = make_oauth_header (params, sig)

        http_post (url, {Authorization: auth}, "", function (res) {
            var data = disassemble_response (res)

            if (cont) {
                cont (data.oauth_token, data.oauth_token_secret)
            }
        })

    }), 1).execute ()
}

function oauth_request_token (consumer_key, consumer_secret, cont) {
    var stat = {}

    var params = oauth_request_token_params (consumer_key, cont (stat))
    var url = "http://api.twitter.com/oauth/request_token"
    var method = "POST"
    var base = oauth_make_signature_base (url, method, params)

    new JSBridgeStack ().push (base, consumer_secret + "&").operate ("hmac_sha1").operate ("base64data").pushcallback (make_callback (function (sig) {
        // $("pre").append ("\n" + "oauth_request_token: signature: " + sig)

        var auth = make_oauth_header (params, sig)

        http_post (url, {Authorization: auth}, "", function (res) {
            var data = disassemble_response (res)
            stat.oauth_token_secret = data.oauth_token_secret

            // new JSBridgeStack ().push (data.oauth_token_secret, data.oauth_token).operate ("store_oauth_token").pushcallback (make_callback (function () {
                new JSBridgeStack ().push ("http://api.twitter.com/oauth/authorize?oauth_token=" + data.oauth_token).operate ("open_url_in_new_browser").
                    pushcallback (make_callback (function (hndl) {
                        stat.browser_handle = hndl;
                    }), 1).execute ()
            // }), 0).execute ()
        })
    }), 1).execute ()
}

function twitter_oauth (consumer_key, consumer_secret, cont) {
    oauth_request_token (consumer_key, consumer_secret, function (stat) {
        return make_callback (function (data) {
            var browser_handle = stat.browser_handle
            var oauth_token_secret = stat.browser_handle

            var res = __hex (data)
            // $("pre").append ("\n" + "OAuth callback: " + res)

            new JSBridgeStack ().push ("OAuth callback: " + res).operate ("print").
                push (browser_handle).operate ("close_browser").
                execute ()

            var token = disassemble_response (res)

            oauth_access_token (consumer_key, consumer_secret, oauth_token_secret, token.oauth_token, token.oauth_verifier, cont)
        })
    })
}

function home_timeline (consumer_key, consumer_secret, oauth_token, oauth_token_secret, cont) {
    // $("pre").append ("\nhome_timeline: \n -" + [consumer_key, consumer_secret, oauth_token, oauth_token_secret, cont].join ("\n -"))

    var params = {
        oauth_consumer_key: consumer_key,
        oauth_nonce: "timeline" + Date.now (),
        oauth_signature_method: "HMAC-SHA1",
        oauth_token: oauth_token,
        oauth_timestamp: Math.floor (Date.now () / 1000).toString (),
        oauth_version: "1.0"
    }

    var url = "http://api.twitter.com/1/statuses/home_timeline.json"
    var method = "GET"
    var base = oauth_make_signature_base (url, method, params)

    new JSBridgeStack ().push (base).push(consumer_secret + "&" + oauth_token_secret).operate ("hmac_sha1").operate ("base64data").pushcallback (
        make_callback (function (sig) {
            var auth = make_oauth_header (params, sig)

            http_get (url, {Authorization: auth}, function (res) {
                var data = eval ("(" + res + ")")

                if (cont)
                    cont (data)
            })
        }), 1).execute ()
}

//////////////////////

function make_tweet_elem (t) {
    var id = t.id
    var text = t.text
    var screen_name = t.user.screen_name
    var elem = $("<div>").css ({margin: "0px", "max-width": "320px"}).
        append ($("<p>").css ({margin: "0px"}).text ("@" + screen_name)).
        append ($("<p>").css ({margin: "0px"}).text (text))

    return elem
}

function test_objc (tweets) {
    var tweet_map = {}

    new JSBridgeStack ().
        push ("UITableViewController").operate ("look_up_class").operate ("create_instance").
        push (make_callback (function (selector) {
            var f = ({
                numberOfSectionsInTableView: function () {
                    return 1;
                },
                tableView_numberOfRowsInSection: function (section) {
                    return tweets.length;
                },
                tableView_cellForRowAtIndexPath: function (section, row) {
                    var t = tweets[row]
                    var elem = tweet_map[t.id]
                    if (! elem) {
                        elem = make_tweet_elem (t)
                        tweet_map[t.id] = elem
                    }
                    var outer = $("<html>").append ($("<body>").css ({margin: "0px", padding: "0px"})).append (elem)
                    return outer.html ()
                },
                tableView_heightForRowAtIndexPath: function (section, row) {
                    var t = tweets[row]
                    var elem = tweet_map[t.id]
                    if (! elem) {
                        elem = make_tweet_elem (t)
                        tweet_map[t.id] = elem
                    }
                    var outer = $("<div>").append (elem)
                    $("body").append (outer)
                    var height = outer.innerHeight ()
                    outer.remove ()
                    return height
                }
            })[selector]

            var args = []
            for (var i = 1; i < arguments.length; i ++) {
                args.push (arguments[i])
            }
            var ret = f.apply (this, args)
            return ret
        })).operate ("xxx_pushtable").
        // operate ("self")
        // operate ("send_mesg")
        pushcallback (make_callback (function (hndl) {
            $("pre").append ("\ntable view controller: " + hndl)
        }), 1).execute ()
}

//////////////////////


////////////////////

$(document).ready (function () {
    var consumer_secret = "<KEY>"
    var consumer_key = "7IoQbg88rT3GJ01HlTOc9A"

    try {
        // test_objc ([1, 2, 3])
        // throw ("done")

        new JSBridgeStack ().operate ("twitter_credential").pushcallback (make_callback (function (oauth_token, oauth_token_secret) {
            if (oauth_token && oauth_token.length > 0 && oauth_token_secret && oauth_token_secret.length > 0) {
                // tweet (consumer_key, consumer_secret, oauth_token, oauth_token_secret, "てすと。 " + Date.now (), function (res) {
                //     $("pre").append ("\nTweet: " + res.id + " " + res)
                // })

                home_timeline (consumer_key, consumer_secret, oauth_token, oauth_token_secret, function (data) {
                    test_objc (data)
                    // new JSBridgeStack ().push (data.toString ()).operate ("print").execute ()
                })
            } else {
                twitter_oauth (consumer_key, consumer_secret, function (oauth_token, oauth_token_secret) {
                    new JSBridgeStack ().push (oauth_token_secret, oauth_token).operate ("store_twitter_credential").execute ()
                    tweet (consumer_key, consumer_secret, oauth_token, oauth_token_secret, "setting up my twitter 私のさえずりを設定する " + Date.now (), function (res) {
                        $("pre").append ("\nTweet: " + res.id + " " + res)
                    })
                })
            }
        }), 2).execute ()
    } catch (err) {
        alert (err)
    }
})


<|start_filename|>书籍学习源码练习/javascript高级程序设计学习代码/chapter6.three.继承.js<|end_filename|>
//=============================原型链=========================
// function SuperType() {
// 	this.property = true;
// }
// SuperType.prototype.getSuperValue = function(){
// 	return this.property;
// };
// function SubType(){
// 	this.subproperty = false;
// }
// //继承了 SuperType
// SubType.prototype = new SuperType();
// SubType.prototype.getSubValue = function(){
// 	return this.subproperty;
// };
// var instance = new SubType();
// console.log(instance.getSuperValue());
// console.log(instance instanceof Object);
// console.log(instance instanceof SuperType);
// console.log(instance instanceof SubType);
// console.log(Object.prototype.isPrototypeOf(instance));
// console.log(SuperType.prototype.isPrototypeOf(instance));
// console.log(SubType.prototype.isPrototypeOf(instance));

//=============================借用构造函数====================
// function SuperType(){
// 	this.colors = ["red", "blue", "green"];
// }
// function SubType(){
// 	SuperType.call(this);
// }
// var instance1 = new SubType();
// instance1.colors.push("black");
// console.log(instance1.colors);
// var instance2 = new SubType();
// console.log(instance2.colors);

// function SuperType(name){
// 	this.name = name;
// }
// function SubType(){
// 	SuperType.call(this,"Nicholas");
// 	this.age = 29;
// }
// var instance = new SubType();
// console.log(instance.name);
// console.log(instance.age);

//=============================组合继承====================
// function SuperType(name){
// 	this.name = name;
// 	this.colors = ["red", "blue", "green"];
// }
// SuperType.prototype.sayName = function(){
// 	console.log(this.name);
// };
// function SubType(name, age){
// 	SuperType.call(this, name);
// 	this.age = age;
// }
// SubType.prototype = new SuperType();
// SubType.prototype.constructor = SubType;
// SubType.prototype.sayAge = function(){
// 	console.log(this.age);
// };
// var instance1 = new SubType("Nicholas", 29);
// instance1.colors.push("black");
// console.log(instance1.colors);
// instance1.sayName();
// instance1.sayAge();

// var instance2 = new SubType("Greg", 27);
// console.log(instance2.colors);
// instance2.sayName();
// instance2.sayAge();


//=============================原型式继承====================
// var person = {
// 	name: "Nicholas",
// 	friends: ["Shelby", "Court", "Van"]
// };
// var anotherPerson = Object.create(person,{
// 	name:{
// 		value: "Greg"
// 	}
// });
// console.log(anotherPerson.name);

//=============================寄生式继承====================
// function object(o){
// 	function F(){}
// 	F.prototype = o;
// 	return new F();
// }
// function createAnother(original){
// 	var clone = object(original);
// 	clone.sayHi = function(){
// 		console.log("hi");
// 	}
// 	return clone;
// }
// var person = {
//     name: "Nicholas",
//     friends: ["Shelby", "Court", "Van"]
// };
// var anotherPerson1 = createAnother(person);
// anotherPerson1.friends.push("Van");
// console.log(anotherPerson1.friends);
// anotherPerson1.sayHi(); 
// var anotherPerson2 = createAnother(person);
// console.log(anotherPerson2.friends);
// anotherPerson2.sayHi(); 

//=============================寄生组合式继承====================
function object(o){
	function F(){}
	F.prototype = o;
	return new F();
}
function inheritPrototype(subType, superType){
	var prototype = object(superType.prototype);
	prototype.constructor = subType;
	subType.prototype =prototype;
}
function SuperType(name){
    this.name = name;
    this.colors = ["red", "blue", "green"];
}
SuperType.prototype.sayName = function(){
    console.log(this.name);
};
function SubType(name, age){
    SuperType.call(this, name);
    this.age = age;
}
inheritPrototype(SubType, SuperType);
SubType.prototype.sayAge = function(){
    console.log(this.age);
   };













































<|start_filename|>javascript练习Demo列表/javascript创建对象的其中模式.js<|end_filename|>
/*
* @Author: huangchengdu
* @Date:   2016-11-17 11:02:45
* @Last Modified by:   huangchengdu
* @Last Modified time: 2016-11-17 11:22:55
*/

//============工厂模式===============
function createPerson(name,age,job) {
	var o = new Object();
	o.name = name;
	o.age = age;
	o.job = job;
	o.sayName = function(){
		alert(this.name);
	}
	return o;
}
var person1 = createPerson("wei",25,"software");
var person1 = createPerson("bu",25,"software");

//===============构造函数模式=============
function Person(name,age,job){
	this.name = name;
	this.age = age;
	this.job = job;
	this.sayName = function(){
		alert(this.name);
	}
}
var person1 = new Person("wei",25,"software");
var person2 = new Person("bu",25,"software");
console.log(person1 instanceof Object);



<|start_filename|>vuejs练习Demo列表/过渡/index.js<|end_filename|>
new Vue({
	el:"#repeat-object",
	data:{
		show: true,
		//transitionName: 'bounce'//可选
	},
	methods:{
		testShow:function (event) {
			this.show = !this.show;
		}
	}
})
// 这里的名字必须和css和html的名字一致才能都起作用。如果css和js中只有一个名字相同，则名字相同的那个起作用。
Vue.transition('bounce', {

	beforeEnter: function (el) {
		el.textContent = 'beforeEnter'
	},
	enter: function (el) {
		el.textContent = 'enter'
	},
	afterEnter: function (el) {
		el.textContent = 'afterEnter'
	},
	enterCancelled: function (el) {
		// handle cancellation
	},

	beforeLeave: function (el) {
		el.textContent = 'beforeLeave'
	},
	leave: function (el) {
		el.textContent = 'leave'
	},
	afterLeave: function (el) {
		el.textContent = 'afterLeave'
	},
	leaveCancelled: function (el) {
		// handle cancellation
	}
})

<|start_filename|>Weex学习/WEEX入门/WEEX入门/POCWeexManager.h<|end_filename|>
//
//  POCWeexManager.h
//  Ticket
//
//  Created by Bob on 17/3/9.
//  Copyright © 2017年 <NAME>. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <WeexSDK/WeexSDK.h>

#define _POC_CONCAT2(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, ...) A1##_0_##A2##_0_##A3##_0_##A4##_0_##A5##_0_##A6##_0_##A7##_0_##A8##_0_##A9
#define _POC_CONCAT(...) _POC_CONCAT2(__VA_ARGS__, _, _, _, _, _, _, _, _, _, _)

#define POCExport(Selector, ...) @optional Selector _POC_CONCAT(__POC_EXPORT__, __VA_ARGS__):(id)argument; @required Selector
//#define POCConvertOne(Selector, ...) @optional _POC_CONCAT(Selector, __POC_EXPORT__, __VA_ARGS__); @required Selector

@class POCBridge;

typedef void (^POCCallback)(NSError *error, NSArray *args);

@protocol POCWeexManagerExport <NSObject>

POCExport(
+(void)initWeexSDK:(NSDictionary *)params);

+(void)resetWeexManagerEnv;

@end

@interface POCWeexManager : NSObject<POCWeexManagerExport>

+(id)shareInstance;
- (void)initBridgeEnvironment;

- (NSString *)setWeexCallbackFunc:(id)func;
- (NSString *)setPocCallbackFunc:(id)func;
- (WXModuleCallback)weexCallbackFunc:(NSString *)callbackId;
- (POCCallback)pocCallbackFunc:(NSString *)callbackId;
@end


<|start_filename|>构建工具之Webpack傻瓜指南之开发/app/index.js<|end_filename|>
/*
 * @Author: huangchengdu
 * @Date:   2016-11-15 15:45:19
 * @Last Modified by:   huangchengdu
 * @Last Modified time: 2016-11-15 16:52:05
 */

//var sub = require('./sub');
import generateText from './sub';

//require('./main.css');

require('./main.scss');

var $ = require('jquery');
var moment = require('moment');

// var app = document.createElement('div');
// app.innerHTML = '<h1>Hello World test</h1>';
// app.appendChild(sub());
// document.body.appendChild(app);

// $('body').append('<p>look at me! now is ' + moment().format() + '</p>');


//================下面是es6语法
let app = document.createElement('div');
const myPromise = Promise.resolve(42);
myPromise.then((number) => { 
	$('body').append('<p>promise result is ' + number + ' now is ' + moment().format() + '</p>'); 
});
app.innerHTML = '<h1>Hello World it</h1>';
document.body.appendChild(app);
app.appendChild(generateText());


<|start_filename|>Weex学习/WEEX入门/WEEX入门/WXJSBridgeModuleProtocol.h<|end_filename|>
//
//  WXJSBridgeModuleProtocol.h
//  WeexDemo
//
//  Created by Bob on 17/3/8.
//  Copyright © 2017年 taobao. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <WeexSDK/WXModuleProtocol.h>

@protocol WXJSBridgeModuleProtocol <WXModuleProtocol>

- (void)sendMessageToPOCJSContext:(NSDictionary *)message callback:(WXModuleCallback)callback;


@end


<|start_filename|>CSS3练习列表/CSS之水中倒影/index.css<|end_filename|>
/*
* @Author: huangchengdu
* @Date:   2017-02-14 14:40:13
* @Last Modified by:   huangchengdu
* @Last Modified time: 2017-02-14 16:52:54
*/
.box,.box-reflect{
	width: 150px;
	float: left;
	margin-right: 40px;
}
img{
	width: 100%;
	display: block;
}
.box1 img{
	-webkit-box-reflect:below 0 -webkit-linear-gradient(top,rgba(250,250,250,0),rgba(250,250,250,.0) 20%,rgba(250,250,250,.3));
}

.box2 img{
	-webkit-box-reflect:below 0 url('./star.png');
}


.box-reflect {
    position: relative;
}

.box-reflect img {
    width: 100%;
    height: 100%;
}

.box-reflect:before,
.box-reflect:after {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 100%;
    left: 0;
    content: "";
}


.box-reflect:before {
    background: url(./example.jpg) no-repeat;
    background-size: 100% 100%;
    -webkit-transform: scaleY(-1);
    -moz-transform: scaleY(-1);
    -ms-transform: scaleY(-1);
    -o-transform: scaleY(-1);
    transform: scaleY(-1);
    opacity: 0.5;
    filter: alpha(opacity='50');
}

.box-reflect:after {
    background-image: -moz-linear-gradient(bottom, rgb(0, 0, 0) 20%, rgba(0, 0, 0, 0) 90%);
    background-image: -o-linear-gradient(rgba(0, 0, 0, 0) 10%, rgb(0, 0, 0) 30%);
    background-image: -webkit-linear-gradient(bottom, rgb(0, 0, 0) 20%, rgba(0, 0, 0, 0) 90%);
    filter: progid: DXImageTransform.Microsoft.Gradient(gradientType=0, startColor=0, EndColorStr=#000000);
}

<|start_filename|>OC与JS交互Demo列表/自己写/WKWebView的使用及js交互/WKWebView的使用及js交互/ViewController.h<|end_filename|>
//
//  ViewController.h
//  WKWebView的使用及js交互
//
//  Created by huangchengdu on 15/12/17.
//  Copyright © 2015年 huangchengdu. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController


@end



<|start_filename|>OC与JS交互Demo列表/自己写/html5测试/html5测试/html5/online-status/require-kiss.js<|end_filename|>
/*jslint onevar: true, undef: true, newcap: true, regexp: true, plusplus: true, bitwise: true, devel: true, maxerr: 50, indent: 2 */
/*global module: true, exports: true, provide: true */
var global = global || (function () { return this; }()),
  __dirname = __dirname || '';
(function () {
  "use strict";

  var thrownAlready = false;

  function ssjsProvide(exports) {
    module.exports = exports || module.exports;
  }

  function resetModule() {
    global.module = {};
    global.exports = {};
    global.module.exports = exports;
  }

  function normalize(name) {
    if ('./' === name.substr(0,2)) {
      name = name.substr(2);
    }
    return name;
  }

  function browserRequire(name) {
    var module,
      msg = "One of the included scripts requires '" + 
        name + "', which is not loaded. " +
        "\nTry including '<script src=\"" + name + ".js\"></script>'.\n";

    name = normalize(name);
    module = global.__REQUIRE_KISS_EXPORTS[name] || global[name];

    if ('undefined' === typeof module && !thrownAlready) {
      thrownAlready = true;
      alert(msg);
      throw new Error(msg);
    }

    return module;
  }

  function browserProvide(name, new_exports) {
    name = normalize(name);
    global.__REQUIRE_KISS_EXPORTS[name] = new_exports || module.exports;
    resetModule();
  }

  if (global.require) {
    if (global.provide) {
      return;
    }
    global.provide = ssjsProvide;
    return;
  }

  global.__REQUIRE_KISS_EXPORTS = global.__REQUIRE_KISS_EXPORTS || {};
  global.require = global.require || browserRequire;
  global.provide = global.provide || browserProvide;
  resetModule();

  provide('require-kiss');
}());


<|start_filename|>javascript练习Demo列表/Javascript的设计模式实现/策略模式/typeOne.计算奖金.js<|end_filename|>
//策略模式：定义一系列的算法,把它们一个个封装起来,并且使它们可以相互替换1。

//传统面向对象语言的策略模式

//不同的策略类
var performanceS = function(){};
performanceS.prototype.calculate = function(salary){
	return salary * 4;
};
var performanceA = function(){};
performanceA.prototype.calculate = function(salary){
	return salary * 3;
};
var performanceB = function(){};
performanceB.prototype.calculate = function(salary){
	return salary * 2;
};
//上下文环境类
var Bonus = function(){
	this.salary = null;
	this.strategy = null;
};
Bonus.prototype.setSalary = function(salary){
	this.salary = salary;
};
Bonus.prototype.setStrategy = function(strategy){
	this.strategy = strategy;
};
Bonus.prototype.getBonus = function(){
	return this.strategy.calculate(this.salary);
};

var bonus = new Bonus();
bonus.setSalary(10000);
bonus.setStrategy(new performanceS());
console.log(bonus.getBonus());
bonus.setStrategy(new performanceA());
console.log(bonus.getBonus());

<|start_filename|>OC与JS交互Demo列表/有趣的Demo/OC与JS相互调用经典实例/NativeJsWebView/njwViewController.h<|end_filename|>
//
//  njwViewController.h
//  NativeJsWebView
//
//  Created by <NAME> on 5/27/13.
//  Copyright (c) 2013 <NAME>. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface njwViewController : UIViewController<UIWebViewDelegate, UITextFieldDelegate>
@property (weak, nonatomic) IBOutlet UITextField *fNameTextField;
@property (weak, nonatomic) IBOutlet UITextField *lNameTextField;
@property (weak, nonatomic) IBOutlet UIWebView *webView;
- (IBAction)didTapUpdateWebView:(id)sender;

@end


<|start_filename|>vuejs练习Demo列表/github提交/index.html<|end_filename|>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/html">
<head>
    <meta charset="UTF-8">
    <title>vuejs练习</title>
    <link rel="stylesheet" type="text/css" href="index.css">
</head>
<body>
<div id="demo">
    <h1>Latest Vue.js Commits</h1>
    <template v-for="branch in branches">
        <input type="radio" :id="branch" :value="branch" v-model="currentBranch">
        <label :for="branch">{{branch}}</label>
    </template>
    <p>vuejs/vue@{{currentBranch}}</p>
    <ul>
        <li v-for="record in commits">
            <a :href="record.html_url" target="_blank" class="commit">{{record.sha.slice(0,7)}}</a>
            -<span class="message">{{record.commit.message | truncate}}</span></br>
            by <span class="author">{{record.commit.author.name}}</span>
            at <span class="date">{{record.commit.author.date | formatDate}}</span>
        </li>
    </ul>
</div>
    <script src='../vue.min.js'></script>
    <script src="index.js"></script>
</body>
</html>

<|start_filename|>OC与JS交互Demo列表/自己写/html5测试/html5测试/html5/offline-app/future.js<|end_filename|>
// promise, future, deliver, fulfill
var provide = provide || function () {};
(function () {
  "use strict";

  var MAX_INT = Math.pow(2,52);

  function isFuture(obj) {
    return obj instanceof future;
  }

  function futureTimeout(time) {
    this.name = "FutureTimeout";
    this.message = "timeout " + time + "ms";
  }



  function future(global_context) {
    var everytimers = {},
      onetimers = {},
      index = 0,
      deliveries = 0,
      time = 0,
      fulfilled,
      data,
      timeout_id,
      //asap = false,
      asap =  true,
      passenger,
      self = this;

    // TODO change `null` to `this`
    global_context = ('undefined' === typeof global_context ? null : global_context);


    function resetTimeout() {
      if (timeout_id) {
        clearTimeout(timeout_id);
        timeout_id = undefined;
      }

      if (time > 0) {
        timeout_id = setTimeout(function () {
          self.deliver(new futureTimeout(time));
          timeout_id = undefined;
        }, time);
      }
    }



    self.isFuture = isFuture;

    self.setContext = function (context) {
      global_context = context;
    };

    self.setTimeout = function (new_time) {
      time = new_time;
      resetTimeout();
    };



    self.errback = function () {
      if (arguments.length < 2) {
        self.deliver.call(self, arguments[0] || new Error("`errback` called without Error"));
      } else {
        self.deliver.apply(self, arguments);
      }
    };



    self.callback = function () {
      var args = Array.prototype.slice.call(arguments);

      args.unshift(undefined);
      self.deliver.apply(self, args);
    };



    self.callbackCount = function() {
      return Object.keys(everytimers).length;
    };



    self.deliveryCount = function() {
      return deliveries;
    };



    self.setAsap = function(new_asap) {
      if (undefined === new_asap) {
        new_asap = true;
      }
      if (true !== new_asap && false !== new_asap) {
        throw new Error("Future.setAsap(asap) accepts literal true or false, not " + new_asap);
      }
      asap = new_asap;
    };



    // this will probably never get called and, hence, is not yet well tested
    function cleanup() {
      var new_everytimers = {},
        new_onetimers = {};

      index = 0;
      Object.keys(everytimers).forEach(function (id) {
        var newtimer = new_everytimers[index] = everytimers[id];

        if (onetimers[id]) {
          new_onetimers[index] = true;
        }

        newtimer.id = index;
        index += 1;
      });

      onetimers = new_onetimers;
      everytimers = new_everytimers;
    }



    function findCallback(callback, context) {
      var result;
      Object.keys(everytimers).forEach(function (id) {
        var everytimer = everytimers[id];
        if (callback === everytimer.callback) {
          if (context === everytimer.context || everytimer.context === global_context) {
            result = everytimer;
          }
        }
      });
      return result;
    }



    self.hasCallback = function () {
      return !!findCallback.apply(self, arguments);
    };



    self.removeCallback = function(callback, context) {
      var everytimer = findCallback(callback, context);
      if (everytimer) {
        delete everytimers[everytimer.id];
        onetimers[everytimer.id] = undefined;
        delete onetimers[everytimer.id];
      }

      return self;
    };



    self.deliver = function() {
      if (fulfilled) {
        throw new Error("`Future().fulfill(err, data, ...)` renders future deliveries useless");
      }
      var args = Array.prototype.slice.call(arguments);
      data = args;

      deliveries += 1; // Eventually reaches `Infinity`...

      Object.keys(everytimers).forEach(function (id) {
        var everytimer = everytimers[id],
          callback = everytimer.callback,
          context = everytimer.context;

        if (onetimers[id]) {
          delete everytimers[id];
          delete onetimers[id];
        }

        // TODO
        callback.apply(context, args);
        /*
        callback.apply(('undefined' !== context ? context : newme), args);
        context = newme;
        context = ('undefined' !== global_context ? global_context : context)
        context = ('undefined' !== local_context ? local_context : context)
        */
      });

      if (args[0] && "FutureTimeout" !== args[0].name) {
        resetTimeout();
      }

      return self;
    };



    self.fulfill = function () {
      if (arguments.length) {
        self.deliver.apply(self, arguments);
      } else {
        self.deliver();
      }
      fulfilled = true;
    };



    self.whenever = function (callback, local_context) {
      var id = index,
        everytimer;

      if ('function' !== typeof callback) {
        throw new Error("Future().whenever(callback, [context]): callback must be a function.");
      }

      if (findCallback(callback, local_context)) {
        // TODO log
        throw new Error("Future().everytimers is a strict set. Cannot add already subscribed `callback, [context]`.");
        return;
      }

      everytimer = everytimers[id] = {
        id: id,
        callback: callback,
        context: (null === local_context) ? null : (local_context || global_context)
      };

      if (asap && deliveries > 0) {
        // doesn't raise deliver count on purpose
        everytimer.callback.apply(everytimer.context, data);
        if (onetimers[id]) {
          delete onetimers[id];
          delete everytimers[id];
        }
      }

      index += 1;
      if (index >= MAX_INT) {
        cleanup(); // Works even for long-running processes
      }

      return self;
    };



    self.when = function (callback, local_context) {
      // this index will be the id of the everytimer
      onetimers[index] = true;
      self.whenever(callback, local_context);

      return self;
    };


    //
    function privatize(obj, pubs) {
      var result = {};
      pubs.forEach(function (pub) {
        result[pub] = function () {
          obj[pub].apply(obj, arguments);
          return result;
        };
      });
      return result;
    }

    passenger = privatize(self, [
      "when",
      "whenever"
    ]);

    self.passable = function () {
      return passenger;
    };

  }

  function Future(context) {
    // TODO use prototype instead of new
    return (new future(context));
  }
  Future.isFuture = isFuture;
  module.exports = Future;

  provide('futures/future');
}());


<|start_filename|>OC与JS交互Demo列表/自己写/html5测试/html5测试/html5/accelerometer-and-gyroscope/app.js<|end_filename|>
      // Position Variables
      var x = 0;
      var y = 0;
      var z = 0;
 
      // Speed - Velocity
      var vx = 0;
      var vy = 0;
      var vz = 0;
 
      // Acceleration
      var ax = 0;
      var ay = 0;
      var az = 0;
      var ai = 0;
      var arAlpha = 0;
      var arBeta = 0;
      var arGamma = 0;
 
      var delay = 100;
      var vMultiplier = 0.01;     var alpha = 0;
    
      var alpha = 0;
      var beta = 0;
      var gamma = 0;
      
      
      if (window.DeviceMotionEvent==undefined) {
        document.getElementById("no").style.display="block";
        document.getElementById("yes").style.display="none";
      } 
      else {
        window.ondevicemotion = function(event) {
          ax = Math.round(Math.abs(event.accelerationIncludingGravity.x * 1));
          ay = Math.round(Math.abs(event.accelerationIncludingGravity.y * 1));
          az = Math.round(Math.abs(event.accelerationIncludingGravity.z * 1));    
          ai = Math.round(event.interval * 100) / 100;
          rR = event.rotationRate;
          if (rR != null) {
            arAlpha = Math.round(rR.alpha);
            arBeta = Math.round(rR.beta);
            arGamma = Math.round(rR.gamma);
          }
 
/*          
          ax = Math.abs(event.acceleration.x * 1000);
          ay = Math.abs(event.acceleration.y * 1000);
          az = Math.abs(event.acceleration.z * 1000);   
  */        
        }
                
        window.ondeviceorientation = function(event) {
          alpha = Math.round(event.alpha);
          beta = Math.round(event.beta);
          gamma = Math.round(event.gamma);
        }       
        
        function d2h(d) {return d.toString(16);}
        function h2d(h) {return parseInt(h,16);}
        
        function makecolor(a, b, c) {
          red = Math.abs(a) % 255;
          green = Math.abs(b) % 255;
          blue = Math.abs(c) % 255;
          return "#" + d2h(red) + d2h(green) + d2h(blue);
        }
        
        function makeacceleratedcolor(a, b, c) {
          red = Math.round(Math.abs(a + az) % 255);
          green = Math.round(Math.abs(b + ay) % 255);
          blue = Math.round(Math.abs(c + az) % 255);
          return "#" + d2h(red) + d2h(green) + d2h(blue);
        }
 
        setInterval(function() {
          document.getElementById("xlabel").innerHTML = "X: " + ax;
          document.getElementById("ylabel").innerHTML = "Y: " + ay;
          document.getElementById("zlabel").innerHTML = "Z: " + az;                   
          document.getElementById("ilabel").innerHTML = "I: " + ai;                   
          document.getElementById("arAlphaLabel").innerHTML = "arA: " + arAlpha;                              
          document.getElementById("arBetaLabel").innerHTML = "arB: " + arBeta;
          document.getElementById("arGammaLabel").innerHTML = "arG: " + arGamma;                                                  
          document.getElementById("alphalabel").innerHTML = "Alpha: " + alpha;
          document.getElementById("betalabel").innerHTML = "Beta: " + beta;
          document.getElementById("gammalabel").innerHTML = "Gamma: " + gamma;
 
          document.getElementById("accelcolor").innerHTML = "Color: " + makecolor(ax, ay, az);
          document.getElementById("accelcolor").style.background = makecolor(ax, ay, az);
          document.getElementById("accelcolor").style.color = "#FFFFFF";
          document.getElementById("accelcolor").style.fontWeight = "bold";
 
          document.getElementById("gyrocolor").innerHTML = "Color: " + makecolor(alpha, beta, gamma);
          document.getElementById("gyrocolor").style.background = makecolor(alpha, beta, gamma);
          document.getElementById("gyrocolor").style.color = "#FFFFFF";
          document.getElementById("gyrocolor").style.fontWeight = "bold";
 
          document.bgColor = makecolor(arAlpha, arBeta, arGamma);
 
        }, delay);
      } 


<|start_filename|>书籍学习源码练习/Head First html5 programming学习代码/第七章/untitled.html<|end_filename|>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8" />
	<title>画布学习</title>
	<style type="text/css">
	canvas{
		border: 1px solid black;
	}
	</style>
	<script type="text/javascript" src="tweetshirt.js"></script>
</head>
<body>
	<canvas width="600" height="200" id="tshirtCanvas">
		<p>You need canvas to use Tweetshirt!</p>
		<p>This example requires a browser that supports the
		<a href="http://www.w3.org/html/wg/html5/">HTML5</a> 
		&lt;canvas&gt; feature.</p>
	</canvas>

	<form>
		<p>
			<label for="backgroundColor">选择背景颜色:</label>
			<select id="backgroundColor">
				<option value="white" selected="selected">White</option>
				<option value="black">Black</option>
			</select>
		</p>
		<p>
			<label for="shape">园还是正方形？</label>
			
		</p>
	</form>
</body>
</html>

<|start_filename|>Weex学习/WEEX入门/WEEX入门/POCWeexPage.h<|end_filename|>
//
//  POCWeexPage.h
//  Ticket
//
//  Created by huangchengdu on 17/2/21.
//  Copyright © 2017年 <NAME>. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "POCWeexManager.h"

@protocol POCWeexPageExport <NSObject>
@property (nonatomic, copy) NSString *url;
//初始化参数
@property(nonatomic,copy)NSDictionary *options;
//页面需要参数
@property(nonatomic,copy)NSDictionary *params;
@property(nonatomic,copy)NSString *debugUrl;
@property(nonatomic,assign)BOOL debugModel;

@property (nonatomic, strong) UIView *weexView;

POCExport(
          - (void)sendMessageToWeexJSContext:(NSDictionary *)params callback:(POCCallback)callback);

@end

@interface POCWeexPage : UIViewController<POCWeexPageExport>

@end


<|start_filename|>OC与JS交互Demo列表/自己写/html5测试/html5测试/html5/online-status/amionline-origin.js<|end_filename|>
(function () {
  "use strict";

  //
  // Local Site Status
  //
  // This strategy is simple and requires no changes for most servers
  //
  // we request a non-existing resource on the remote site
  // if the request comes back with a 200
  //   * if a url is specified, the site is online
  //   * if no url is specified 'online.json' is checked for offline / online status
  // if the request comes back with a 404, the site is online
  // if the request comes back with < 100, the site is offline
  // if the request comes back with something else, there is an error
  function create(respond, options) {
    options = options || {};

    var url = options.url || "online.json";
    options.timeout = options.timeout || 2000;

    function testAppCache(xhr) {
      var data;
      try {
        data = JSON.parse(xhr.responseText);
      } catch(e) {
        respond(new Error("online.json could not be parsed"));
        return;
      }

      if ('online' === data.status) {
        respond(null, 'online');
      } else if ('offline' === data.status) {
        respond(null, 'offline');
      } else {
        respond(new Error("online.json's status is neither 'online' nor 'offline'"));
      }
    }

    function request() {
      var xhr = new XMLHttpRequest()
        , resource = url + "?_no_cache_=" + new Date().valueOf()
        , waitfor = options.timeout
        , err
        , result = 'error'
        , timeoutid = -1;

      function handleStateChange() {
        if (xhr.readyState !== 4) {
          return;
        }

        clearTimeout(timeoutid);        

        if (200 === xhr.status) {
          if (!options.url) {
            return testAppCache(xhr);
          }
          result = 'online';
        } else if (404 === xhr.status) {
          result = 'online';
        } else if (xhr.status < 100) {
          result = 'offline';
        } else {
          err = new Error("unexpected xhr status: " + xhr.status);
        }

        // TODO add error
        respond(err, result);
      }

      xhr.open("GET", resource, true);
      xhr.onreadystatechange = handleStateChange;
      xhr.send();

      function assumeOffline() {
        xhr.abort();
        respond(new Error("timeout after " + waitfor + "ms"), 'offline');
      }

      timeoutid = setTimeout(assumeOffline, waitfor);
    }

    request();
  }

  exports.create = create;
  provide('amionline-origin', exports);
}());


<|start_filename|>javascript练习Demo列表/Javascript的设计模式实现/单列模式/typetwo.js<|end_filename|>
var Singleton = function(name) {
    this.name = name;
};
Singleton.prototype.getName = function() {
    return this.name;
};
Singleton.getInstance = (function() {
    var instance = null;
    return function(name) {
        if (!instance) {
            instance = new Singleton(name);
        }
        return instance;
    };
})();

var a = Singleton.getInstance('sven1');
var b = Singleton.getInstance('sven2');
console.log(a === b);


<|start_filename|>Weex学习/weexStudy/webpack.config.js<|end_filename|>
require('webpack');
require('weex-loader');
var path = require('path');
var fs = require('fs');
var entry = {};

function walk(dir, root) {
  var directory = path.join(__dirname, root, dir)
  fs.readdirSync(directory).forEach(function (file) {
      var fullpath = path.join(directory, file)
      var stat = fs.statSync(fullpath)
        // support for vue file
      if (stat.isFile() && (path.extname(fullpath) === '.we' || path.extname(fullpath) === '.vue')) {
          var name = path.join(dir, path.basename(file, '.we'))
          entry[name] = fullpath + '?entry=true'
        }
        else if (stat.isDirectory()) {
          var subdir = path.join(dir, file)
          walk(subdir, root)
        }
      })
  }
  walk('./', 'src');
  module.exports = {
    entry: entry
    , output: {
      path: 'dist'
      , filename: 'index.js'
    }
    , devtool: 'inline-source-map'
    , module: {
      loaders: [
        {
          test: /\.we(\?[^?]+)?$/
          , loaders: ['weex-loader']
      }
        , {
          test: /\.vue(\?[^?]+)?$/
          , loaders: ['vue']
      }
    ]
    }
  }

<|start_filename|>OC与JS交互Demo列表/自己写/html5测试/html5测试/html5/online-status/amionline-favinet-list.js<|end_filename|>
(function () {
  "use strict";

    var urls;

    // http://www.google.com/adplanner/static/top1000/
    urls = [
      // "https://www.google.com/favicon.ico",
      "https://facebook.com/favicon.ico",
      "https://www.youtube.com/favicon.ico",
      "https://www.blogger.com/favicon.ico",
      "https://www.live.com/favicon.ico",
      "https://twitter.com/favicon.ico",
      "https://www.squidoo.com/favicon.ico",
      // "https://www.google.co.in/favicon.ico", -- no query
      "http://www.yahoo.co.jp/favicon.ico",
      "https://www.amazon.com/favicon.ico",
      // "https://www.google.com.hk/favicon.ico", -- no query
      "https://www.linkedin.com/favicon.ico",
      //"https://www.google.de/favicon.ico", - no query params
      "https://bing.com/favicon.ico",
      //"http://wwwstatic.megaupload.com/images/icon.ico",
      /*
      wordpress
      ebay
      half
      microsoft
      flickr
      apple
      bbc.co.uk
      mozilla
      paypal
      craigslist
      imdb
      ask
      cnn
      adobe
      aol
      tumblr
      godaddy
      espn
      about
      nytimes
      livejournal
      myspace
      cnet
      orkut
      ehow
      netflix
      stackoverflow
      weather
      stumbleupon
      answers
      reddit
      devianart
      photobucket
      digg
      sourceforge
      github
      thehuffingtonpost
      bankofamerica
      bit.ly
      vimeo
      fbcdn.net
      chase
      foxnews
      dictionary
      download
      skype
      w3schools
      guardian.co.uk
      wikimedia
      wsj
      yelp
      scribd
      php
      joomla
      etsy
      "http://squidoo.com/favicon.ico"
      gmx
      odesk
      mashable
      istockphoto
      comcast
      dell
      hp
      slideshare
      freelancer
      */
      //"http://www.yahoo.com/favicon.ico",
      //"http://www.baidu.com/favicon.ico",
      //"http://en.wikipedia.org/favicon.ico",
      //"http://es.wikipedia.org/favicon.ico",
      //"http://www.qq.com/favicon.ico",
      //"http://www.msn.com/favicon.ico",
      //"http://www.sina.com.cn/favicon.ico",
      //"http://www.taobao.com/favicon.ico",
    ];

  exports.urls = urls;
  provide('amionline-favinet-list', exports);
}());


<|start_filename|>OC与JS交互Demo列表/有趣的Demo/ObjectiveCToJavascript/Classes/ExecuteFunctionViewController.h<|end_filename|>
//
//  ExecuteFunctionViewController.h
//  ObjCJS
//
//  Created by <NAME> on 1/14/11.
//

#import <UIKit/UIKit.h>


@interface ExecuteFunctionViewController : UIViewController {
	UIButton *executeFunction;
	IBOutlet UITextView *textView;
	IBOutlet UITextField *diameterField;
	IBOutlet UIWebView *webView;
}

- (IBAction)executeJavaScript:(id)sender;

@end


<|start_filename|>书籍学习源码练习/javascript高级程序设计学习代码/chapter3.one.js<|end_filename|>
// var message = "some string";
// console.log(typeof message);
// console.log(typeof(message));
// console.log(typeof 95);
// console.log(typeof null);


// var message;
// console.log(message == undefined);
// console.log(typeof message);
// console.log(typeof age);//没有声明的变量


// var car = null;
// console.log(typeof car);
// console.log(null == undefined);

// var result = Number.MAX_VALUE + Number.MAX_VALUE;
// console.log(isFinite(result));
// console.log(NaN == NaN);
// console.log(isNaN(NaN));
// console.log(isNaN("10"));
// console.log(isNaN("blue"));

// console.log(Number("hello world!"));
// console.log(Number(""));
// console.log(Number("000011"));
// console.log(Number(true));
// console.log(parseInt("0xAF", 16));

// console.log(String(10));
// console.log(String(true));
// console.log(String(null));
// console.log(String(undefined));

// var s1 = "2";
// var s2 = "z";
// var b = false;
// var f = 1.1;
// var o = {
// 	valueOf:function(){
// 		return -1;
// 	}
// };
// console.log(s1++);
// console.log(s2++);
// console.log(b++);
// console.log(f--);
// console.log(o--);

// console.log(!false);
// console.log(!"bue");
// console.log(!0);
// console.log(!NaN);
// console.log(!"";)
// console.log(!23456);

// var obj1 = new Object();
// var obj2 = new Object();
// console.log(obj1 && obj2);
// console.log(obj1 && 0);


// with(location){
// 	var qs = search.substring();
// 	var hostName = hostname;
// 	var url = href;
// 	console.log(qs + hostname + url);
// }


// var i = 1;
// switch(i){
// 	case 25:
// 		alert("25");
// 		break;
// 	case 35:
// 		alert("35");
// 		break;
// 	case 45:
// 		alert("45");
// 		break;
// 	default:
// 		alert("other");
// }
// switch("hello world"){
// 	case "hello" + " world":
// 		alert("greeting was found.");
// 		break;
// 	case "goodbye":
// 		alert("Closing was found.");
// 		break;
// 	default:
// 		alert("Unexpected message was found.");
// }





<|start_filename|>Weex学习/WEEX入门/WEEX入门/ViewController.h<|end_filename|>
//
//  ViewController.h
//  WEEX入门
//
//  Created by huangchengdu on 17/5/8.
//  Copyright © 2017年 huangchengdu. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController


@end



<|start_filename|>OC与JS交互Demo列表/有趣的Demo/JavaScriptCore-Demo/JavaScriptCore-Demo/AppDelegate.h<|end_filename|>
//
//  AppDelegate.h
//  JavaScriptCore-Demo
//
//  Created by Jakey on 14/12/26.
//  Copyright (c) 2014年 www.skyfox.org. All rights reserved.
//

#import <UIKit/UIKit.h>

@class RootViewController;

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;

@property (strong, nonatomic) RootViewController *viewController;

@property (strong, nonatomic) UINavigationController *navgationController;

@end



<|start_filename|>书籍学习源码练习/javascript高级程序设计学习代码/chapter6.one.理解对象.js<|end_filename|>
// var person = new Object();
// person.name = "Nicholas";
// person.age = 29;
// person.job = "Software Engineer";
// person.sayName = function () {
// 	console.log(this.name);
// }

// var person = {
// 	name:"Nicholas",
// 	age:29,
// 	job:"Software Engineer",
// 	sayName:function(){
// 		console.log(this.name);
// 	}
// };

// var person = {};
// Object.defineProperty(person, "name", {
// 	writable:false,
// 	value:"Nicholas"
// });
// person.name = "Greg";
// console.log(person.name);

// var person = {};
// Object.defineProperty(person, "name", {
// 	configurable: false,
// 	value: "Nicholas"
// });
// console.log(person.name);
// delete person.name;
// console.log(person.name);

// var book = {
// 	_year : 2004,
// 	edition : 1
// };
// Object.defineProperty(book, "year", {
// 	get:function(){
// 		return this._year;
// 	},
// 	set:function(newValue){
// 		if (newValue > 2004) {
// 			this._year = newValue;
// 			this.edition += newValue - 2004;
// 		}
// 	}
// });
// book.year = 2005;
// console.log(book.edition);

// var book = {};
// Object.defineProperties(book,{
// 	_year:{
// 		value:2004
// 	},
// 	edition:{
// 		value: 1
// 	},
// 	year:{
// 		get:function(){
// 			return this._year;
// 		},
// 		set:function(newValue){
// 			if (newValue > 2004) {
// 				this._year = newValue;
// 				this.edition += newValue - 2004;
// 			}
// 		}
// 	}
// });
// book.year = 2005;
// console.log(book.edition);



// var book = {};
// Object.defineProperties(book,{
// 	_year:{
// 		value:2004
// 	},
// 	edition:{
// 		value: 1
// 	},
// 	year:{
// 		get:function(){
// 			return this._year;
// 		},
// 		set:function(newValue){
// 			if (newValue > 2004) {
// 				this._year = newValue;
// 				this.edition += newValue - 2004;
// 			}
// 		}
// 	}
// });
// var descriptor = Object.getOwnPropertyDescriptor(book, "_year");
// console.log(descriptor.value);
// console.log(descriptor.configurable);
// console.log(typeof descriptor.get);
// descriptor = Object.getOwnPropertyDescriptor(book, "year");
// console.log(descriptor.value);
// console.log(descriptor.enumerable);
// console.log(typeof descriptor.get);







































<|start_filename|>webpack官方Demo/HtmlCss/命令.js<|end_filename|>
  513 npm init
  514 pwd
  515 cnpm install--save - dev webpack @ < 3.8 .1 >
      516 npm install--save - dev webpack @ < 3.8 .1 >
      517 npm install--save - dev webpack
  518 ls
  519 pwd
  520 cnpm install--save lodash
  521 pwd
  522. / node_modules / .bin / webpack src / index.js dist / bundle.js
  523. / node_modules / .bin / webpack--config webpack.config.js

<|start_filename|>CSS3练习列表/CSS之3D立方体/index.css<|end_filename|>
/*
* @Author: huangchengdu
* @Date:   2017-01-19 15:13:27
* @Last Modified by:   huangchengdu
* @Last Modified time: 2017-01-19 15:44:44
*/

.cude{
	width: 300px;
	height: 300px;
	position: relative;
	margin: 100px auto;
	background-color: #dfdfdf;
	transform-style: preserve-3d;
	-webkit-transform-style:preserve-3d;
	transform: rotateX(-30deg) rotateY(-80deg);
    transform-origin: 50% 50% 0;
    -webkit-transform-origin: 50% 50% 0;
    -webkit-animation: rotate 20s infinite;
    animation: rotate 20s infinite;
}

.surface{
	position: absolute;
	top: 0;
	left: 0;
	width: 300px;
	height: 300px;
	background: #666;
	opacity:0.8;
	font-size: 60px;
	text-align: center;
	line-height: 300px;
	font-weight: bold;
	color: #fff;
	border: 1px solid #fff;
	-webkit-transition:all .3s;
	transition: all .3s;
}

@-webkit-keyframes rotate{
	from{
		transform: rotateX(0deg) rotateY(0deg);
	}
	to{
		transform: rotateX(360deg) rotateY(360deg);
	}
}

.front{
	transform: rotateY(0) translateZ(150px);
}
.back {
    transform:translateZ(-150px) rotateY(180deg);
}
.left {
    transform:rotateY(-90deg) translateZ(150px);
}
.right {
    transform:rotateY(90deg) translateZ(150px);
}
.top {
    transform:rotateX(90deg) translateZ(150px);
}
.bottom {
    transform:rotateX(90deg) translateZ(-150px);
}

<|start_filename|>Webpack中文指南/moduleB.js<|end_filename|>
var multiplyBy2 = require('./moduleA');
var result = multiplyBy2(4);
module.exports = "result is " +result;

<|start_filename|>vuejs练习Demo列表/模态组件/index.css<|end_filename|>
.modal-mask{
	position: fixed;
	z-index: 9998;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0,0,0,0.5);
	display: table;
	transition: opacity .3s ease;
}

.modal-wrapper{
	display: table-cell;
	vertical-align: middle;
}

.modal-container{
	width: 300px;
	margin: 0px auto;
	padding: 20px 30px;
	background-color: #fff;
	border-radius: 2px;
	box-shadow: 0 2px 8px rgba(0,0,0,.33);
	transition: all .3s ease;
	font-family: Helvetica, Arial, sans-serif;
}

.modal-header h3 {
	margin-top: 0;
	color: #42b983;
}

.modal-body h3 {
	margin-top: 0;
	color: #b26b0e;
}

.modal-body {
	margin: 40px 0;
}

.modal-default-button {
	float: right;
}

.modal-enter,
.modal-leave {
	opacity: 0;
}

.modal-enter .modal-container,
.modal-leave .modal-container {
	-webkit-transform: scale(1.5);
	transform: scale(1.5);
}



<|start_filename|>OC与JS交互Demo列表/自己写/html5测试/html5测试/html5/index1.html<|end_filename|>
<!DOCTYPE HTML>
<html>
  <head>
    <title>iPhone HTML5 Offline Apps Sandbox</title>
  </head>
  <body>
    <h2>Sandbox</h2>
    <ul>
      <li>
        <a href="app-cache/index.html">app-cache</a>
      </li>
      <li>
        <a href="online-status/index.html">online-status</a>
      </li>
      <li>
        <a href="offline-app/index.html">offline-app</a>
      </li>
      <li>
        <a href="flashlight/index.html">flashlight</a>
      </li>
      <li>
        <a href="flashcards/index.html">flashcards</a>
      </li>
      <li>
        <a href="accelerometer/index.html">accelerometer</a>
      </li>
      <li>
        <a href="gyroscope/index.html">gyroscope</a>
      </li>
      <li>
        <a href="device-orientation/index.html">device-orientation</a>
      </li>
      <li>
        <a href="accelerometer-and-gyroscope/index.html">accelerometer-and-gyroscope</a>
      </li>
      <li>
        <a href="size-and-orientation/index.html">size-and-orientation</a>
      </li>
    </ul>
  </body>
</html>


<|start_filename|>书籍学习源码练习/javascript高级程序设计学习代码/chapter14.one.js<|end_filename|>
//html的form元素，对应于javascript的HTMLFormElement元素。
var form = document.getElementById("form1");
var firstForm = document.forms[0];
var myForm = document.forms["form2"];

//提交表单
<input type="submit" value="Submit Form">
<button type="submit">Submit Form<\/button>
<input type="image" src="graphic.gif">

//阻止表单提交
var form = document.getElementById("myForm");
EventUtil.addHandler(form, "submit", function(event){
	event = EventUtil.getEvent(event);
	EventUtil.preventDefault(event);//阻止订单的提交
});

var form = document.getElementById("myForm");
//提交表单
form.submit();

var form = document.getElementById("myForm");
EventUtil.addHandler(form, "reset", function(event){
	event = EventUtil.getEvent(event);
	//组织表单重置
	EventUtil.preventDefault(event);
});

var form = document.getElementById("myForm");
//重置表单
form.reset();

//表单字段
var form = document.getElementById("form1");
//获取表单中的第一个字段
var field1 = form.elements[0];
//取得名为textbox1的字段
var field2 = form.elements["textbox1"];
//表单中包含的字段数量
var fieldCount = form.elements.length;


//共有的表单字段属性
var form = document.getElementById("myForm");
var field = form.elements[0];
//改变value属性
field.value = "Another value";
//检查form属性的值
alert(field.form === form);//true
//把焦点设置到当前字段
field.focus();
//禁用当前字段
field.disabled = true;
//修改type属性
field.type = "checkbox";

//自动设置焦点
<input type="text" autofocus>

//共有的表单字段事件
var textbox = document.forms[0].elements[0];
EventUtil.addHandler(textbox, "focus", function(event){
	event = EventUtil.getEvent(event);
	var target = EventUtil.getTarget(event);
	if (target.style.backgroundColor != "red") {
		target.style.backgroundColor = "yellow";
	}
});


//==================================文本框脚本========================
//输入单行
<input type="text" size="25" maxlength="50" value="initial value">
//输入多行
<textarea rows="25" cols="5">initial value<\/textarea>
//文本框获得焦点时选择其所有文本
var textbox = document.forms[0-].elements["textbox1"];
EventUtil.addHandler(textbox, "focus", function(event){
	event = EventUtil.getEvent(event);
	var target = EventUtil.getTarget(event);
	target.select();
});


//select事件
var textbox = document.forms[0-].elements["textbox1"];
EventUtil.addHandler(textbox, "select", function(event){
	alert("Text selected" + textbox.value);
});


//选择部分脚本
var textbox = document.forms[0-].elements["textbox1"];
textbox.value = "Hello world!";
//选择所有文本
textbox.setSelectionRange(0, textbox.value.length);
//选择前三个字符
textbox.setSelectionRange(0, 3);
//选择第四到第六个字符
textbox.setSelectionRange(4,7);

































<|start_filename|>书籍学习源码练习/javascript高级程序设计学习代码/chapter13.one.js<|end_filename|>
//======================================事件处理================================
var btn = document.getElementById("myBtn");
var handler = function(){
	console.log("hello world");
};
btn.addEventListener("click",handler,false);
//移除事件处理
btn.removeEventListener("click", handler, false);


//IE事件处理程序
var btn = document.getElementById("myBtn");
var handler = function(){
	console.log("closed");
};
btn.attachEvent("onclick", handler);
//删除事件处理
btn.detachEvent("onclick", handler);


//跨浏览器事件处理工具
var EventUtil = {
	addHandler:function(element, type, handler){
		if (element.addEventListener) {//DOM2 非ID
			element.addEventListener(type,handler,false);
		}else if (element.attachEvent) {//IE
			element.attachEvent("on" + type, handler);
		}else{//DOM0
			element["on" + type] = handler;
		}
	},
	removeHandler:function(element, type, handler){
		if (element.removeEventListener) {
			element.removeEventListener(type, handler, false);
		}else if (element.detachEvent) {
			element.detachEvent("on" + type, handler);
		}else{
			element["on" + type] = null;
		}
	}
};
var btn = document.getElementById("myBtn");
var handler = function(){
	console.log("closed");
};
EventUtil.addHandler(btn, "click", handler);
EventUtil.removeHandler(btn, "click", handler);


//========================================事件对象================================
var btn = document.getElementById("myBtn");
var handler = function(event){
	switch(event.type){
		case "click":
			console.log("clicked");
			break;
		case "mouseover":
			event.target.style.backgroundColor = "red";
			break;
		case "mouseout":
			event.target.style.backgroundColor = "";
			break;
	}
};
btn.onclick = handler;
btn.onmouseover = handler;
btn.onmouseout = handler;

//组织特定事件的默认行为
var link = document.getElementById("myLink");
link.onclick = function(event){
	event.preventDefault();
}

//立即停止事件的传播
var btn = document.getElementById("myBtn");
btn.onclick = function(event){
	event.stopPropagation(); //停止事件传播
}
document.body.onclick = function(event){
	console.log("Body clicked"); //因为事件已经停止传播了，所以不会再冒泡到body了
};


//IE中的事件对象
var btn = document.getElementById("myBtn");
btn.onclick = function(){
	var event = window.event;
	console.log(event.type);
};


//跨浏览器事件对象
var EventUtil = {
	addHandler:function(element, type, handler){
		if (element.addEventListener) {//DOM2 非ID
			element.addEventListener(type,handler,false);
		}else if (element.attachEvent) {//IE
			element.attachEvent("on" + type, handler);
		}else{//DOM0
			element["on" + type] = handler;
		}
	},
	removeHandler:function(element, type, handler){
		if (element.removeEventListener) {
			element.removeEventListener(type, handler, false);
		}else if (element.detachEvent) {
			element.detachEvent("on" + type, handler);
		}else{
			element["on" + type] = null;
		}
	},
	getEvent:function(event){
		return event?event:window.event;
	},
	getTarget:function(event){
		return event.target || event.srcElement;
	},
	preventDefault:function(event){
		if (event.preventDefault) {
			event.preventDefault();
		}else{
			event.returnValue = false;
		}
	},
	stopPropagation:function(event){
		if (event.stopPropagation) {
			event.stopPropagation();
		}else {
			event.cancelBubble = true;
		}
	},
	getRelatedTarget:function(event){
		if (event.relatedTarget) {
			return event.relatedTarget;
		}else if(event.toElement){
			return event.toElement;
		}else if(event.fromElement){
			return event.fromElement;
		}else{
			rturn null;
		}
	},
	getCharCode:function(event){
		if (typeof event.charCode == "number") {
			return event.charCode;
		}else {
			return event.keyCode;
		}
	}
};
btn.onclick = function(event){
	event = EventUtil.getEvent(event);
};
btn.onclick = function(event){
	event = EventUtil.getEvent(event);
	EventUtil.stopPropagation(event);
}

//==========================================事件类型======================================
//UI事件 load事件
EventUtil.addHandler(window, "load", function(){
	var script = document.createElement("script");
	EventUtil.addHandler(script, "load", function(event){
		console.log("Loaded");
	});
	script.src = "example.js";
	document.body.appendChild(script);
});
//UI事件 unload事件
EventUtil.addHandler(window, "unload", function(event){
	console.log("Unloaded");
});

//焦点事件 相关元素
var div = document.getElementById("myDiv");
EventUtil.addHandler(div, "mouseout", function(event){
	event = EventUtil.getEvent(event);
	var target = EventUtil.getTarget(event);
	var relatedTarget = EventUtil.getRelatedTarget(event);
	console.log("鼠标离开" + target.tagName + "到" + relatedTarget.tagName);
});

//键盘与文本事件
var textbox = document.getElementById("myText");
EventUtil.addHandler(textbox, "keyup", function(event){
	event = EventUtil.getEvent(event);
	console.log(event.keyCode);
});

//textInput事件
var textbox = document.getElementById("myText");
EventUtil.addHandler(textbox, "textInput", function(event){
	event = EventUtil.getEvent(event);
	console.log(event.data);
});


//html5事件
EventUtil.addHandler(window, "beforeunload", function(event){
	event = EventUtil.getEvent(event);
	var message = "I'm really going to miss you if you go.";
	event.returnValue = message;
	return message;
});
//DOMContentLoaded事件，这个在dom加载完成以后就激发
EventUtil.addHandler(document, "DOMContentLoaded", function(event){
	console.log("Content Loaded");
});


//hashchange事件 url改变
EventUtil.addHandler(window, "hashchange", function(event){
	console.log("老url" + event.oldURL + "新URL" + event.newURL);
});


















<|start_filename|>OC与JS交互Demo列表/有趣的Demo/JavaScript-Objective-C-Bridge/JSBridgeTest/Classes/RootViewController.h<|end_filename|>
//
//  RootViewController.h
//  JSBridgeTest
//
//  Created by <NAME> on 11/03/25.
//  Copyright 2011 Kronecker's Delta Studio. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "JavaScriptBridgeReceiver.h"

@interface RootViewController : UITableViewController {
    UIWebView *webView;
    JavaScriptBridgeReceiver *receiver;
}

@property(nonatomic, retain) UIWebView *webView;
@property(nonatomic, retain) JavaScriptBridgeReceiver *receiver;

@end


<|start_filename|>书籍学习源码练习/javascript高级程序设计学习代码/chapter8.two.location对象.js<|end_filename|>
//解析URL
function getQueryStringArgs() {
    //取得查询字符串并去掉开头的问号
    var qs = (location.search.length > 0 ? location.search.substring(1) : ""),
        //保存数据的对象
        args = {},
        //取得每一项
        items = qs.length ? qs.split("&") : [],
        item = null,
        name = null,
        value = null,
        i = 0,
        len = items.length;
    for (i = 0; i < len; i++) {
        item = items[i].split("=");
        name = decodeURIComponent(item[0]);
        value = decodeURIComponent(item[1]);
        if (name.length) {
            args[name] = value;
        }
    }
    return args;
}
getQueryStringArgs();

//在URL等于https://www.baidu.com/index.php?q=javascript&num=10测试
var args = getQueryStringArgs();
alert(args["q"]); //"javascript"
alert(args["num"]); //"10"


//下面三个方法功能一样
location.assign("http://www.baidu.com");
window.location = "http://www.baidu.com";
location.href = "http://www.baidu.com";


//假设初始URL为http://www.wrox.com/WileyCDA/
//将URL修改为http://www.wrox.com/WileyCDA/#section1
location.hash = "#section1";
//将URL修改为"http://www.wrox.com/WileyCDA/?q=javascript"
location.search = "?q=javascript";
//将URL修改为"http://www.yahoo.com/WileyCDA/"
location.hostname = "www.yahoo.com";
//将URL修改为“http://www.yahoo.com/mydir/"
location.pathname = "mydir";


<|start_filename|>javascript练习Demo列表/Javascript的设计模式实现/观察者模式/typetwo.房产销售通用版.js<|end_filename|>
//发布订阅类
var event = {
    clientList: [],
    listen: function(key, fn) {
        if (!this.clientList[key]) {
            this.clientList[key] = [];
        }
        this.clientList[key].push(fn); //订阅的消息添加进缓存列表
    },
    remove: function(key, fn) {
        var fns = this.clientList[key];
        if (!fns) { //如果key对应的消息没有被人订阅，则直接返回
            return false;
        }
        if (!fn) { //如果没有传入具体的回调函数，表示需要取消key对应消息的所有订阅
            fns && (fns.length = 0);
        } else {
            for (var l = fns.length - 1; l >= 0; l--) { //反向遍历订阅的回调函数列表
                var _fn = fns[l];
                if (_fn === fn) {
                    fns.splice(l, 1); //删除订阅者的回调函数
                }
            }
        }
    },
    trigger: function() {
        var key = Array.prototype.shift.call(arguments),
            fns = this.clientList[key];
        if (!fns || fns.length === 0) { //如果没有绑定对应的消息
            return false;
        }
        for (var i = 0, fn; fn = fns[i++];) {
            fn.apply(this, arguments);
        }
    },
};

//通过复制所有属性和方法来为对象集成房产销售的订阅
var installEvent = function(obj) {
    for (var i in event) {
        obj[i] = event[i]; //遍历所有的属性，并且赋值给对象
    }
};

var salesOffices = {};
installEvent(salesOffices);

salesOffices.listen('squareMeter88', fn1 = function(price) {
    console.log('价格= ' + price);
});
salesOffices.listen('squareMeter88', fn2 = function(price) {
    console.log('价格= ' + price);
});
salesOffices.remove('squareMeter88', fn1); // 删除小明的订阅

salesOffices.trigger('squareMeter88', 2000000); // 输出:2000000
salesOffices.trigger('squareMeter88', 2000000); // 输出:2000000


<|start_filename|>OC与JS交互Demo列表/自己写/html5测试/html5测试/html5/app-cache/application.js<|end_filename|>
var window, global = (function () { return this; }());
/*global global: true */
(function () {
  "use strict";

  var document = window.document
    , appCache = window.applicationCache;
    //  appCacheStatuses = [
    //    "UNCACHED",
    //    "IDLE",
    //    "CHECKING",
    //    "DOWNLOADING",
    //    "UPDATEREADY",
    //    "OBSOLETE"
    //  ];

  if (undefined === appCache) {
    alert("Your device is incompatible. Try iOS, Android, or Linux. Windows requires Google Chrome");
    window.location.href = "http://www.google.com/chrome";
  }

  console.log('appCacheLoading', new Date().toISOString());

  // for coneveniece
  appCache.on = appCache.addEventListener;

  function report(ev) {
    console.log('appCacheEvent', ev, appCache.status, new Date().toISOString());
    if ('progress' === ev.type) {
      if (undefined !== ev.total) {
        document.getElementById('event-phase-total').innerHTML = ev.total;
        document.getElementById('app-cache-progress').setAttribute('value', ev.eventPhase);
        document.getElementById('app-cache-progress').setAttribute('max', ev.total);
      } else {
        document.getElementById('app-cache-progress').innerHTML = ev.eventPhase;
      }
      document.getElementById('event-phase').innerHTML = ev.eventPhase;
      return;
    }

    if ('downloading' === ev.type) {
      // show update bars
    }

    if ('checking' === ev.type) {
      // show "checking for updates"
    }

    if ('updateready' == ev.type) {
      // on refresh and .update()
      // refresh application
      alert('new version available, updating');
      window.location.reload();
    }

    if ('noupdate' === ev.type) {
      // show "up-to-date"
    }

    if ('cached' === ev.type) {
      // show "download complete"
    }

    if ('error' === ev.type) {
      document.getElementById('bad-news').innerHTML = 'error (probably offline)';
    }
  }

  // fetching the application cache manifest and checking for updates.
  appCache.on('checking', report, false);
  // an error occurs during the caching process.
  appCache.on('error', report, false);
  // there is no update to download
  appCache.on('noupdate', report, false);
  // resources are being downloaded into the cache.
  appCache.on('downloading', report, false);
  // periodically throughout the download process.
  appCache.on('progress', report, false);
  // a resource update is ready
  // FF: this event is not currently used since versioned application caches aren't supported yet.
  appCache.on('updateready', report, false);
  // caching is complete.
  appCache.on('cached', report, false);
  
  function domListener(ev) {
    console.log('domEvent', ev, new Date().toISOString());
    if ('update' === ev.target.getAttribute('name')) {
      console.log('update');
      appCache.update();
    }
  }

  function onDomReady() {
    console.log('domReady', new Date().toISOString());
    document.body.addEventListener('click', domListener, false);
  }

  window.addEventListener('load', onDomReady, false);
}());


<|start_filename|>书籍学习源码练习/javascript高级程序设计学习代码/chapter5.one.js<|end_filename|>
// var person = new Object();
// person.name = "Nicholas";
// person.age = 29;

// var person = {
// 	name:"Nicholas",
// 	age:29
// };

// var person = {};
// person.name = "Nicholas";
// person.age = 29;
// console.log(person["name"]);
// console.log(person.age);
// var propertyName = "name";
// console.log(person[propertyName]);


// var colors = new Array();
// var colors = new Array(20);
// var colors = new Array("red", "blue", "green");
// var colors = Array(3);
// var names = Array("Greg");
// var colors = ["red", "blue", "green"];

// var colors = ["red", "blue", "green"];
// colors.length = 2;
// console.log(colors[2]);

// var colors =["red", "blue", "green"];
// colors.length = 4;
// console.log(colors[3]);

// var colors = ["red", "blue", "green"];
// colors[99] = "black";
// console.log(colors.length);
// if (colors instanceof Array) {
// 	console.log("是数组");
// }
// if (Array.isArray(colors)) {
// 	console.log("也是数组");
// }

// var colors = ["red", "blue", "green"];
// console.log(colors.toString());
// console.log(colors.valueOf());
// console.log(colors);

// var person1 = {
// 	toLocaleString:function(){
// 		return "Nikolaos";
// 	},
// 	toString:function(){
// 		return "Nicholas";
// 	}
// };
// var person2 = {
// 	toLocaleString:function(){
// 		return "Grigorios";
// 	},
// 	toString:function(){
// 		return "Greg";
// 	}
// };
// var person = [person1, person2];
// console.log(person);
// console.log(person.toString());
// console.log(person.toLocaleString());

// var colors = ["red", "green", "blue"];
// console.log(colors.join(","));
// console.log(colors.join("||"));

// var colors = new Array();
// var count = colors.push("red","green");
// console.log(count);
// count = colors.push("black");
// console.log(count);
// var item = colors.pop();
// console.log(item);
// console.log(colors.length);
// colors[3] = "brown";
// item = colors.pop();
// console.log(item);


// var colors = new Array();
// var count = colors.unshift("red", "green");
// console.log(count);
// count = colors.unshift("black");
// console.log(count);
// var item = colors.pop();
// console.log(item);
// console.log(colors.length);


// var values = [1, 2, 3, 4, 5];
// values.reverse();
// console.log(values);
// values = [0, 1, 5, 10, 15];
// values.sort();
// console.log(values);
// function compare(value1, value2){
// 	if (value1 < value2) {
// 		return -1;
// 	}else if(value1 > value2){
// 		return 1;
// 	}else{
// 		return 0;
// 	}
// }
// values.sort(compare);
// console.log(values);


// var colors = ["red", "green", "blue"];
// var colors2 = colors.concat("yellow", ["black", "brown"]);
// console.log(colors);
// console.log(colors2);

// var colors = ["red", "green", "blue", "yellow", "purple"];
// var colors2 = colors.slice(1);
// var colors3 = colors.slice(1,4);
// console.log(colors);
// console.log(colors2);
// console.log(colors3);


// var colors = ["red", "green", "blue"];
// var removed = colors.splice(0, 1);
// console.log(colors);
// console.log(removed);
// removed =colors.splice(1, 0, "yellow", "orange");
// console.log(colors);
// console.log(removed);
// removed = colors.splice(1, 1, "red", "purple");
// console.log(colors);
// console.log(removed);


// var numbers = [1,2,3,4,5,4,3,2,1];
// console.log(numbers.indexOf(4));
// console.log(numbers.lastIndexOf(4));
// console.log(numbers.indexOf(4,4));
// console.log(numbers.lastIndexOf(4,4));
// var person = {name: "Nicholas"};
// var people = [{name: "Nicholas"}];
// var morePeople = [person];
// console.log(people.indexOf(person));
// console.log(morePeople.indexOf(person));


// var numbers = [1,2,3,4,5,4,3,2,1];
// var everyResult = numbers.every(function(item, index, array){
// 	return (item > 2);
// });
// console.log(everyResult);
// var someResult = numbers.some(function(item, index, array){
// 	return (item > 2);
// });
// console.log(someResult);
// var filterResult = numbers.filter(function(item, index, array){
// 	return (item > 2);
// });
// console.log(filterResult);
// var mapResult = numbers.map(function(item, index, array){
// 	return item	* 2;
// });
// console.log(mapResult);


// var values = [1,2,3,4,5];
// var sum = values.reduce(function(prev,cur,index,array){
// 	return prev + cur;
// });
// console.log(sum);
// sum = values.reduceRight(function(prev, cur, index,array){
// 	return prev + cur;
// });
// console.log(sum);


// var now = new Date();
// //GMT时间2000年1月1日 午夜零时
// var y2k = new Date(Date.UTC(2000, 0));
// //GMT时间2005年5月5日 下午5：55：55
// var allFives = new Date(Date.UTC(2005,4,5,17,55,55));
// //本地时间2000年 1月1日 午夜零时
// y2k = new Date(2000,0);
// //本地时间2005年5月5日 下午5：55：55
// allFives = new Date(2005, 4, 5, 17, 55, 55);
// //现在
// var start = Date.now();
// var date1 = new Date(2007, 0, 1);
// var date2 = new Date(2007, 1, 1);
// console.log(date1 < date2);

// //匹配字符串中的所有at的实例
// var pattern1 = /at/g;
// //匹配第一个bat或者cat，不区分大小写
// var pattern2 = /[bc]at/i;
// //匹配所有以at结尾的3哥字符的组合，不区分大小写
// var pattern3 = /.at/gi;
// //匹配第一个bat或者cat，不区分大小写
// var pattern1 = /[bc]at/i;
// //匹配第一个[bc]at，不区分大小写。
// var pattern2 = /\[bc\]at/i;
// //匹配所有以at结尾的3个字符的组合，不区分大小写。
// var patter3 = /.at/gi;
// //匹配所有的“.at”,不区分大小写
// var pattern4 = /\.at/gi;
// var pattern2 = new RegExp("[bc]at", "i");

// var pattern1 = /\[bc\]at/i;
// console.log(pattern1.global);
// console.log(pattern1.ignoreCase);
// console.log(pattern1.multiline);
// console.log(pattern1.lastIndex);
// console.log(pattern1.source);
// var pattern2 = new RegExp("\\[bc\\]at", "i");
// console.log(pattern2.global);
// console.log(pattern2.ignoreCase);
// console.log(pattern2.multiline);
// console.log(pattern2.lastIndex);
// console.log(pattern2.source);

// var text = "cat, bat, sat, fat";
// var pattern1 = /.at/;
// var matches = pattern1.exec(text);
// console.log(matches.index);
// console.log(matches[0]);
// console.log(matches.lastIndex);

// var text = "000-00-0000";
// var pattern = /\d{3}-\d{2}-\d{4}/;
// if (pattern.test(text)) {
// 	console.log("The pattern was matched.");
// }

// var text = "this has been a short summer";
// var pattern = /(.)hort/g;
// if (pattern.test(text)) {
//     console.log(RegExp.input);
//     console.log(RegExp.leftContext);
//     console.log(RegExp.rightContext);
//     console.log(RegExp.lastMatch);
//     console.log(RegExp.lastParen);
//     console.log(RegExp.multiline);
// }

// function sum(num1, num2){
// 	return num1 + num2;
// }
// console.log(sum(10,10));
// var anotherSum = sum;
// console.log(anotherSum(10,10));
// sum = null;
// console.log(anotherSum(10,10));

// function callSomeFunction(someFuction, someArgument) {
// 	return someFuction(someArgument);
// }
// function add10(num) {
// 	return num + 10;
// }
// var result1 = callSomeFunction(add10, 10);
// console.log(result1);
// function getGreeting(name) {
// 	return "hello" + name;
// }
// var result2 = callSomeFunction(getGreeting, "Nicholas");
// console.log(result2);

// function createComparisonFunciton(propertyName){
// 	return function(object1, object2){
// 		var value1 = object1[propertyName];
// 		var value2 = object2[propertyName];
// 		if (value1 < value2) {
// 			return -1;
// 		}else if(value1 > value2){
// 			return 1;
// 		}else{
// 			return 0;
// 		}
// 	}
// }
// var data = [{name:"Zachary", age:28}, {name:"Nicholas", age:29}];
// data.sort(createComparisonFunciton("name"));
// console.log(data[0].name);
// data.sort(createComparisonFunciton("age"));
// console.log(data[0].name);

// function factorial(num){
// 	if (num <= 1) {
// 		return 1;
// 	}else {
// 		return num * arguments.callee(num - 1);
// 	}
// }
// var trueFactorial = factorial;
// factorial = function(){
// 	return 0;
// }
// console.log(trueFactorial(5));
// console.log(factorial(5));

// function outer(){
// 	inner();
// }
// function inner(){
// 	console.log(arguments.callee.caller);
// }
// outer();
// function sayName(name){
// 	console.log("name");
// }
// function sum(num1,num2){
// 	return num1 + num2;
// }
// function sayHi(){
// 	console.log("hi");
// }
// console.log(sayName.length);
// console.log(sum.length);
// console.log(sayHi.length);

// function sum(num1,num2){
// 	return num1 + num2;
// }
// function callSum1(num1, num2){
// 	return sum.apply(this, arguments);
// }
// function callSum2(num1, num2){
// 	return sum.call(this, [num1, num2]);
// }
// console.log(callSum1(10, 10));
// console.log(callSum2(10, 10));

// window.color = "red";
// var o = {color:"blue"};
// function sayColor(){
// 	console.log(this.color);
// }
// sayColor();
// sayColor.call(this);
// sayColor.call(window);
// sayColor.call(o);
// var objectSayColor = sayColor.bind(o);
// objectSayColor();

// var num = 10;
// console.log(num.toFixed(2));
// console.log(num.toPrecision(3));

// var numberObject = new Number(10);
// var numberValue = 10;
// console.log(typeof numberObject);
// console.log(typeof numberValue);
// console.log(numberObject instanceof Number);
// console.log(numberValue instanceof Number);

// var stringObject = new String("hello world");
// var stringValue = "hello world";
// console.log(stringValue.length);
// console.log(stringValue.charAt(1));
// console.log(stringValue.charCodeAt(1));
// console.log(stringValue[1]);
// stringValue = "hello ";
// var result = stringValue.concat("world", "!");
// console.log(result);
// console.log(stringValue);

// var stringValue = "hello world";
// alert(stringValue.slice(3));
// alert(stringValue.substring(3));
// alert(stringValue.substr(3));
// alert(stringValue.slice(3, 7));
// alert(stringValue.substring(3,7));
// alert(stringValue.substr(3, 7));

// var stringValue = "hello world";
// console.log(stringValue.indexOf("o", 6));
// console.log(stringValue.lastIndexOf("o", 6));
// stringValue = "Lorem ipsum dolor sit amet, consectetur adipisicing elit";
// var positions = new Array();
// var pos = stringValue.indexOf("e");
// while(pos > -1){
// 	positions.push(pos);
// 	pos = stringValue.indexOf("e", pos + 1);
// }
// console.log(positions);

// var stringValue = "  hello world  ";
// var trimmedStringValue = stringValue.trim();
// console.log(stringValue);
// console.log(trimmedStringValue);

// var text = "cat, bat, sat, fat";
// var pattern = /.at/g;
// //与pattern.exec(text)相同
// var matches = text.match(pattern);
// console.log(matches.index);
// console.log(matches);
// console.log(matches.lastIndex);
// var pos = text.search(/at/);
// console.log(pos);

// var text = "cat, bat, sat, fat";
// var result = text.replace("at", "ond");
// console.log(result);
// result = text.replace(/at/g, "ond");
// console.log(result);
// result = text.replace(/(.at)/g, "world ($1)");
// console.log(result);

// function htmlEscape(text) {
//     return text.replace(/[<>"&]/g, function(match, pos, originalText) {
//         switch (match) {
//             case "<":
//                 return "&lt;";
//             case ">":
//                 return "&gt;";
//             case "&":
//                 return "&amp;";
//             case "\"":
//                 return "&quot;";
//         }
//     });
// }
// console.log(htmlEscape("<p class=\"greeting\">Hello world!</p>"));


// var colorText = "red,blue,green,yellow";
// var colors1 = colorText.split(",");
// var colors2 = colorText.split(",", 2);
// var colors3 = colorText.split(/[^\,]+/);
// console.log(colors1);
// console.log(colors2);
// console.log(colors3);

// var uri = "http://www.wrox.com/illegal value.htm#start";
// console.log(encodeURI(uri));
// console.log(encodeURIComponent(uri));
// uri = "http%3A%2F%2Fwww.wrox.com%2Fillegal%20value.htm%23start";
// console.log(decodeURI(uri));
// console.log(decodeURIComponent(uri));

// eval("function sayHi(){ console.log(\"hi\");}");
// sayHi();

// var color = "red";
// function sayColor(){
// 	console.log(window.color);
// }
// window.sayColor();

// //通过这个方式得到global对象。
// var global = function(){
// 	return this;
// }();

// var max = Math.max(3,54,32,16);
// console.log(max);
// var min = Math.min(3,54,32,16);
// console.log(min);
// var values = [1,2,3,4,5,6,7,8];
// max = Math.max.apply(Math, values);
// console.log(max);

console.log(Math.ceil(25.9));
console.log(Math.round(25.9));
console.log(Math.round(25.5));
console.log(Math.round(25.1));
console.log(Math.floor(25.5));
var num = Math.floor(Math.random() * 10 + 1);
console.log(num);



























<|start_filename|>书籍学习源码练习/Head First  html&css学习代码/chapter7/lounge.css<|end_filename|>
body{
	font-family:sans-serif;
}

h1,h2{

	color: gray;
}

h1{
	border-bottom: 1px solid black;
}

p{
	color: maroon;
}

p.greentea{
	color: green;
}

<|start_filename|>书籍学习源码练习/javascript高级程序设计学习代码/chapter11.two.元素遍历.js<|end_filename|>
var i,len,child = element.firstElementChild;
while(child != element.lastElementChild){
	if (child.nodeType == 1) {
		processChild(child);
		child = child.nextElementSibling;
	}
}

<|start_filename|>javascript练习Demo列表/Javascript的设计模式实现/单列模式/typethree.js<|end_filename|>
var CreateDiv = (function() {
    var instance;
    var CreateDiv = function(html) {
        if (instance) { //如果已经初始化了，就直接返回初始化的对象
            return instance;
        }
        this.html = html;
        this.init();
        return instance = this;
    };
    CreateDiv.prototype.init = function() {
        var div = document.createElement("div");
        div.innerHTML = this.html;
        document.body.appendChild(div);
    };
    return CreateDiv;
})();

var a = new CreateDiv('sven1');
var b = new CreateDiv('sven2');
console.log(a === b);


<|start_filename|>OC与JS交互Demo列表/有趣的Demo/JavaScript-Objective-C-Bridge/JSBridgeTest/JavaScriptBridge/JavaScriptBridgeURLConnectionDelegate.h<|end_filename|>
//
//  JavaScriptBridgeURLConnectionHandler.h
//  JSBridgeTest
//
//  Created by <NAME> on 11/03/27.
//  Copyright 2011 Kronecker's Delta Studio. All rights reserved.
//

#import <UIKit/UIKit.h>


@interface JavaScriptBridgeURLConnectionDelegate : NSObject {
    UIWebView *webView;
    NSUInteger connectionID;
}

@property(nonatomic, retain) UIWebView *webView;
@property NSUInteger connectionID;

- (id)initWithWebView:(UIWebView *)webView;

- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error;
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data;
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response;
- (void)connection:(NSURLConnection *)connection didSendBodyData:(NSInteger)bytesWritten totalBytesWritten:(NSInteger)totalBytesWritten totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite;
- (void)connectionDidFinishLoading:(NSURLConnection *)connection;


@end


<|start_filename|>Weex学习/WEEX入门/WEEX入门/WXJSBridgeModule.h<|end_filename|>
//
//  WXJSBridgeModule.h
//  WeexDemo
//
//  Created by Bob on 17/3/8.
//  Copyright © 2017年 taobao. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "WXJSBridgeModuleProtocol.h"
#import <WeexSDK/WXModuleProtocol.h>

@interface WXJSBridgeModule : NSObject <WXJSBridgeModuleProtocol,WXModuleProtocol>

@end


<|start_filename|>vuejs练习Demo列表/混合/index.js<|end_filename|>
var myMixin = {
	created: function () {
		this.hello()
	},
	methods: {
		hello: function () {
			console.log('hello from mixin!')
		}
	}
}

// 定义一个组件，使用这个混合对象
var Component = Vue.extend({
	mixins: [myMixin]
})

var component = new Component()

<|start_filename|>OC与JS交互Demo列表/自己写/html5测试/html5测试/html5/size-and-orientation/app.js<|end_filename|>
/*
  Note: This is a minimalist example for demonstration purposes.
  Use libraries, don't write crap code yourself.
  |8^D
*/
(function () {
  "use strict";

  function getScreenSize() {
    var s = {};

    // Browsers
    if('number' === typeof window.innerWidth) {
      s.width = window.innerWidth;
      s.height = window.innerHeight;
      s.method = 'browser';
      return s;
    }

    // Non-browsers (IE 6+  in 'standards compliant mode')
    if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
      s.width = document.documentElement.clientWidth;
      s.height = document.documentElement.clientHeight;
      s.method = 'ie';
      return s;
    }

    // Legacy non-browsers (IE 4 compatible)
    if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
      s.width = document.body.clientWidth;
      s.height = document.body.clientHeight;
      s.method = 'ie <= 4';
      return s;
    }

    return s;
  }

  function getOrientation() {
    var o = {}, s;

    o.angle = window.orientation;
    if ('undefined' !== o.angle) {
      o.method = 'orientation';
      return o;
    }

    s = getScreenSize();
    o.method = 'resize';
    o.angle = 'portrait';
    if (s.width > s.length) {
      o.angle = 'landscape';
    }
    return o;
  }

  function runReportChanges(ev) {
    var o = getOrientation()
      , s = getScreenSize();

    document.getElementById('event-type').innerHTML = ev.type;
    document.getElementById('orientation-angle').innerHTML = o.angle;
    document.getElementById('orientation-method').innerHTML = o.method;
    document.getElementById('size-width').innerHTML = s.width;
    document.getElementById('size-height').innerHTML = s.height;
    document.getElementById('size-method').innerHTML = s.method;
  }
  

  // window.onload = runReportChanges
  window.addEventListener('load', runReportChanges);
  // window.onorientationchange = runReportChanges
  window.addEventListener('orientationchange', runReportChanges);
  // window.onresize = runReportChanges
  window.addEventListener('resize', runReportChanges);
}());


<|start_filename|>OC与JS交互Demo列表/自己写/html5测试/html5测试/html5/online-status/amionline.js<|end_filename|>
(function () {
  "use strict";

  require('require-kiss');

  var EventEmitter = require('events').EventEmitter
    , navigator = window.navigator
    , Periodic = require('periodic');

  function create(options) {
    options = options || {};

    var emitter = new EventEmitter()
      , useBrowser = true
      , useNotFound = true
      , useAppCache = false
      , useFavinet = true
      , useInternet = true
      , useOrigin = true
      , strategies = {}
      , periodics = {};


    if ('undefined' === navigator.onLine) {
      emitter.status = 'online';
    } else {
      emitter.status = (navigator.onLine && 'online') || 'offline';
    }
    emitter.browserStatus = emitter.status;

    strategies.origin = require('amionline-origin').create;
    strategies.internet = require('amionline-favinet').create;

    function createPeriodicEmitter(key, Strategy, howoften) {
      var status
        , periodic;
      
      // TODO relay(err, evname)
      function relay(err, evname, msg) {
        if (status !== evname) {
          emitter.emit(key, err, evname, msg);
          status = evname;
        }
      }

      function check() {
        Strategy(relay);
      }

      periodic = Periodic.create(check, howoften);
      periodic.checkNow = function (a, b, c) {
        if ('function' === typeof a) {
          Strategy(function (x, y, z) {
            a(x, y, z);
            relay(x, y, z);
          }, b, c);
        } else {
          periodic.run();
        }
      };
      periodics[key] = periodic;
      return periodic;
    }

    function createBrowserEmitter() {
      var status = navigator.onLine && 'online' || 'offline';

      emitter.status = status;

      function handleWindowOnline() {
        if (status === navigator.onLine) {
          return;
        }
        emitter.emit('amionline.browser', null, navigator.onLine);
        status = navigator.onLine;
      }

      // window.onLine can reliably determine that the browser is offline
      // it cannot reliably determine that the browser if online
      // http://www.w3.org/TR/html5/offline.html#browser-state
      window.addEventListener('online', handleWindowOnline, false);
      window.addEventListener('offline', handleWindowOnline, false);

      // I wonder if the online event ever skips firing
      // particularly I worry about sleep / wakeup
      setInterval(handleWindowOnline, 10000);
    }

    periodics.origin = createPeriodicEmitter('amionline-origin', strategies.origin, 5000);
    periodics.internet = createPeriodicEmitter('amionline-internet', strategies.internet, 10000);
    createBrowserEmitter();

    //
    // Interpreting the status results
    //
    /*

        | Browser |  Origin  | Internet ||   STATUS   |
        +=========+==========+==========++============+
        |   OFF!  |         ---         ||    OFF     |
        +---------+----------+----------++------------+
        |         |    OFF!  |   ---    ||    OFF     |
        +         +----------+----------++------------+
        |   ON    |    ON!   |   ---    ||    ON      |
        +         +----------+----------++------------+
        |         |         OFF         ||    OFF     |
        +---------+----------+----------++------------+

    */
    emitter.on('amionline-state', function (err, status) {
      // In the case that the internet is live,
      // but the site is down
      if ('offline' === emitter.originStatus) {
        status = 'offline';
      } else if ('online' === emitter.originStatus) {
        status = 'online';
      }

      // For the rare case that a request finished
      // after the browser goes into offline mode
      if ('offline' === emitter.browserStatus) {
        status = 'offline';
      }

      // If the status hasn't changed
      // don't emit anything
      if (status === emitter.status) {
        return;
      }
      emitter.status = status;

      emitter.emit(status, err);
    });


    // if the browser is offline, that's final
    // if the browser is online, wait for confirmation before declaring it
    emitter.on('amionline-browser', function (err, status) {
      if (status === emitter.browserStatus) {
        return;
      }
      emitter.browserStatus = status;

      // toggle everything off
      if ('offline' === status) {
        emitter.emit('amionline-internet', err, 'offline');
        emitter.emit('amionline-origin', err, 'offline');
        emitter.emit('amionline-state', err, 'offline');
      } /* else {
        emitter.emit('amionline-state', 'offline');
      } */

      emitter.emit('browser', err, status);
    });


    // if the site is up, it's online
    // if the site is down, it's not
    emitter.on('amionline-origin', function (err, status) {
      if (status === emitter.originStatus) {
        return;
      }

      if ('offline' === status || 'error' === status) {
        status = 'offline';
      }
      emitter.originStatus = status;
      emitter.emit('amionline-state', err, status);

      emitter.emit('origin', err, status);
    });


    // if the internet is reachable, that's final
    // if it isn't, wait for confirmation before declaring it
    emitter.on('amionline-internet', function (err, status) {
      if (status === emitter.internetStatus) {
        return;
      }

      if ('offline' === status || 'error' === status) {
        status = 'offline';
      }
      emitter.internetStatus = status;
      emitter.emit('amionline-state', err, status);

      emitter.emit('internet', err, status);
    });

    emitter.use = createPeriodicEmitter;
    emitter.periodics = periodics;
    emitter.checkNow = function (name, a, b, c) {
      periodics[name].checkNow(a, b, c);
    };
    emitter.start = function (name, interval) {
      periodics[name].started = true;
      periodics[name].start(interval);
    };
    emitter.stop = function (name) {
      periodics[name].started = false;
      periodics[name].stop();
    };
    return emitter;
  }

  exports.create = create;
  provide('amionline', exports);
}());


<|start_filename|>javascript练习Demo列表/Javascript的设计模式实现/观察者模式/typeone.房产销售.js<|end_filename|>

//观察者模式,它定义对象间的一种一对多的依赖关系,当一个对象的状 态发生改变时,所有依赖于它的对象都将得到通知。
var salesOffices = {};
salesOffices.clientList = [];//缓存列表、存放订阅者的回调函数
salesOffices.listen = function(key,fn){
	if (!this.clientList[key]) {//如果还没有订阅过此类消息，给该类消息创建一个缓存列表
		this.clientList[key] =[];
	}
	this.clientList[key].push(fn);
};
salesOffices.trigger = function(){
	var key = Array.prototype.shift.call(arguments),fns = this.clientList[key];//取出消息类型，取出消息对应的回调函数
	if (!fns || fns.length === 0) {
		return false;
	}
	for (var i = 0, fn; fn = fns[i++];) {
		fn.apply(this, arguments);
	}
};
salesOffices.listen("squareMeter88", function(price){//小明订阅了88平米的房子的价格
	console.log("价格=" + price);
});
salesOffices.listen("squareMeter110", function(price){//小红订阅了110平米的房子的价格
	console.log("价格=" + price);
});

salesOffices.trigger( 'squareMeter88', 2000000 ); // 发布 88 平方米房子的价格
salesOffices.trigger( 'squareMeter110', 3000000 ); // 发布 110 平方米房子的价格

<|start_filename|>javascript练习Demo列表/跨浏览器的事件处理.js<|end_filename|>
/*
* @Author: huangchengdu
* @Date:   2016-12-29 14:38:20
* @Last Modified by:   huangchengdu
* @Last Modified time: 2016-12-29 14:49:02
*/

var EventUtil = {
	addHandler:function(element,type,handler) {
		if (element.addEventListener) {
			element.addEventListener(type,handler,false);
		}else if(element.attachEvent){
			element.attachEvent("on" + type, handler);
		}else{
			element["on" + type] = handler;
		}
	},
	getEvent:function(event){
		return event?event:window.event;
	},
	getTarget:function(event){
		return event.target || event.srcElement;
	},
	preventDefault:function(event){
		if (event.preventDefault) {
			event.preventDefault();
		}else{
			event.returnValue = false;
		}
	},
	removeHandler:function(element,type,handler){
		if (element.removeEventListener) {
			element.removeEventListener(type,handler,false);
		}else if(element.detachEvent){
			element.detachEvent("on" + type, handler);
		}else{
			element["on" + type] = null;
		}
	},
	stopPropagation:function(event){
		if (event.stopPropagation) {
			event.stopPropagation();
		}else{
			event.cancelBubble = true;
		}
	}
};

export default = EventUtil;

<|start_filename|>Weex学习/weexnew/src/router.js<|end_filename|>
// import Vue from 'vue'
import Router from 'vue-router'
import StoriesView from './views/StoriesView.vue'
import ArticleView from './views/ArticleView.vue'
import CommentView from './views/CommentView.vue'
import UserView from './views/UserView.vue'
import DemoView from './WeexDemo/total.vue'
import first from './WeexDemo/first.vue'
import second from './WeexDemo/second.vue'
import three from './WeexDemo/three.vue'
import four from './WeexDemo/four.vue'
import five from './WeexDemo/five.vue'
import six from './WeexDemo/six.vue'

Vue.use(Router)

// Story view factory
function createStoriesView (type) {
  return {
    name: `${type}-stories-view`,
    render (createElement) {
      return createElement(StoriesView, { props: { type }})
    }
  }
}

export default new Router({
  // mode: 'abstract',
  routes: [
    { path: '/top', component: createStoriesView('top') },
    { path: '/new', component: createStoriesView('new') },
    { path: '/show', component: createStoriesView('show') },
    { path: '/ask', component: createStoriesView('ask') },
    { path: '/job', component: createStoriesView('job') },
    { path: '/demo', component: DemoView},
    { path: '/first', component:first},
    { path: '/second', component:second},
     { path: '/three', component:three},
     { path: '/four', component:four},
     { path: '/five', component:five},
     { path: '/six', component:six},
    { path: '/article/:url(.*)?', component: ArticleView },
    { path: '/item/:id(\\d+)', component: CommentView },
    { path: '/user/:id', component: UserView },
    { path: '/', redirect: '/top' }
  ]
})


<|start_filename|>OC与JS交互Demo列表/自己写/html5测试/html5测试/html5/accelerometer/app.js<|end_filename|>
var global = (function () { return this; }());
(function () {
  "use strict";

  function run() {
    var setText = function (id, text) {
          global.document.getElementById(id).innerHTML = String(text);
        };

    function handleDeviceMotion(ev) {
      setText('x', ev.accelerationIncludingGravity.x);
      setText('y', ev.accelerationIncludingGravity.y);
      setText('z', ev.accelerationIncludingGravity.z);
      setText('interval', ev.interval);
    }

    if (undefined === window.DeviceMotionEvent) {
      setText('bad-news', "undefined === window.DeviceMotionEvent<br/>Your device is not supported.");
      return;
    }

    setText('no', '');
    window.addEventListener("devicemotion", handleDeviceMotion);
  }

  window.addEventListener('load', run);

}());


<|start_filename|>书籍学习源码练习/HTML5权威指南学习源码/chapter3/one.html<|end_filename|>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "http://www.w3.org/TR/html4/strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>one</title>
	<meta name="author" content="huangchengdu" />
	<!-- Date: 2016-06-22 -->
</head>
<body>
	I like <code>apples</code> and oranges.
	
	I like apples and aranges.
	<hr/>
	Today was warm and sunny.
	
	I like <a class="link" href="apples.html" id="firstlink">apples</a> and oranges.
	<hr />
	Enter your name:<input disabled="">
	Enter your name:<input disabled="disabled">
</body>
</html>



<|start_filename|>OC与JS交互Demo列表/自己写/html5测试/html5测试/html5/accelerometer/index.html<|end_filename|>
<!DOCTYPE html> 
<html><!-- TODO manifest -->
  <head> 
    <title>Accelerometer</title> 

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
    <meta name="apple-touch-fullscreen" content="yes" /> 
    <meta name="apple-mobile-web-app-capable" content="yes" /> 
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> 

    <!-- link rel="stylesheet" type="text/css" href="style.css" media="screen" /-->
    <link rel="apple-touch-icon" href="gyroscope.png" /> 
    <script src="app.js"></script> 
  </head> 
 
  <body> 
    This tests only the accelerometer of your device. This does not test the Gyroscope.
    <div id="bad-news">&nbsp;</div>
    <div id="no"> 
      Your browser does not support Device Orientation and Motion API. Try this sample with iPhone, iPod or iPad with iOS 4.2+.    
    </div> 
    X: <span id="x">$nbsp;</span>
    <br/>
    Y: <span id="y">$nbsp;</span>
    <br/>
    Z: <span id="z">$nbsp;</span>
    <br/>
    Interval: <span id="interval">$nbsp;</span>
  </body> 
</html> 


<|start_filename|>javascript练习Demo列表/Javascript的设计模式实现/基础知识/chapter.three.js<|end_filename|>
//高阶函数
var appendDiv = function(callback) {
    for (var i = 0; i < 100; i++) {
        var div = document.createElement("div");
        div.innerHTML = i;
        document.body.appendChild(div);
        if (typeof callback === "function") {
            callback(div);
        }
    }
};
appendDiv(function(node) {
    node.style.display = "none";
});

[1, 4, 3].sort(function(a, b) {
    return b - a;
});

//函数作为返回值
var isType = function(type) {
    return function(obj) {
        return Object.prototype.toString.call(obj) === "[Object" + type + "]";
    }
};
var isString = isType("String");
var isArray = isType("Array");
console.log(isArray([1, 2, 3]));

//单列
var getSingle = function(fn) {
    var ret;
    return function() {
        return ret || (ret = fn.apply(this, arguments));
    };
};
var getScript = getSingle(function() {
    return document.createElement("script");
});
var script1 = getScript();
var script2 = getScript();
console.log(script1 === script2);


//高阶函数实现AOP
Function.prototype.before = function(beforefn) {
    var __self = this; // 保存原函数的引用
    return function() { // 返回包含了原函数和新函数的"代理"函数
        beforefn.apply(this, arguments);
        return __self.apply(this, arguments);
        Function.prototype.after = function(afterfn) {
            var __self = this;
            return function() {
                // 执行新函数,修正 this // 执行原函数
            }
        };
        var ret = __self.apply(this, arguments);
        afterfn.apply(this, arguments);
        return ret;
    }
};
var func = function() {
    console.log(2);
};
func = func.before(function() {
    console.log(1);
}).after(function() {
    console.log(3);
});
func();









<|start_filename|>书籍学习源码练习/javascript高级程序设计学习代码/chapter10.one.js<|end_filename|>
//===========================Node类型===============================
var firstChild = someNode.childNodes[0];
var secondChild = someNode.childNodes.item(1);
var count = someNode.childNodes.length;

//把nodeList转换为数组
var arrayOfNodes = Array.prototype.slice.call(someNode.childNodes, 0);

if (someNode.nodeType == 1) {
    var value = someNode.nodeValue;
    var name = someNode.nodeName;
}

//兼容IE
function converToArray(nodes) {
    var array = null;
    try {
        array = Array.prototype.slice.call(nodes, 0); //非IE浏览器
    } catch (ex) {
        array = new Array();
        for (var i = 0, len = nodes.length; i < len; i++) {
            array.push(nodes[i]);
        }
    }
    return array;
}

//同胞节点
if (someNode.nextSibling === null) {
    console.log("这是节点的最后一个节点");
} else if (someNode.previousSibling === null) {
    console.log("第一个节点");
}


//节点操作
var returnedNode = someNode.appendChild(newNode);
console.log(returnedNode == newNode); //true

//插入最后
var returnedNode = someNode.insertBefore(newNode, null);
console.log(newNode == someNode.lastChild);

//节点替换
var returnedNode = someNode.replaceChild(newNode, someNode.firstChild);

//移除节点
var formerFirstChild = someNode.removeChild(someNode.firstChild);

//深复制  同时复制子节点  浅复制  不复制子节点

//===========================Document类型===============================
//获取html节点
var html =  document.documentElement;
console.log(html === document.childNodes[0]);
console.log(html === document.firstChild);

//文档标题
var originalTitle = document.title;
document.title = "New page title";


var url = document.URL;
var domain = document.domain;
var referrer = document.referrer;
console.log(url);
console.log(domain);
console.log(referrer);


//把内容动态写入html
<html>
	<head>
		<title>document.write() example</title>
	</head>
	<body>
	<script type="text/javascript">
		<p>当前时间是:</p>
		document.write("<strong>" + (new Date()).toString() + "</strong>");
		</script>
	</body>
</html>


//==============================Element类型===========================
//<div id="myDiv" class="bd" title="Body text" lang="en" dir="ltr"></div>;

console.log(div.id);
console.log(div.className);
console.log(div.title);
console.log(div.lang);
console.log(div.dir);

var div = document.getElementById("myDiv");
div.setAttribute("id", "someOtherId");
div.removeAttribute("class");
console.log(div.getAttribute("id"));
console.log(div.getAttribute("class"));
console.log(div.getAttribute("title"));
console.log(div.getAttribute("lang"));
console.log(div.getAttribute("dir"));

//创建元素
var div = document.createElement("div");
div.id = "myNewDiv";
div.className = "box";
document.body.appendChild(div);
//另一种方式创建元素
var div = document.createElement("<div id=\"myNewDiv\" class=\"box\"></div >");

//==============================Text类型===========================
//<div>Hello World!</div>
var textNode = div.firstChild;
var textNode = div.childNodes[0];
div.firstChild.nodeValue = "Some other message";

var element = document.createElement("div");
element.className = "message";
var textNode = document.createTextNode("<strong>Hello</strong> world!");
element.appendChild(textNode);
document.body.appendChild(element);

//textNode节点合并
var element = document.createElement("div");
element.className = "message";
var textNode = document.createTextNode("Hello world!");
element.appendChild(textNode);
var anotherTextNode = document.createTextNode("Yippee!");
element.appendChild(anotherTextNode);
document.body.appendChild(element);
console.log(element.childNodes.length);//2
element.normalize();//textnode合并
console.log(element.childNodes.length);//1
console.log(element.firstChild.nodeValue);//"Hello world!Yippee!"


//分割文本节点
var element = document.createElement("div");
element.className = "message";
var textNode = document.createTextNode("Hello world!");
element.appendChild(textNode);
document.body.appendChild(element);
var newNode = element.firstChild.splitText(5);
console.log(element.firstChild.nodeValue);//Hello
console.log(newNode.nodeValue);//world!
console.log(element.childNodes.length);//2

//==============================Comment类型===========================
//<div id="myDiv"><!--A comment --></div>
var div = document.getElementById("myDiv");
var comment = div.firstChild;
console.log(comment.data);// "A comment"

//==============================CDATASection类型===========================

//==============================DocumentFragment类型===========================
//批量添加节点
//<ul id="myList"></ul>
var fragment = document.createDocumentFragment();
var ul = document.getElementById("myList");
var li = null
for (var i = 0; i < 3; i++) {
    li = document.createElement("li");
    li.appendChild(document.createTextNode("Item" + (i + 1)));
    fragment.appendChild(li);
}
ul.appendChild(fragment);


//==============================Attr类型===========================
var attr = document.createAttribute("align");
vttr.value = "left";
element.setAttributeNode(attr);
console.log(element.attributes["align"].value);//left
console.log(element.getAttributeNode("align").value);//left
console.log(element.getAttribute("align"));//left





























<|start_filename|>书籍学习源码练习/javascript高级程序设计学习代码/chapter17.one.js<|end_filename|>
//=============================错误类型===================================
  // //这个是基类类型的错误
  // Error
  // EvalError
  // RangeError
  // ReferenceError 
  // SyntaxError
  // TypeError
  // URIError

//EvalError
// new eval();
// eval = foo;

//RangeError
// var items1 = new Array(-20);
// var items2 = new Array(Number.MAX_VALUE);

//ReferenceError
// var obj = x;

//SyntaxError
// eval("a ++ b");

//TypeError
// var o = new 10;
// console.log("name" in true);

// try{
// 	someFunction();
// }catch(error){
// 	if (error instanceof TypeError) {
// 		console.log("TypeError");
// 		console.log(error.message);
// 	}else if(error instanceof ReferenceError){
// 		console.log("RefrenceError");
// 		console.log(error.message);
// 	}else{
// 		console.log(error.message);
// 	}
// }finally{
// 	console.log("不管有么有错，这个都回执行");
// }

// throw 12345;
// throw new SyntaxError("I don't like your syntax.");

//自定义error类型
// function CustomError(message){
// 	this.name = "CustomError";
// 	this.message = message;
// }
// CustomError.prototype = new Error();
// throw new CustomError("My Message");

function process(values){
	if (!(values instanceof Array)) {
		throw new Error("process() Argument must be a array");
	}
	values.sort();
	console.log("1111111");
	try{
		console.log("22222222");
	}catch(error){
		console.log(error.message);
		console.log("333333");
	}
	console.log("4444444");
	return -1;
}
process(sdfsd);
window.onerror = function(message, url, line){
	console.log(message);
	return false; //阻止浏览器的默认报错行为
}






















<|start_filename|>书籍学习源码练习/Head First  html&css学习代码/chapter8/journal/journal.css<|end_filename|>
/*
引入一个字体
*/
@font-face{
	font-family: "Emblema One";
	src:url(EmblemaOne-Regular.woff),
	    url(EmblemaOne-Regular.ttf);
}


body{
	font-family: Verdana,"Emblema One", Geneva, Arial, sans_serif;
	font-size: small;
}
h1,h2{
	color: #cc6600;
	/*下划线
	text-decoration: underline;
	*/
	border-bottom: thin dotted #888888;
}
/*
下面这两个字体比例是body字体大小的1.5倍和1.2倍。
*/
h1{
	font-family: "Emblema One",sans_serif;
	font-size: 220%;
	border-bottom: none;
}
h2{
	font-size: 1.2em;
	/*删除从父类节点继承的属性*/
	font-weight: normal;
}
blockquote{
	font-style: italic;
}

<|start_filename|>书籍学习源码练习/Head First  html&css学习代码/chapter7/index.html<|end_filename|>
<!doctype <!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>Head First Lounge</title>
	<style type="text/css">
	p{
		color: maroon;
	}
	h1{
		font-family: sans-serif;
		color: gray;
	}
	h2{
		font-family: sans-serif;
		color: gray;
	}
	</style>
</head>
<body>
<h1>Welcome to the Head First Lounge</h1>
<p>
	<img src="images/drinks.gif" alt="Drinks">
</p>
<p>
	Join us any evening for refreshing
	<a href="beverages/elixir.html">elixirs</a>,
	conversation and maybe a game or two of 
	<em>Dance Dance Revolution</em>.
	Wireless access is always provided;
	BYOWS (Bring your own Web server).
</p>
<h2>Directions</h2>
<p>
	you'll find us right in the center of downtown Webville.If you need help finding us, check out our 
	<a href="about/directions.html">detailed directions</a>.
	Come join us!
</p>
</body>
</html>

<|start_filename|>书籍学习源码练习/Head First  html&css学习代码/chapter1/html基础1.html<|end_filename|>
<html>
	<head>
		<title>starbuzz coffee</title>
		<style type="text/css">
			body {
				background-color: #d2b48c;
				margin-left: 20%;
				margin-right: 20%;
				border: 1px dotted gray;
				padding: 10px 10px 10px 10px;
				font-family: sans-serif;
				}
		</style>
	</head>
	<body>
		<h1>Starbuzz coffeee Bevegages</h1>
		<h2>house blend,$1.49</h2>
		<p id=“houseblend”>A smooth, mild blend of coffees from mexico, bolivia and guatemala.</p>
		
		<h2>Mocha Cafe Latte, $2.35</h2>
		<p>Espresso, stearmed mild and chololate syrup.</p>
		
		<h2>cappuccion,$1.85</h2>
		<p>A spicy drink made with black tea, spices, mild and honey</p>
	</body>
</html>

<|start_filename|>构建工具之Webpack傻瓜指南之部署发布之多页面/app/mobile.js<|end_filename|>
/*
* @Author: huangchengdu
* @Date:   2016-11-15 18:09:39
* @Last Modified by:   huangchengdu
* @Last Modified time: 2016-11-15 18:09:52
*/

import './main.scss';
import $ from 'jquery';
import 'imports?jQuery=jquery!./plugin.js';

$(document).ready(function() {
  let app  = document.createElement('div');
  app.innerHTML = '<h1>Hello World</h1>';
  document.body.appendChild(app);
  $('h1').greenify();
});


<|start_filename|>OC与JS交互Demo列表/自己写/html5测试/html5测试/html5/offline-app/app-cache.js<|end_filename|>
// http://www.html5rocks.com/tutorials/appcache/beginner/
var window, global = (function () { return this; }());
/*global global: true */
(function () {
  "use strict";

  require('require-kiss');

  var document = window.document
    , appCacheKey = 'application-cache-cached'
    , appCache = window.applicationCache
    , Future = require('futures/future')
    , future = Future()
    , EventEmitter = require('events').EventEmitter
    , updateEmitter = new EventEmitter()
    , loadEmitter = new EventEmitter()
    , defaultUpdatePeriod = 1 * 60
    , shouldRefreshOnCleanUpdate = true
    , updateIsDownloading = false
    , alreadyChecked = false
    , primaryEmitter = loadEmitter
    , onlineStatus 
    , updateInterval;

    //  appCacheStatuses = [
    //    "UNCACHED",
    //    "IDLE",
    //    "CHECKING",
    //    "DOWNLOADING",
    //    "UPDATEREADY",
    //    "OBSOLETE"
    //  ];

  if (undefined === appCache) {
    alert("Your device is incompatible. Try iOS, Android, or Linux. Windows requires Google Chrome");
    window.location.href = "http://www.google.com/chrome";
  }

  // for conveniece
  appCache.on = appCache.addEventListener || appCache.attachEvent;
  appCache.off = appCache.removeEventListener || appCache.detachEvent;

  // utility
  function reload() {
    try {
      appCache.swapCache();
    } catch(e) {
      // Sometimes this errors out. Weird.
    }
    window.location.reload();
  }

  function isFirstRun() {
    return !localStorage.getItem(appCacheKey);
  }

  function checkOnlineStatus(cb) {
    var xhr = new XMLHttpRequest();
    xhr.open("GET", "online.json?_invalidate_cache_=" + new Date().valueOf(), true);
    function readyHandler(data) {
      try {
        data = JSON.parse(data);
      } catch(e) {
        if (!data.status) {
          data = { status: "parse error" };
        }
      }
      onlineStatus = data.status
      cb(onlineStatus);
    }
    xhr.onreadystatechange = function (ev) {
      if (xhr.readyState == 4) {
        if(xhr.status == 200) {
          readyHandler(xhr.responseText);
        } else {
          readyHandler('{ "status": "error" }');
        }
      }
    };
    xhr.send();
  }

  function interpretError(ev, cb) {
    var result = "offline";
    // If this is the first run and there's an error, it must be an error
    // note: clearing localStorage may cause a false positive here)
    // TODO: provide a cookie stategy as well

    // If there is an error in the middle of an update, it's an error,
    // even if the browser simply went offline in the middle of it
    if (isFirstRun() || updateIsDownloading) {
      cb('error');
      return;
    }

    // if we're offline, assume no error
    // otherwise, assume an error
    checkOnlineStatus(cb);

    // TODO when appCache.status is 1, there is not an error
  }

  //
  // Initial Event
  //
  // checking     - fetching the application cache manifest and checking for updates.

  //
  // Progress Events
  //
  // downloading  - resources are being downloaded into the cache.
  // progress     - periodically throughout the download process.

  //
  // Final Events
  //
  // error        - an error occurs during the caching process.
  //              - or simply offline
  // noupdate     - there is no update to download
  // updateready  - a resource update is ready
  // cached       - caching is complete.

  //
  // States and Conditions to test
  //
  // Possible States
  // * Initial Load
  // * Update
  // * Offline
  //
  // Bad manifest
  // * incorrect mime-type
  // * missing resource
  // 

  function onInstallStart(ev) {
    future.when(function () {
      console.log('start', ev, 'status', appCache.status, new Date().toISOString());
      primaryEmitter.emit('start');
    });
  }

  function onInstallLoadStart(ev) {
    future.when(function () {
      console.log('loadstart', ev, 'status', appCache.status, new Date().toISOString());
      updateIsDownloading = true;
      primaryEmitter.emit('loadstart');
    });
  }

  function onInstallProgress(ev) {
    future.when(function () {
      console.log('progress', ev, 'status', appCache.status, new Date().toISOString());
      primaryEmitter.emit('progress', ev);
    });
  }

  function onInstallEnd(ev) {
    future.when(function () {
      console.log('end', ev, 'status', appCache.status, new Date().toISOString());
      primaryEmitter.emit('end');
    });
  }

  function onInstallError(ev) {
    future.when(function () {
      function errorResultHandler(result) {
        if ('offline' === result) {
          console.log('offline', result);
          onInstallEnd(ev);
        } else {
          primaryEmitter.emit('error', ev);
        }
        console.log(result, ev, 'status', appCache.status, new Date().toISOString());
      }

      interpretError(ev, errorResultHandler);
    });
  }

  function onInstallLoadEnd(ev) {
    future.when(function () {
      console.log('loadend', ev, 'status', appCache.status, new Date().toISOString());
      // `cached` would only fire under a very rare condition:
      //
      //   * a cache manifest was added while the user was using the application
      //   * the user was on a page that did not include the cache manifest in the <html manifest=''>
      //   * the user opened a page that does include the cache manifest in a different tab
      //
      // It would never fire as part of an 'upgrade'
      primaryEmitter.emit('loadend');

      // should reload if the page just loaded with updates
      if ('updateready' === ev.type && !alreadyChecked) {
        setTimeout(function () {
          if (confirm('A new version of this site is available. Load it?')) {
            reload();
          }
        }, 500);
      }

      // this only happens the very first time the app is cached
      if ('cached' === ev.type) {
        localStorage.setItem('application-cache-cached', new Date().toISOString());
      }

      onInstallEnd(ev);
    });
  }

  function addOnCacheLoad() {
    // start and end events always happen
    appCache.on('checking', onInstallStart, false);
    appCache.on('noupdate', onInstallEnd, false);

    appCache.on('error', onInstallError, false);

    // loadstart, progress happen only if an update is available
    appCache.on('downloading', onInstallLoadStart, false);
    appCache.on('progress', onInstallProgress, false);

    // onUpdateEnd handles loadend, error, and end
    appCache.on('updateready', onInstallLoadEnd, false);
    appCache.on('cached', onInstallLoadEnd, false);
  }

  // Check Every X Minutes
  function setUpdateInterval(period) {
    period = Number(period) || defaultUpdatePeriod;
    clearInterval(updateInterval);
    if (period < 1) {
      return;
    }

    period *= (60 * 1000);
    updateInterval = setInterval(appCache.update, period);
  }

  function setOnlineCheckInterval(period) {
    period = Number(period) || defaultUpdatePeriod;
    // TODO
    return;
  }

  // It may be possible for the update to be
  // in progress before the loading begins?
  // XXX
  // TODO fix to work in Firefox and Webkit at the same time
  // XXX
  window.addEventListener('load', function () {
    console.log('loaded dom');
    future.when(function () {
      console.log('fulfilled future before');
    });
    future.fulfill();
    future.when(function () {
      console.log('fulfilled future after');
    });
    console.log('fulfilled future');
  }, false);
  addOnCacheLoad();

  setUpdateInterval();
  setOnlineCheckInterval();

  loadEmitter.on('end', function () {
    primaryEmitter = updateEmitter;
    alreadyChecked = true;
  });

  updateEmitter.on('end', function () {
    updateIsDownloading = false;
  });

  exports.setUpdateInterval = setUpdateInterval;
  exports.setOnlineCheckInterval = setOnlineCheckInterval;
  exports.isFirstRun = isFirstRun;
  exports.isInstalled = function () {
    return !isFirstRun();
  };
  exports.load = loadEmitter;
  exports.update = updateEmitter;
  exports.checkNow = function () {
    appCache.update();
  };
  exports.reload = reload;

  provide('app-cache', exports);
}());


<|start_filename|>书籍学习源码练习/javascript高级程序设计学习代码/chapter13.two.EventUtil.js<|end_filename|>
//跨浏览器事件对象
var EventUtil = {
	addHandler:function(element, type, handler){
		if (element.addEventListener) {//DOM2 非ID
			element.addEventListener(type,handler,false);
		}else if (element.attachEvent) {//IE
			element.attachEvent("on" + type, handler);
		}else{//DOM0
			element["on" + type] = handler;
		}
	},
	removeHandler:function(element, type, handler){
		if (element.removeEventListener) {
			element.removeEventListener(type, handler, false);
		}else if (element.detachEvent) {
			element.detachEvent("on" + type, handler);
		}else{
			element["on" + type] = null;
		}
	},
	getEvent:function(event){
		return event?event:window.event;
	},
	getTarget:function(event){
		return event.target || event.srcElement;
	},
	preventDefault:function(event){
		if (event.preventDefault) {
			event.preventDefault();
		}else{
			event.returnValue = false;
		}
	},
	stopPropagation:function(event){
		if (event.stopPropagation) {
			event.stopPropagation();
		}else {
			event.cancelBubble = true;
		}
	},
	getRelatedTarget:function(event){
		if (event.relatedTarget) {
			return event.relatedTarget;
		}else if(event.toElement){
			return event.toElement;
		}else if(event.fromElement){
			return event.fromElement;
		}else{
			rturn null;
		}
	},
	getCharCode:function(event){
		if (typeof event.charCode == "number") {
			return event.charCode;
		}else {
			return event.keyCode;
		}
	}
};

<|start_filename|>书籍学习源码练习/javascript高级程序设计学习代码/chapter6.two.创建对象.js<|end_filename|>
//========================创建对象============================

//========================工厂模式============================
// function createPerson(name,age,job) {
// 	var o = new Object();
// 	o.age = age;
// 	o.name = name;
// 	o.job = job;
// 	o.sayName = function(){
// 		console.log(this.name);
// 	}
// 	return o;
// }
// var person1 = createPerson("Nicholas", 29, "Software Engineer");
// var person2 = createPerson("Greg", 27, "Doctor");

//========================构造函数模式============================
// function Person(name, age, job){
// 	this.name = name;
// 	this.age = age;
// 	this.job = job;
// 	this.sayName = function(){
// 		console.log(this.name);
// 	};
// }
// var person1 = new Person("Nicholas", 29, "software Engineer");
// var person2 = new Person("Greg", 27, "Doctor");
// console.log(person1.constructor == Person);
// console.log(person2.constructor == Person);
// console.log(person1 instanceof Object);
// //当成普通函数调用
// Person("Greg", 27, "Doctor");
// window.sayName();
// //在另一个对象的作用域中调用
// var o = new Object();
// Person.call(o, "Kristen", 25, "Nurse");
// o.sayName();
//========================原型模式============================
// function Person(){

// }
// Person.prototype.name = "Nicholas";
// Person.prototype.age = 29;
// Person.prototype.job = "Software Engineer";
// Person.prototype.sayName = function(){
// 	console.log(this.name);
// };
// var person1 = new Person();
// console.log(person1.sayName());
// var person2 = new Person();
// console.log(person2.sayName());
// console.log(person1.sayName == person2.sayName);
// console.log(Person.prototype.isPrototypeOf(person1));
// console.log(Object.getPrototypeOf(person1) == Person.prototype);
// console.log(Object.getPrototypeOf(person1).name);

// function Person(){

// }
// Person.prototype.name = "Nicholas";
// Person.prototype.age = 29;
// Person.prototype.job = "Software Engineer";
// Person.prototype.sayName = function(){
// 	console.log(this.name);
// };
// var person1 = new Person();
// var person2 = new Person();
// person1.name = "Greg";
// console.log(person1.name);
// console.log(person2.name);
// console.log(person1.hasOwnProperty("name"));
// delete person1.name;
// console.log(person1.name);
// console.log(person1.hasOwnProperty("name"));

// //用于判断一个属性是否属于对象的原型
// function hasPrototypeProperty(object, name){
// 	return !object.hasOwnProperty(name) && (name in object);
// }
// function Person(){
// }
// Person.prototype.name = "Nicholas";
// Person.prototype.age = 29;
// Person.prototype.job = "Software Engineer";
// Person.prototype.sayName = function(){
// 	console.log(this.name);
// };
// var person = new Person();
// console.log(hasPrototypeProperty(person, "name"));
// person.name = "Greg";
// console.log(hasPrototypeProperty(person, "name"));

// function Person(){
// }
// Person.prototype.name = "Nicholas";
// Person.prototype.age = 29;
// Person.prototype.job = "Software Engineer";
// Person.prototype.sayName = function(){
// 	console.log(this.name);
// };
// var keys = Object.keys(Person.prototype);
// console.log(keys);
// var p1 = new Person();
// p1.name = "Rob";
// p1.age =31;
// var p1keys = Object.keys(p1);
// console.log(p1keys);

// function Person(){
// }
// Person.prototype ={
// 	name: "Nicholas",
// 	age: 29,
// 	job: "software Engineer",
// 	sayName:function(){
// 		console.log(this.name);
// 	}
// };
// //重设构造函数，只适用于ECMAScript 5兼容的浏览器
// Object.defineProperty(Person.prototype, "constructor", {
// 	enumerable:false,
// 	value: Person
// });

// function Person(){}
// var friend = new Person();
// Person.prototype = {
// 	constructor: Person,
// 	name: "Nicholas",
// 	age: 29,
// 	job: "Software Engineer",
// 	sayName:function(){
// 		console.log(this.name);
// 	}
// };
// //下面这句话会发生错误，实例指向原来的原型，重写原型并不会改变实例的最初指向。
// friend.sayName();

//========================组合使用构造函数模式和原型模式============================
// function Person(name, age, job){
// 	this.name = name;
// 	this.age = age;
// 	this.job = job;
// 	this.friends = ["Shelby", "Court"];
// }
// Person.prototype = {
// 	consturctor: person,
// 	sayName:function(){
// 		console.log(this.name);
// 	}
// }
// var person1 = new Person("Nicholas", 29, "Software Engineer");
// var person2 = new Person("Greg", 27, "Doctor");
// person1.friends.push("Van");
// console.log(person1.friends);
// console.log(person2.friends);
// console.log(person1.friends === person2.friends);
// console.log(person1.sayName === person2.sayName);

//========================动态原型模式============================
// function Person(name, age, job){
// 	this.name = name;
// 	this.age = age;
// 	this.job = job;
// 	if (typeof this.sayName != "function") {
// 		Person.prototype.sayName = function(){
// 			console.log(this.name);
// 		};
// 	}
// }
// var friend = new Person("Nicholas", 29, "Software Engineer");
// friend.sayName();

//========================寄生构造函数模式(不建议使用)============================
function SpecialArray(){
	var values = new Array();
	values.push.apply(values,arguments);
	values.toPipedString = function(){
		return this.join("|");
	}
	return values;
}
var colors = new SpecialArray("red", "blue", "green");
console.log(colors.toPipedString());

//========================稳妥构造函数模式============================



























<|start_filename|>书籍学习源码练习/Head First Javascript学习代码/chapter12/date.js<|end_filename|>
Date.prototype.shortFormat = function() {
	return (this.getMonth() + 1) + "/" + this.getDate() + "/" + this.getFullYear();
};

<|start_filename|>css&less&webpack练习/lessproject/build/dev-server.js<|end_filename|>
//==================这个文件是run dev的时候运行的配置文件====================

//检查node和npm的版本
require('./check-versions')()
//获取confit/index.js的默认配置
var config = require('../config')
// 如果 Node 的环境无法判断当前是 dev / product 环境
// 使用 config.dev.env.NODE_ENV 作为当前的环境
if (!process.env.NODE_ENV) process.env.NODE_ENV = JSON.parse(config.dev.env.NODE_ENV)
// 使用 NodeJS 自带的文件路径工具
var path = require('path')
// 使用 express
var express = require('express')
// 使用 webpack
var webpack = require('webpack')
// 一个可以强制打开浏览器并跳转到指定 url 的插件
var opn = require('opn')
// 使用 proxyTable
var proxyMiddleware = require('http-proxy-middleware')
// 使用 dev 环境的 webpack 配置
var webpackConfig = require('./webpack.dev.conf')
// 如果没有指定运行端口，使用 config.dev.port 作为运行端口
var port = process.env.PORT || config.dev.port
// 使用 config.dev.proxyTable 的配置作为 proxyTable 的代理配置
var proxyTable = config.dev.proxyTable
// 使用 express 启动一个服务
var app = express()
// 启动 webpack 进行编译
var compiler = webpack(webpackConfig)
// 启动 webpack-dev-middleware，将编译后的文件暂存到内存中
var devMiddleware = require('webpack-dev-middleware')(compiler, {
  publicPath: webpackConfig.output.publicPath,
  quiet: true
})
// 启动 webpack-hot-middleware，也就是我们常说的 Hot-reload
var hotMiddleware = require('webpack-hot-middleware')(compiler, {
  log: () => {}
})
compiler.plugin('compilation', function (compilation) {
  compilation.plugin('html-webpack-plugin-after-emit', function (data, cb) {
    hotMiddleware.publish({ action: 'reload' })
    cb()
  })
})
// 将 proxyTable 中的请求配置挂在到启动的 express 服务上
Object.keys(proxyTable).forEach(function (context) {
  var options = proxyTable[context]
  if (typeof options === 'string') {
    options = { target: options }
  }
  app.use(proxyMiddleware(context, options))
})
//使用 connect-history-api-fallback 匹配资源，如果不匹配就可以重定向到指定地址
app.use(require('connect-history-api-fallback')())
// 将暂存到内存中的 webpack 编译后的文件挂在到 express 服务上
app.use(devMiddleware)
// 将 Hot-reload 挂在到 express 服务上
app.use(hotMiddleware)
// 拼接 static 文件夹的静态资源路径
var staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory)
// 为静态资源提供响应服务
app.use(staticPath, express.static('./static'))

var uri = 'http://localhost:' + port
devMiddleware.waitUntilValid(function () {
  console.log('> Listening at ' + uri + '\n')
})
// 让我们这个 express 服务监听 port 的请求，并且将此服务作为 dev-server.js 的接口暴露
module.exports = app.listen(port, function (err) {
  if (err) {
    console.log(err)
    return
  }
  // 如果不是测试环境，自动打开浏览器并跳到我们的开发地址
  if (process.env.NODE_ENV !== 'testing') {
    opn(uri)
  }
})


<|start_filename|>构建工具之Webpack傻瓜指南之部署发布之多页面/app/main.css<|end_filename|>
/*
* @Author: huangchengdu
* @Date:   2016-11-15 16:23:52
* @Last Modified by:   huangchengdu
* @Last Modified time: 2016-11-15 16:30:18
*/

h2 {
    color: green;
}

<|start_filename|>OC与JS交互Demo列表/有趣的Demo/JS-Call-OC/JS-Call-OC/ViewController.h<|end_filename|>
//
//  ViewController.h
//  JS-Call-OC
//
//  Created by Jakey on 14-8-6.
//  Copyright (c) 2014年 www.skyfox.org. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController
- (IBAction)reload:(id)sender;
@property (weak, nonatomic) IBOutlet UIWebView *myWebView;

@end


<|start_filename|>vuejs练习Demo列表/渐进过渡/index.css<|end_filename|>
ul {
	padding-left: 0;
	font-family: Helvetica, Arial, sans-serif;
}
.staggered-transition {
	transition: all .5s ease;
	overflow: hidden;
	margin: 0;
	height: 20px;
}
.staggered-enter, .staggered-leave {
	opacity: 0;
	height: 0;
}

<|start_filename|>javascript练习Demo列表/Javascript的设计模式实现/基础知识/chapter.two.js<|end_filename|>
window.name = "globalName";
var myObject = {
    name: "sven",
    getName:function() {
        return this.name;
    }
};
var getName = myObject.getName;
console.log(getName());


var MyClass = = function(){
	this.name = "sven";
	return {
		name: "anne"
	}
};
var obj = new MyClass();
console.log(obj.name);


var obj1 = {
	name : "sven",
	getName:function(){
		return this.name;
	}
};
var obj2 = {
	name: "anne"
};
console.log(obj1.getName());
console.log(obj1.getName.call(obj2));


document.getElementById = (function(func){
	return function(){
		return func.apply(document,arguments);
	}
})(document.getElementById);
var getId = document.getElementById;
var div = getId("div1");
console.log(div.id);


//bind函数自己实现
Function.prototype.bind = function(context){
	var self = this;
	return function(){
		return self.apply(context, arguments);
	}
};
var obj = {
	name: "sven"
};
var func = function(){
	console.log(this.name);
}.bind(obj);
func();


var A = function(name){
	this.name = name;
};
var B = function(){
	A.apply(this, arguments);
};
B.prototype.getName = function(){
	return this.name;
}
var b = new B("sven");
console.log(b.getName());


















<|start_filename|>ajax学习练习Demo列表/glod/my.js<|end_filename|>
//创建ajax引擎
function getXmlHttpObject() {
    var xmlHttpRequest;
    //不同浏览器获取xmlhttprequest对象的方法不一样
    if (window.ActiveXobject) {
        xmlHttpRequest = new ActiveXobject("Microsoft.XMLHTTP");
    } else {
        xmlHttpRequest = new XMLHttpRequest();
    }
    return xmlHttpRequest;
}

function $(id) {
    return document.getElementById(id);
}


<|start_filename|>html&css练习Demo列表/CSS3练习(边框、背景、文本、自定义font).html<|end_filename|>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>CSS3练习</title>
	<style type="text/css">
		#radius{
			text-align: center;
			border: 2px solid #a1a1a1;
			padding: 10px 40px;
			background: #dddddd;
			width: 350px;
			border-radius: 25px;
			-moz-border-radius: 25px;/*老的firfox*/
			box-shadow: 10px 10px 5px #888888;
		}
		#round{
			-webkit-border-image: url('http://www.w3school.com.cn/i/border.png') 30 30 round;
			border-image: url('http://www.w3school.com.cn/i/border.png') 30 30 round;
		}
		#stretch{
			-webkit-border-image: url('http://www.w3school.com.cn/i/border.png') 30 30 stretch;
			border-image: url('http://www.w3school.com.cn/i/border.png') 30 30 stretch;
		}
		.backImage{
			border:1px solid black;
			padding: 35px;
			background-image: url(http://www.w3school.com.cn/i/bg_flower.gif);
			background-repeat: no-repeat;
			background-position: left;
		}
		#div1{
			background-origin: border-box;

		}
		#div2{
			background-origin: content-box;
		}
		@font-face{
			font-family: myFirstFont;
			src:url('./Sansation_Light.ttf');
		}
		@font-face{
			font-family: myFirstFont;
			src:url('./Sansation_Bold.ttf');
			font-weight: bold;
		}
		#myfont{
			font-family: myFirstFont;
		}
		
	</style>
</head>
<body>
	<div id="radius">border-radius属性允许您向元素添加圆角</div>
	</br>

	<div id="round">在这里，图片铺满整个边框</div>
	<div id="stretch">在这里，图片呗拉伸以填充该区域</div>
	<p>这是我们使用的图片:</p>
	<img src="http://www.w3school.com.cn/i/border.png">
	</br>
	<p>background-origin:border-box:</p>

	<div id="div1" class="backImage">
	这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。
	</div>
	<p>background-origin:content-box:</p>
	<div id="div2" class="backImage">
	这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。
	</div>

	</br>
	<div id="myfont">
	With CSS3, websites can <b>finally</b> use fonts other than the pre-selected "web-safe" fonts.
	</div>
	<div>
	With CSS3, websites can <b>finally</b> use fonts other than the pre-selected "web-safe" fonts.
	</div>
</body>
</html>

<|start_filename|>vuejs练习Demo列表/方法与事件处理器/index.js<|end_filename|>
new Vue({
	el:"#example",
	data:{
		name:"Vue.js"
	},
	methods:{
		greet:function (event) {
			alert("Hello" + this.name + "!");
			alert(event.target.tagName);
		},
		say:function (msg) {
			alert(msg);
		}
	}
})

<|start_filename|>书籍学习源码练习/javascript高级程序设计学习代码/chapter10.two.js<|end_filename|>
//===========================DOM操作技术==============================
//动态脚本
//<script type="text/javascript" src="client.js"></script>

function loadScript(url){
	var script = document.createElement("script");
	script.type = "text/javascript";
	script.src = url;
	document.body.appendChild(script);
}
loadScript("client.js");


var script = document.createElement("script");
script.type = "text/javascript";
script.text = "function sayHi(){console.log(\"hi\")}"
document.body.appendChild(script);


//动态样式
//<link rel="stylesheet" type="text/css" href="styles.css">
var link = document.createElement("link");
link.rel = "stylesheet";
link.type = "text/css";
link.href = "style.css";
var head = document.getElementsByTagName("head")[0];
head.appendChild(link);

// <style type="text/css">
// 	body{
// 		background-color:red;
// 	}
// </style>

var style = document.createElement("style");
style.type = "text/css";
try{//非IE
	style.appendChild(document.createTextNode("body{background-color:red}"));
}catch(ex){
	style.styleShett.cssText = "body{background-color:red}";
}
var head = document.getElementsByTagName("head")[0];
head.appendChild(style);


//使用NodeList
var divs = document.getElementsByTagName("div"),i,div;
for (var i = 0 len=divs.length; i < len; i++) {
	div = document.createElement("div");
	document.body.appendChild(div);
}






































<|start_filename|>WebPack经典入门学习/WebPack/src/index.js<|end_filename|>
import './styles.scss';

if (document.querySelectorAll('a').length) {
    require.ensure([], () => {
        const Button = require('./Components/Button');
        const button = new Button('google.com');

        button.render('a');
    }, 'button');
}

if (document.querySelectorAll('h1').length) {
    require.ensure([], () => {
        const Header = require('./Components/Header');

        new Header().render('h1');
    }, 'header');
}




<|start_filename|>书籍学习源码练习/javascript高级程序设计学习代码/chapter9.one.js<|end_filename|>
//确定浏览器是否支持Netscape风格的插件
var hasNSPlugins = !!(navigator.plugins && navigator.plugins.length);
//确定浏览器是否具有DOM1级规定的能力
var hasDOM1 = !!(document.getElementById && document.createElement && document.getElementsByTagName);


<|start_filename|>OC与JS交互Demo列表/自己写/html5测试/html5测试/html5/flashcards/db/flashcards.js<|end_filename|>
var flashcards;
(function () {
  flashcards = [
    ["Ice cream", "ice-cream.png"],
    ["Pizza", "pizza.png"],
    ["Soda", "soda.png"],
  ];
}());


<|start_filename|>OC与JS交互Demo列表/自己写/html5测试/html5测试/html5/gyroscope/app.js<|end_filename|>
var global = (function () { return this; }());
(function () {
  "use strict";

  function run() {
    var setText = function (id, text) {
          global.document.getElementById(id).innerHTML = String(text);
        };

    function handleFirstDeviceMotion(ev) {
      window.removeEventListener("devicemotion");
      if (null === ev.acceleration) {
        setText('bad-news', "null === event.acceleration<br/>Your device does not have (or does not expose) a gyroscope.");
      }
      window.addEventListener("devicemotion", handleDeviceMotion);
    }

    function handleDeviceMotion(ev) {
      setText('interval', ev.interval);

      setText('x', ev.acceleration.x);
      setText('y', ev.acceleration.y);
      setText('z', ev.acceleration.z);

      setText('r-alpha', ev.rotationRate.alpha);
      setText('r-beta', ev.rotationRate.beta);
      setText('r-gamma', ev.rotationRate.gamma);
    }

    function handleDeviceOrientation(ev) {
      setText('alpha', ev.alpha);
      setText('beta', ev.beta);
      setText('gamma', ev.gamma);
    }

    window.addEventListener("deviceorientation", handleDeviceOrientation);

    if (undefined === window.DeviceMotionEvent) {
      setText('bad-news', "undefined === window.DeviceMotionEvent<br/>Your device lacks (or does not expose) an accelerometer (or gyroscope).");
      return;
    }

    setText('no', '');
    window.addEventListener("devicemotion", handleFirstDeviceMotion);
  }

  window.addEventListener('load', run);

}());


<|start_filename|>OC与JS交互Demo列表/有趣的Demo/ObjectiveCToJavascript/Classes/ObjCJSAppDelegate.h<|end_filename|>
//
//  ObjCJSAppDelegate.h
//  ObjCJS
//
//  Created by <NAME> on 1/14/11.
//

#import <UIKit/UIKit.h>

@interface ObjCJSAppDelegate : NSObject <UIApplicationDelegate> {
    UIWindow *window;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;

@end



<|start_filename|>OC与JS交互Demo列表/自己写/html5测试/html5测试/html5/offline-app/main.js<|end_filename|>
(function () {
  "use strict";

  var appCache = require('app-cache')
    , getEl = function (a, b, c, d) {
        return document.getElementById(a, b, c, d);
      };

  function domListener(ev) {
    if ('update-check' === ev.target.getAttribute('name')) {
      appCache.checkNow();
    }

    if ('up-reload' === ev.target.getAttribute('name')) {
      appCache.reload();
    }

    if ('inst-dismiss' === ev.target.getAttribute('name')) {
      document.getElementById('installer').setAttribute('style', "display: none;");
    }

    if ('up-dismiss' === ev.target.getAttribute('name')) {
      document.getElementById('updater').setAttribute('style', "display: none;");
    }
  }

  function onDomReady() {
    console.log('domReady', new Date().toISOString());
    document.body.addEventListener('click', domListener, false);
  }
  window.addEventListener('load', onDomReady, false);

  //appCache.setUpdateInterval(1 * 60 * 60 * 1000);

  function showProgress(prefix, ev) {
    var loaded = 0;
    if (undefined !== ev.total) {
      document.getElementById(prefix + '-phase-total').innerHTML = 'of ' + String(ev.total);
      document.getElementById(prefix + '-progress').setAttribute('value', ev.loaded);
      document.getElementById(prefix + '-progress').setAttribute('max', ev.total);
      document.getElementById(prefix + '-phase').innerHTML = ev.loaded;
    } else {
      console.log(ev);
      loaded = Number(document.getElementById(prefix + '-phase').innerHTML)
      document.getElementById(prefix + '-phase').innerHTML = loaded + 1;
    }
  }
  
  //
  // INSTALL or UPDATE on initial page load
  //
  appCache.load.on('start', function () {
      console.log('start');
      var msg;
      document.getElementById('installer').setAttribute('style', "display: block;");
      if (!appCache.isInstalled()) {
        msg = "Welcome For the First Time";
      } else {
        msg = "Welcome Back. Updating";
      }
      document.getElementById('inst-start').innerHTML = msg;
  });
  appCache.load.on('loadstart', function () {
      // dom should (but may not be) ready by this point
      getEl('inst-loadstart').innerHTML = "started download";
  });
  appCache.load.on('progress', function (ev) {
      showProgress('inst', ev);
  });
  appCache.load.on('error', function () {
      getEl('inst-error').innerHTML = "Unexpected Error";
  });
  appCache.load.on('loadend', function () {
    if (appCache.isInstalled()) {
      setTimeout(function () {
        appCache.reload();
      }, 1000);
      getEl('inst-loadend').innerHTML = "Upgrade Complete, Restarting";
    } else {
      getEl('inst-loadend').innerHTML = "Install Complete";
    }
  });
  appCache.load.on('end', function () {
    document.getElementById('inst-progress').setAttribute('value', 1);
    document.getElementById('inst-progress').setAttribute('max', 1);
    getEl('inst-end').innerHTML = "The End. (ready to start application)";
  });

  //
  // UPDATE
  //
  //appCache.update.on('start', showWelcomeMessage);
  appCache.update.on('error', function () {
    getEl('up-error').innerHTML = "update failed. try again later";
  });
  appCache.update.on('start', function () {
    getEl('up-start').innerHTML = "Checking";
  });
  appCache.update.on('loadstart', function () {
    getEl('updater').setAttribute('style', '');
    getEl('up-loadstart').innerHTML = "load start";
  });
  appCache.update.on('progress', function (ev) {
    showProgress('up', ev);
  });
  appCache.update.on('loadend', function () {
    getEl('up-loadend').innerHTML = "load end";
  });
  appCache.update.on('start', function () {
    getEl('up-start').innerHTML = "Done Checking";
  });
  //appCache.update.on('end', showEnd);
}());


<|start_filename|>CSS3练习列表/CSS之图片白光划过效果/index.css<|end_filename|>
/*
* @Author: huangchengdu
* @Date:   2017-01-19 10:19:57
* @Last Modified by:   huangchengdu
* @Last Modified time: 2017-01-19 11:44:48
*/

.highlight-box{
	width: 300px;
	height: 100px;
	overflow: hidden;
	position: relative;
}
.highlight-box img{
	width: 100%;
	height: 100%;
}

.highlight-box:before{
	display: block;
	top: -200%;
	left: -100%;
	width: 50%;
	height: 300%;
	-webkit-transform:rotate(45deg);
	transform: rotate(45deg);
	background: -webkit-linear-gradient(left, rgba(255,255,255, 0.05) 20%,rgba(255,255,255,0.6) 65%, rgba(255,255,255,0.05) 100%);
	background: linear-gradient(left, rgba(255,255,255, 0.05) 20%,rgba(255,255,255,0.6) 65%, rgba(255,255,255,0.05) 100%);
	content: '';
	z-index: 2;
	position: absolute;
}

.highlight-box:hover:before{
	animation: crossed 0.5s linear;
}
@keyframes crossed{
	0% {
		top: -200%;
		left: -100%;
	}
	100% {
		top: -50px;
		left: 100%;
	}
}


<|start_filename|>vuejs练习Demo列表/github提交/index.css<|end_filename|>
#demo{
	font-family: 'Helvetica', Arial, sans-serif;
}

a{
	text-decoration: none;
	color: #f66;
}

li{
	line-height: 1.5em;
	margin-bottom: 20px;
}

.author, .date{
	font-weight: bold;
}

<|start_filename|>javascript练习Demo列表/Javascript的设计模式实现/基础知识/chapter.one.js<|end_filename|>
//=====================私有变量========================
var myObject = (function(){
	var __name = "sven";
	return {
		getName:function(){
			return __name;
		}
	};
})();
console.log(myObject.getName());


var obj1 = new Object();
var obj2 = {};
console.log(Object.getPrototypeOf(obj1) == Object.prototype);
console.log(Object.getPrototypeOf(obj2) == Object.prototype);


function Person(name){
	this.name = name;
}
Person.prototype.getName = function(){
	return this.name;
}
var a = new Person("sven");
console.log(a.name);
console.log(a.getName());
console.log(Object.getPrototypeOf(a) == Person.prototype);


var a = new Object();
console.log(a.__proto__ == Object.prototype);


//ES6
class Animal{
	constructor(name){
		this.name = name;
	}
	getName(){
		return this.name;
	}
}
class Dog extends Animal{
	constructor(name){
		super(name);
	}
	speak(){
		return "woof";
	}
}
var dog = new Dog("Scamp");
console.log(dog.getName() + " says " + dog.speak());














<|start_filename|>书籍学习源码练习/javascript高级程序设计学习代码/chapter4.one.js<|end_filename|>

// function addSomeNumber(num){
// 	return num + 100;
// }
// function addSomeNumber(num){
// 	return num + 200;
// }
// console.log(addSomeNumber(100));

// var s = "Nicholas";
// var b = true;
// var i = 22;
// var u;
// var n = null;
// var o = new Object();
// console.log(typeof s);
// console.log(typeof b);
// console.log(typeof i);
// console.log(typeof u);
// console.log(typeof n);
// console.log(typeof o);
// console.log(o instanceof Object);

// var color = "blue";
// function changeColor(){
// 	var anotherColor = "red";
// 	function swapColors(){
// 		var tempColor = anotherColor;
// 		anotherColor = color;
// 		color = tempColor;
// 	}
// 	swapColors();//在父执行环境下，所以可以方位他父环境的变量
// }
// changeColor();
// console.log(color);

// function buildUrl(){
// 	var qs = "?debug=true";
// 	with(location){
// 		var url = href + qs;
// 	}
// 	return url;
// }
// console.log(buildUrl());
// for (var i = 10; i < 10; i++){
// 	;
// }
// alert(i);

var color = "blue";
function getColor(){
	var color = "red";
	return color;
}
console.log(getColor());



<|start_filename|>书籍学习源码练习/Head First  html&css学习代码/chapter14/contest/form.html<|end_filename|>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>Enter the Contest</title>
</head>
<body>
<form action="http://wickedlysmart.com/hfhtmlcss/contest.php" method="POST">
	<P>Just type in your name(and click Submit) to enter the context:<br>
	First name:<input type="text" name="firstname" value=""><br>
	Last name:<input type="text" name="lastname" value=""><br>
	<input type="submit">
	</P>
</form>
</body>
</html>

<|start_filename|>OC与JS交互Demo列表/自己写/html5测试/html5测试/html5/app.js<|end_filename|>
/*jslint onevar: true, undef: true, newcap: true, nomen: true, regexp: true, plusplus: true, bitwise: true, devel: true, debug: true, es5: true, maxerr: 10 */
/*global module: true, clearTimeout: true, setTimeout: true, clearInterval: true, setInterval: true */
// see  http://www.jslint.com/lint.html for meaning of above strings
(function () {
  "use strict";

  var connect = require('connect'),
    fs = require('fs'),
    mime = require('connect/node_modules/mime'),
    path = require('path'),
    server;

  mime.define({'text/cache-manifest': ['manifest']});

  // TODO dynamically generate cache-manifest

  server = connect.createServer(
    connect.static(path.join(__dirname, './'))
  );

  module.exports = server;
}());


<|start_filename|>Promise理解和Demo/promise_XMLHttpRequest.js<|end_filename|>
/*
* @Author: huangchengdu
* @Date:   2017-01-16 16:21:53
* @Last Modified by:   huangchengdu
* @Last Modified time: 2017-01-16 17:38:20
*/

function getURL(url) {
	return new Promise(function (resolve,reject) {
		var req = new XMLHttpRequest();
		req.open('GET',url,true);
		req.onload = function() {
			if (req.status === 200) {
				resolve(req.responseText);
			}else{
				reject(new Error(req.statusText));
			}
		};
		req.onerror = function () {
			reject(new Error(req.statusText));
		};
		req.send();
	});
}

var url = "http://httpbin.org/get";
getURL(url).then(function onFulfilled(value) {
	console.log(value);
}).catch(function onRejected(error) {
	console.log(error);
});


<|start_filename|>vuejs练习Demo列表/渐进过渡/index.js<|end_filename|>
new Vue({
	el: '#demo',
	data: {
		query: '',
		list: [
			{ msg: '<NAME>' },
			{ msg: '<NAME>' },
			{ msg: '<NAME>' },
			{ msg: '<NAME>' },
			{ msg: '<NAME>' }
		]
	}
})

<|start_filename|>OC与JS交互Demo列表/自己写/html5测试/html5测试/html5/online-status/amionline-test.js<|end_filename|>
(function () {
  "use strict";

  require('require-kiss');

  var amionline = require('amionline').create()
    , origin = require('amionline-origin');

  amionline.start('internet', 4000);
  amionline.start('origin', 4000);

  // Accurate
  console.log('Initial state is: ' + amionline.status);

  window.addEventListener('load', function () {
    document.getElementById('online-status').innerHTML = amionline.status;
  }, 'false');

  amionline.on('online', function (err) {
    console.log('ONLINE');
    document.getElementById('online-status').innerHTML = 'online';
  });

  amionline.on('offline', function (err) {
    console.log('OFFLINE');
    document.getElementById('online-status').innerHTML = 'offline';
  });



  // Precise
  window.addEventListener('load', function () {
    document.getElementById('browser-status').innerHTML = amionline.browserStatus;
  }, 'false');

  amionline.on('browser', function (err, status) {
    // status === amionline.browserStatus;
    console.log('BROWSER: ' + status);
    document.getElementById('browser-status').innerHTML = status;
  });

  amionline.on('origin', function (err, status) {
    // status === amionline.originStatus;
    console.log('ORIGIN: ' + status);
    document.getElementById('origin-status').innerHTML = status;
  });

  amionline.on('internet', function (err, status) {
    // status === amionline.internetStatus;
    console.log('INTERNET: ' + status);
    document.getElementById('internet-status').innerHTML = status;
  });



  // checkNow - use callback and feed status to callback, regardless if the status has changed
  amionline.checkNow('internet', function (err, status) {
    console.log('checkNow', 'internet', err, status);
  });
  amionline.checkNow('origin', function (err, status) {
    console.log('checkNow', 'origin', err, status);
  });



  // checkNow - emit ASAP if there has been any change
  amionline.checkNow('internet');
  amionline.checkNow('origin');


  // Check an arbitrary port, resource, or even a CORS / XHR2 partner device or site
  function checkPartnerX(callback) {
    origin.create(callback, { url: "/doesntexist" });
  }
  amionline.use('partnerx', checkPartnerX, 2000); // run checkPartnerX every 10 seconds
  amionline.on('partnerx', function (err, status) {
    console.log('partnerx', err, status);
  });
  amionline.start('partnerx');


setTimeout(function () {
    amionline.stop('internet');
    amionline.stop('origin');
    console.log('stopped checks');
  }, 20000);
}());


<|start_filename|>OC与JS交互Demo列表/有趣的Demo/JavaScriptCore-Demo/JavaScriptCore-Demo/RootViewController.h<|end_filename|>
//
//  RootViewController.h
//  SocketIO-Demo
//
//  Created by Jakey on 14/12/25.
//  Copyright (c) 2014年 www.skyfox.org. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "JSCallOCViewController.h"
#import "OCCallJSViewController.h"
#import "HighchartsWebViewController.h"
@interface RootViewController : UIViewController
- (IBAction)JSCallOC:(id)sender;
- (IBAction)OCCallJS:(id)sender;
- (IBAction)HighchartsWeb:(id)sender;
@end


<|start_filename|>vuejs练习Demo列表/列表渲染/index.js<|end_filename|>
new Vue({
	el:"#repeat-object",
	data:{
		object:{
			FirstName:"jone",
			LastName:"Done",
			Age:30
		},
		items:[{
			title:"aaa"
		},{
			title:"bbb"
		},{
			title:"ccc"
		}]
	}
})

<|start_filename|>OC与JS交互Demo列表/自己写/html5测试/html5测试/html5/offline-app/style.css<|end_filename|>
body {
  margin: 0px;
  padding: 0px;
  background-color: #222;
}

h1 {
  color: white;
}

#installer {
  margin: 20px;
  top: 20px;
  bottom: 20px;
  right: 20px;
  left: 20px;
  background-color: orange;
}

#updater {
  margin: 20px;
  top: 20px;
  bottom: 20px;
  right: 20px;
  left: 20px;
  background-color: #FCE;
}


<|start_filename|>vuejs练习Demo列表/过渡/index.css<|end_filename|>
.bounce-transition {
	display: inline-block; /* 否则 scale 动画不起作用 */
}
.bounce-enter {
	animation: bounce-in .5s;
}
.bounce-leave {
	animation: bounce-out .5s;
}
@keyframes bounce-in {
	0% {
		transform: scale(0);
	}
	50% {
		transform: scale(1.5);
	}
	100% {
		transform: scale(1);
	}
}
@keyframes bounce-out {
	0% {
		transform: scale(1);
	}
	50% {
		transform: scale(1.5);
	}
	100% {
		transform: scale(0);
	}
}

<|start_filename|>OC与JS交互Demo列表/自己写/html5测试/html5测试/html5/flashcards/javascripts/flashcards.js<|end_filename|>
// TODO browser js registry
// TODO online editing of js and html


function matchingCards(origcards) {
  var cards = origcards.slice(0);
  var current;

  cards.sort(function() {return 0.5 - Math.random()});

  function get() {
    current = cards.pop();
    return current && current[1];
  } 

  function peek() {
    return current[0];
  }

  function test(answer) {
    if (answer == current[0]) {
      return true;
    }
    return false;
  }
  return {
    get: get,
    test: test,
    peek: peek
  };
}

var game = matchingCards(flashcards);

$(function () {
  var q = game.get();
  $("img").attr('src', 'db/' + q);
  $("body").delegate('form#flash', 'submit', function (ev) {
    ev.preventDefault();
    if (game.test($("#answer").val())) {
      q = game.get();
      if (undefined === q) {
        alert("And now for the next round...");
        game = matchingCards(flashcards);
        q = game.get();
      }
      $("img").attr('src', 'db/' + q);
      //$("img").hide();
      //$("img[src='" + 'db/' + q  + "']").show();
    } else {
      alert("Wrongo " + $("#answer").val() + ' ' + game.peek());
    }
    $("#answer").val('');
  });
});
