http://itindex.net/detail/22-%E8%82%A1%E7%A5%A8-api
http://www.cnblogs.com/jiekoupt/p/5063324.html
https://www.juhe.cn/docs/api/id/21
http://kie0723.blogspot.tw/2010/11/google-stock-api.html
https://www.lightblue.asia/realtime-tw-stockprice-in-google-spreadsheet/
https://sites.google.com/site/kentyeh2000/zheng-jiao-suo-ji-shi-zi-xun-jie-xi
http://mis.twse.com.tw/stock/group.jsp?ex=tse&ind=TIDX
https://jerrynest.io/python-yahoo-finance-api-historical-stock-price/
2017年7月20日 星期四
2017年7月17日 星期一
一些 promise 可能會出現的問題
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script>
function reject_1() {
var p = job_1();
}
/*------------------------------------*/
function reject_2() {
debugger;
var p = job_1();
p.then(function() {
alert('ok');
}, function() {
alert('error');
});
}
/*------------------------------------*/
function reject_3() {
debugger;
var p = job_2();
p.then(function() {
alert('ok');
}, function() {
alert('error');
});
}
/*------------------------------------*/
function job_1() {
debugger;
var _res, _rej;
var p = new Promise(function(res, rej) {
_res = res;
_rej = rej;
});
setTimeout(function() {
_rej();
});
return p;
}
/*------------------------------------*/
function job_2() {
debugger;
var _res, _rej;
var p = new Promise(function(res, rej) {
_res = res;
_rej = rej;
});
_rej();
return p;
}
</script>
</head>
<body>
<pre>
function job_1() {
var _res, _rej;
var p = new Promise(function(res, rej) {
_res = res;
_rej = rej;
});
setTimeout(function() {
_rej();
});
return p;
}
function reject_1() {
var p = job_1();
}
</pre>
<button onclick="reject_1();">reject_1</button>
<hr />
<pre>
function job_1() {
var _res, _rej;
var p = new Promise(function(res, rej) {
_res = res;
_rej = rej;
});
setTimeout(function() {
_rej();
});
return p;
}
function reject_2() {
var p = job_1();
p.then(function() {
alert('ok');
}, function() {
alert('error');
});
}
</pre>
<button onclick="reject_2();">reject_2</button>
<hr />
<pre>
function job_2() {
var _res, _rej;
var p = new Promise(function(res, rej) {
_res = res;
_rej = rej;
});
_rej();
return p;
}
function reject_3() {
var p = job_2();
p.then(function() {
alert('ok');
}, function() {
alert('error');
});
}
</pre>
<button onclick="reject_3();">reject_3</button>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script>
function reject_1() {
var p = job_1();
}
/*------------------------------------*/
function reject_2() {
debugger;
var p = job_1();
p.then(function() {
alert('ok');
}, function() {
alert('error');
});
}
/*------------------------------------*/
function reject_3() {
debugger;
var p = job_2();
p.then(function() {
alert('ok');
}, function() {
alert('error');
});
}
/*------------------------------------*/
function job_1() {
debugger;
var _res, _rej;
var p = new Promise(function(res, rej) {
_res = res;
_rej = rej;
});
setTimeout(function() {
_rej();
});
return p;
}
/*------------------------------------*/
function job_2() {
debugger;
var _res, _rej;
var p = new Promise(function(res, rej) {
_res = res;
_rej = rej;
});
_rej();
return p;
}
</script>
</head>
<body>
<pre>
function job_1() {
var _res, _rej;
var p = new Promise(function(res, rej) {
_res = res;
_rej = rej;
});
setTimeout(function() {
_rej();
});
return p;
}
function reject_1() {
var p = job_1();
}
</pre>
<button onclick="reject_1();">reject_1</button>
<hr />
<pre>
function job_1() {
var _res, _rej;
var p = new Promise(function(res, rej) {
_res = res;
_rej = rej;
});
setTimeout(function() {
_rej();
});
return p;
}
function reject_2() {
var p = job_1();
p.then(function() {
alert('ok');
}, function() {
alert('error');
});
}
</pre>
<button onclick="reject_2();">reject_2</button>
<hr />
<pre>
function job_2() {
var _res, _rej;
var p = new Promise(function(res, rej) {
_res = res;
_rej = rej;
});
_rej();
return p;
}
function reject_3() {
var p = job_2();
p.then(function() {
alert('ok');
}, function() {
alert('error');
});
}
</pre>
<button onclick="reject_3();">reject_3</button>
</body>
</html>
2017年7月7日 星期五
underscore.php
http://brianhaveri.github.io/Underscore.php/
$result = __($data_1)->find(function($data) {
return $data['value'] == 2;
});
$result = __($data_1)->find(function($data) {
return $data['value'] == 2;
});
2017年7月6日 星期四
vue.....用 render 切換模板
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script src="../../js_script/vue-2.3.0.js"></script>
<script src="./template/temp_1.js"></script>
</head>
<body>
<div id="app">
<div>
{{condition}}
</div>
<div>
0<input type="radio" v-model="condition" value="0" /> 1
<input type="radio" v-model="condition" value="1" />
</div>
<hr />
<breed-table :breeds="breeds">
<div>
5555
</div>
</breed-table>
</div>
<script>
new Vue({
el: '#app',
data: {
condition: "0",
breeds: [{
name: 'Persian',
colour: 'orange',
affection: 3,
shedding: 5
}, {
name: 'Siberian',
colour: 'blue',
affection: 5,
shedding: 4
}, {
name: 'Bombay',
colour: 'black',
affection: 4,
shedding: 2
}]
},
components: {
breedTable: breedTable
}
});
</script>
</body>
</html>
////////////////////////////////////////////////////////////////////////////////////////////////
var breedTable = {
functional: true,
render: function(ch, context) {
debugger;
console.dir(arguments);
var result;
if(Number(context.parent.condition)){
result = ch(template_2, context.data, context.children);
}else{
result = ch(template_1, context.data, context.children);
}
return result;
}
}
/* ============================================================= */
var template_1 = {
props: ['breeds'],
template:'<div>template_1</div>'
};
var template_2 = {
props: ['breeds'],
template:'<div>template_2</div>'
};
<html>
<head>
<meta charset="utf-8">
<title></title>
<script src="../../js_script/vue-2.3.0.js"></script>
<script src="./template/temp_1.js"></script>
</head>
<body>
<div id="app">
<div>
{{condition}}
</div>
<div>
0<input type="radio" v-model="condition" value="0" /> 1
<input type="radio" v-model="condition" value="1" />
</div>
<hr />
<breed-table :breeds="breeds">
<div>
5555
</div>
</breed-table>
</div>
<script>
new Vue({
el: '#app',
data: {
condition: "0",
breeds: [{
name: 'Persian',
colour: 'orange',
affection: 3,
shedding: 5
}, {
name: 'Siberian',
colour: 'blue',
affection: 5,
shedding: 4
}, {
name: 'Bombay',
colour: 'black',
affection: 4,
shedding: 2
}]
},
components: {
breedTable: breedTable
}
});
</script>
</body>
</html>
////////////////////////////////////////////////////////////////////////////////////////////////
/temp_1.js>>
var breedTable = {
functional: true,
render: function(ch, context) {
debugger;
console.dir(arguments);
var result;
if(Number(context.parent.condition)){
result = ch(template_2, context.data, context.children);
}else{
result = ch(template_1, context.data, context.children);
}
return result;
}
}
/* ============================================================= */
var template_1 = {
props: ['breeds'],
template:'<div>template_1</div>'
};
var template_2 = {
props: ['breeds'],
template:'<div>template_2</div>'
};
2017年7月5日 星期三
(呆灣出屁王)組件父子間的資料同步
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>test v-mode transfore</title>
<script src="../../js_script/vue-2.3.0.js"></script>
<script>
window.onload = function() {
Vue.component('child', {
template: '#child',
props: ['y'],
data: function() {
return {
x: this.y
}
},
watch: {
x: function() {
debugger;
this.$emit('update:y', this.x);
}
}
});
new Vue({
el: '#app',
data: {
y: 'hi'
},
methods: {
updateY: function(value) {
this.y = value;
}
}
});
}
</script>
</head>
<body>
<template id="child">
<div>
<p>
x = {{x}}
</p>
<p>
<input type="text" v-model="x" />
</p>
</div>
</template>
<!-- -->
<div id="app">
<div>
y = {{y}}
</div>
<child :y="y" @update:y="updateY"></child>
</div>
</body>
</html>
/////////////////////////////////////////////////////////////////////////////////////////////////
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>test v-mode transfore</title>
<script src="../../js_script/vue-2.3.0.js"></script>
<script>
window.onload = function() {
Vue.component('child', {
template: '#child',
props: ['y'],
data: function() {
return {
x: this.y
}
},
watch: {
x: function() {
debugger;
this.$parent.$emit('update:y', this.x);
}
}
});
/* ============================================================== */
new Vue({
el: '#app',
data: {
y: 'hi'
},
created: function() {
debugger;
this.$on('update:y', this.updateY);
},
methods: {
updateY: function(value) {
debugger;
this.y = value;
}
}
});
}
</script>
</head>
<body>
<template id="child">
<div>
<p>
x = {{x}}
</p>
<p>
<input type="text" v-model="x" />
</p>
</div>
</template>
<!-- -->
<div id="app">
<div>
y = {{y}}
</div>
<child :y="y"></child>
</div>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>test v-mode transfore</title>
<script src="../../js_script/vue-2.3.0.js"></script>
<script>
window.onload = function() {
Vue.component('child', {
template: '#child',
props: ['y'],
data: function() {
return {
x: this.y
}
},
watch: {
x: function() {
debugger;
this.$emit('update:y', this.x);
}
}
});
new Vue({
el: '#app',
data: {
y: 'hi'
},
methods: {
updateY: function(value) {
this.y = value;
}
}
});
}
</script>
</head>
<body>
<template id="child">
<div>
<p>
x = {{x}}
</p>
<p>
<input type="text" v-model="x" />
</p>
</div>
</template>
<!-- -->
<div id="app">
<div>
y = {{y}}
</div>
<child :y="y" @update:y="updateY"></child>
</div>
</body>
</html>
/////////////////////////////////////////////////////////////////////////////////////////////////
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>test v-mode transfore</title>
<script src="../../js_script/vue-2.3.0.js"></script>
<script>
window.onload = function() {
Vue.component('child', {
template: '#child',
props: ['y'],
data: function() {
return {
x: this.y
}
},
watch: {
x: function() {
debugger;
this.$parent.$emit('update:y', this.x);
}
}
});
/* ============================================================== */
new Vue({
el: '#app',
data: {
y: 'hi'
},
created: function() {
debugger;
this.$on('update:y', this.updateY);
},
methods: {
updateY: function(value) {
debugger;
this.y = value;
}
}
});
}
</script>
</head>
<body>
<template id="child">
<div>
<p>
x = {{x}}
</p>
<p>
<input type="text" v-model="x" />
</p>
</div>
</template>
<!-- -->
<div id="app">
<div>
y = {{y}}
</div>
<child :y="y"></child>
</div>
</body>
</html>
訂閱:
文章 (Atom)