文章加密
;
2019年10月31日 星期四
css flex , and test CSS, HTML, JS
https://yakimhsu.com/project/project_w6_CSS_flex.html CSS - 跟著 🐸🐸 學 Flex 排版
https://www.oxxostudio.tw/articles/201501/css-flexbox.html
https://css-tricks.com/snippets/css/a-guide-to-flexbox/
http://davidshariff.com/quiz/
If you have a <p> element with font-size: 10rem, will the text be responsive when the user resizes / drags the browser window? F (這英文是說user縮放視窗會跟著響應式變動,不是說放大縮小ctrl+, ctrl-)
css 中
:root 和 html 一樣,指示:root優先級更高
---
The pseudo class :checked will select inputs with type radio or checkbox, but not <option> elements. F (這英文是說會塞選出radio和checkbox, blabla~就不對)
---
Given the HTML below:
<ul class="shopping-list" id="awesome">
<li><span>Milk</span></li>
<li class="favorite" id="must-buy"><span class="highlight">Sausage</span></li>
</ul>
What is the color of the text Sausage ?
#awesome .favorite:not(#awesome) .highlight {
color: red;
}
#awesome .highlight:nth-of-type(1):nth-last-of-type(1) {
color: blue;
}
ANS:red //因為在.favorate的偽類裡有用id,瞬間把它優先級提升
---
HTML:
<div id="test1">
<span id="test2"></span>
</div>
CSS:
#i-am-useless {
background-image: url('mypic.jpg');
}
Are unused style resources still downloaded by the browser? no // 圖片不會被下載
---
HTML:
<div id="test1">
<span id="test2"></span>
</div>
CSS:
#test1 {
display: none;
}
#test2 {
background-image: url('mypic.jpg');
visibility: hidden;
}
On page load, will mypic.jpg get downloaded by the browser? No // 跟上題相似的觀念
---
@media only screen and (max-width: 1024px) {
margin: 0;
}
What is the use of the only selector?
ANS: Stops older browsers from parsing the remainder of the selector.
https://muki.tw/tech/css-media-queries-introduce-basic/
---
HTML:
<div>
<p>I am floated</p>
<p>So am I</p>
</div>
CSS:
div {
overflow: hidden;
}
p {
float: left;
}
Does overflow: hidden create a new block formatting context? YES (這句的意思是overflow:hidden還會有block存在嗎?不是多再生一個block)
HTML
Is <keygen> a valid HTML5 tag? YES //此支援度還不足以成為標準
---
If a web page contains organic, multiple <h1> tags, will it affect the SEO negativley? No
It depends which HTML version you are using. If it's HTML4 or XHTML, only use one h1 per page, but if you are using HTML5 you can have one per section. So you could have one in your <nav>, on in your <article>, one in each of the <aside>s on your page and one in your <footer>.
The reason for this is that for HTML4 search engines look at headings to give the page hierachy - remember they only had <div>s to separate content areas - but HTML5 uses the new semantic elements like <header> and <fotter> to work out hierarchy, with headings only affecting hierachy within one of those tags.
---
If you have a page of search results and want to highlight the search term, what HTML tag would you use? <mark>
<mark> usage notes
<q>111</q> //"111", as inline type
<blockquote>333</blockquote> // "333", as block type
https://www.lifewire.com/whats-new-in-html5-3467974
---
<div style="display: none;">
<img src="mypic.jpg" alt="My photo">
</div>
Does the HTML above trigger a http request when the page first loads?YES //這個不同於寫在css裡的background-image會受display:none影響,是因為這個resource是寫在HTML,程式HTML和CSS是分開的體系
---
<head>
<link href="main1.css" rel="stylesheet">
<link href="main2.css" rel="stylesheet">
</head>
Does main1.css have to be downloaded and parsed before main2.css can be fetched?No
Render order is:
It’s easy to take utmost care to tree-shake(???), route-split, and lazy-load our JavaScript, but sometimes CSS can be forgotten.
var foo = {
x: 2,
baz: {
x: 1,
bar: function() {
return this.x;
}
}
}
var go = foo.baz.bar;
alert(go());
alert(foo.baz.bar());
What is the order of values alerted?3,1
---
var x = 4,
obj = {
x: 3,
bar: function() {
var x = 2;
setTimeout(function() { // 由
//https://www.cnblogs.com/zsqos/p/6188835.html
//https://developer.mozilla.org/zh-CN/docs/Web/API/Window/setTimeout
var x = 1;
alert(this.x);
}, 1000);
}
};
obj.bar();
What value is alerted?4
---
x = 1;
function bar() {
this.x = 2;
return x;
}
var foo = new bar();
alert(foo.x);
What value is alerted?2
其中(2)的()沒有意義,
(3)The call works as if it were split into two lines:
(4)???
---
function foo(a) {
alert(arguments.length);
}
foo(1, 2, 3);
---
function foo(a) {
arguments[0] = 2;
alert(a);
}
foo(1);
What value is alerted?2
---
function foo(){}
delete foo.length;
alert(typeof foo.length);
What value is alerted?number
https://www.oxxostudio.tw/articles/201501/css-flexbox.html
https://css-tricks.com/snippets/css/a-guide-to-flexbox/
http://davidshariff.com/quiz/
If you have a <p> element with font-size: 10rem, will the text be responsive when the user resizes / drags the browser window? F (這英文是說user縮放視窗會跟著響應式變動,不是說放大縮小ctrl+, ctrl-)
css 中
:root 和 html 一樣,指示:root優先級更高
---
The pseudo class :checked will select inputs with type radio or checkbox, but not <option> elements. F (這英文是說會塞選出radio和checkbox, blabla~就不對)
---
Given the HTML below:
<ul class="shopping-list" id="awesome">
<li><span>Milk</span></li>
<li class="favorite" id="must-buy"><span class="highlight">Sausage</span></li>
</ul>
What is the color of the text Sausage ?
#awesome .favorite:not(#awesome) .highlight {
color: red;
}
#awesome .highlight:nth-of-type(1):nth-last-of-type(1) {
color: blue;
}
ANS:red //因為在.favorate的偽類裡有用id,瞬間把它優先級提升
---
HTML:
<div id="test1">
<span id="test2"></span>
</div>
CSS:
#i-am-useless {
background-image: url('mypic.jpg');
}
Are unused style resources still downloaded by the browser? no // 圖片不會被下載
---
HTML:
<div id="test1">
<span id="test2"></span>
</div>
CSS:
#test1 {
display: none;
}
#test2 {
background-image: url('mypic.jpg');
visibility: hidden;
}
On page load, will mypic.jpg get downloaded by the browser? No // 跟上題相似的觀念
---
@media only screen and (max-width: 1024px) {
margin: 0;
}
What is the use of the only selector?
ANS: Stops older browsers from parsing the remainder of the selector.
https://muki.tw/tech/css-media-queries-introduce-basic/
---
HTML:
<div>
<p>I am floated</p>
<p>So am I</p>
</div>
CSS:
div {
overflow: hidden;
}
p {
float: left;
}
Does overflow: hidden create a new block formatting context? YES (這句的意思是overflow:hidden還會有block存在嗎?不是多再生一個block)
HTML
Is <keygen> a valid HTML5 tag? YES //此支援度還不足以成為標準
---
If a web page contains organic, multiple <h1> tags, will it affect the SEO negativley? No
It depends which HTML version you are using. If it's HTML4 or XHTML, only use one h1 per page, but if you are using HTML5 you can have one per section. So you could have one in your <nav>, on in your <article>, one in each of the <aside>s on your page and one in your <footer>.
The reason for this is that for HTML4 search engines look at headings to give the page hierachy - remember they only had <div>s to separate content areas - but HTML5 uses the new semantic elements like <header> and <fotter> to work out hierarchy, with headings only affecting hierachy within one of those tags.
---
If you have a page of search results and want to highlight the search term, what HTML tag would you use? <mark>
<mark> usage notes
Typical use cases for
<mark>
include:- When used in a quotation (
<q>
) or block quote (<blockquote>
), it generally indicates text which is of special interest but is not marked in the original source material, or material which needs special scrutiny even though the original author didn't think it was of particular importance. Think of this like using a highlighter pen in a book to mark passages that you find of interest. - Otherwise,
<mark>
indicates a portion of the document's content which is likely to be relevant to the user's current activity. This might be used, for example, to indicate the words that matched a search operation. - Don't use
<mark>
for syntax highlighting purposes; instead, use the<span>
element with appropriate CSS applied to it.
Don't confuse
<mark>
with the <strong>
element; <mark>
is used to denote content which has a degree of relevance, while <strong>
indicates spans of text of importance.<q>111</q> //"111", as inline type
<blockquote>333</blockquote> // "333", as block type
https://www.lifewire.com/whats-new-in-html5-3467974
---
<div style="display: none;">
<img src="mypic.jpg" alt="My photo">
</div>
Does the HTML above trigger a http request when the page first loads?YES //這個不同於寫在css裡的background-image會受display:none影響,是因為這個resource是寫在HTML,程式HTML和CSS是分開的體系
---
<head>
<link href="main1.css" rel="stylesheet">
<link href="main2.css" rel="stylesheet">
</head>
Does main1.css have to be downloaded and parsed before main2.css can be fetched?No
Render order is:
- Build the DOM (Document Object Model) from the received HTML
- If we encounter a CSS style sheet (embedded or linked), start building the CSSOM (CSS Object Model — we’ll get into what this is in a bit).
- If we encounter a JS block (not designated as async) while building the DOM, wait for CSSOM construction, stop DOM construction and parse/execute the code. The reason for this is because JS execution can modify the DOM and access/modify the CSSOM.
It’s easy to take utmost care to tree-shake(???), route-split, and lazy-load our JavaScript, but sometimes CSS can be forgotten.
First, the browser removes all non-visible elements. This includes elements such as
<head>
, <script>
, and <meta>
, as well as HTML elements that have the hidden
attribute. These elements, although used by other parts of the app, won’t be rendered to the page, so the browser can safely proceed with rendering knowing that all elements in the render tree are in fact visible HTML elements.
Next, we go through the CSSOM and find out which elements in our current render tree match the CSS selectors. The CSS rules for any selector that does match will be applied to that node of the render tree.
There’s one CSS rule that’s an exception, though. Applying
display: none;
in a CSS rule will remove an element from the render tree entirely. This goes back to only including visible elements in the render tree. Other methods of hiding an element, such as opacity: 0;
will not remove an element from the render tree but rather render it without showing it.
---
var x = 3;var foo = {
x: 2,
baz: {
x: 1,
bar: function() {
return this.x;
}
}
}
var go = foo.baz.bar;
alert(go());
alert(foo.baz.bar());
What is the order of values alerted?3,1
---
var x = 4,
obj = {
x: 3,
bar: function() {
var x = 2;
setTimeout(function() { // 由
setTimeout()
调用的代码运行在与所在函数完全分离的执行环境上。这会导致,这些代码中包含的 this
关键字在非严格模式会指向 window
(或全局)对象,严格模式下为 undefined,这和所期望的this
的值是不一样的。 //https://www.cnblogs.com/zsqos/p/6188835.html
//https://developer.mozilla.org/zh-CN/docs/Web/API/Window/setTimeout
var x = 1;
alert(this.x);
}, 1000);
}
};
obj.bar();
What value is alerted?4
---
x = 1;
function bar() {
this.x = 2;
return x;
}
var foo = new bar();
alert(foo.x);
What value is alerted?2
let
obj,
method;
obj =
{
go
:
function
(
)
{
alert
(
this
)
;
}
}
;
obj.
go
(
)
;
// (1) [object Object]
(
obj.
go)
(
)
;
// (2) [object Object]
(
method =
obj.
go)
(
)
;
// (3) [object Window]
(
obj.
go ||
obj.
stop)
(
)
;
// (4) [object Window]
其中(2)的()沒有意義,
(3)The call works as if it were split into two lines:
f =
obj.
go;
// calculate the expression
f
(
)
;
// call what we have
---
function foo(a) {
alert(arguments.length);
}
foo(1, 2, 3);
---
function foo(a) {
arguments[0] = 2;
alert(a);
}
foo(1);
What value is alerted?2
---
function foo(){}
delete foo.length;
alert(typeof foo.length);
What value is alerted?number
child url can not operate parent url's cookie
as the title,
if our front-end belong to "https://portal.devel.starlordtech.com/",
then front-end can't remove cookies in upper level url like "client.devel.starlordtech.com",
"auth.devel.starlordtech.com",
"devel.starlordtech.com"
if our front-end belong to "https://portal.devel.starlordtech.com/",
then front-end can't remove cookies in upper level url like "client.devel.starlordtech.com",
"auth.devel.starlordtech.com",
"devel.starlordtech.com"
2019年10月23日 星期三
require.context, watch 的immediate配合handler-- Vue 开发必须知道的 36 个技巧
https://juejin.im/post/5d9d386fe51d45784d3f8637 Vue 开发必须知道的 36 个技巧
https://www.itread01.com/content/1548038172.html webpack 之 require.context 用法
If you want to use your image as a module, do not forget to bind data to your vuejs component
require.context
the example below is easy to understand, and it seems like if the modules you want to import are not very much, then writing in "require.context" way is more complicated.
watch 一般watch最初綁定的時候是不會執行的
的immediate配合handler,將可以取得oldValue與newValue,而且immediate會讓最初綁定時也觸法watch
的deep配合handler,將可以取得oldValue與newValue(不確定),並且會同時監聽他的子層,當子曾有改變時也會觸發他(當然爾,它的消耗大)
https://cythilya.github.io/2017/04/15/vue-watch/ Summer。桑莫。夏天https://blog.csdn.net/Amanda_wmy/article/details/83749560
vue.js监听属性watch(handler方法immediate属性deep属性)
https://www.itread01.com/content/1548038172.html webpack 之 require.context 用法
If you want to use your image as a module, do not forget to bind data to your vuejs component
<template>
<div id="app">
<img :src="image" />
</div>
</template>
<script>
import image from "./assets/logo.png"
export default {
data: function () {
return {
image: image
}
}
}
</script>
<style lang="scss">
</style>
And a shorter version :
<template>
<div id="app">
<img :src="require('./assets/logo.png')" />
</div>
</template>
<script>
export default {
}
</script>
<style lang="scss">
</style>
require.context
the example below is easy to understand, and it seems like if the modules you want to import are not very much, then writing in "require.context" way is more complicated.
import BaseButton from './BaseButton.vue'
import BaseIcon from './BaseIcon.vue'
import BaseInput from './BaseInput.vue'
export default {
components: {
BaseButton,
BaseIcon,
BaseInput
}
}
Just to support relatively little markup in a template:
<BaseInput
v-model="searchText"
@keydown.enter="search"
/>
<BaseButton @click="search">
<BaseIcon name="search"/>
</BaseButton>
Fortunately, if you’re using Webpack (or Vue CLI 3+, which uses Webpack internally), you can use
require.context
to globally register only these very common base components. Here’s an example of the code you might use to globally import base components in your app’s entry file (e.g. src/main.js
):import Vue from 'vue'
import upperFirst from 'lodash/upperFirst'
import camelCase from 'lodash/camelCase'
const requireComponent = require.context(
// The relative path of the components folder
'./components',
// Whether or not to look in subfolders
false,
// The regular expression used to match base component filenames
/Base[A-Z]\w+\.(vue|js)$/
)
requireComponent.keys().forEach(fileName => {
// Get component config
const componentConfig = requireComponent(fileName)
// Get PascalCase name of component
const componentName = upperFirst(
camelCase(
// Gets the file name regardless of folder depth
fileName
.split('/')
.pop()
.replace(/\.\w+$/, '')
)
)
// Register component globally
Vue.component(
componentName,
// Look for the component options on `.default`, which will
// exist if the component was exported with `export default`,
// otherwise fall back to module's root.
componentConfig.default || componentConfig
)
})
watch 一般watch最初綁定的時候是不會執行的
的immediate配合handler,將可以取得oldValue與newValue,而且immediate會讓最初綁定時也觸法watch
的deep配合handler,將可以取得oldValue與newValue(不確定),並且會同時監聽他的子層,當子曾有改變時也會觸發他(當然爾,它的消耗大)
https://cythilya.github.io/2017/04/15/vue-watch/ Summer。桑莫。夏天https://blog.csdn.net/Amanda_wmy/article/details/83749560
vue.js监听属性watch(handler方法immediate属性deep属性)
2019年10月21日 星期一
File API (from javascript)
https://www.html5rocks.com/zh/tutorials/file/dndfiles/
https://blog.johnsonlu.org/upload-file-with-file-api/
https://dwatow.github.io/2019/05-22-file-api/ . download
https://blog.johnsonlu.org/upload-file-with-file-api/
https://dwatow.github.io/2019/05-22-file-api/ . download
File API
中包含了幾個比較重要的 interface:- File:可以用來讀取硬碟上檔案相關檔案資訊的物件
- FileList:File 物件的集合
- Blob:表示檔案內容的物件
- FileReader:讀取檔案用的物件
downloadFileBase64(fileID: string, imageName: string) {
FileApi.getFile(fileID).then(fileData => {
const element = document.createElement('a');
element.setAttribute('href', `data:image/png;base64,${encodeURIComponent(fileData.file)}`);
element.setAttribute('download', imageName);
element.style.display = 'none';
document.body.appendChild(element);
element.click();
document.body.removeChild(element);
});
},
2019年10月17日 星期四
docker, drone,webhook, pipeline, k8s
docker
其官網ID:a...e8086, 密碼a..e1..6
https://hub.docker.com/
sign in and download install
結果裝不起來
https://skychang.github.io/2017/01/06/Docker-Docker_for_Windows_10_First/
另一種方式安裝https://blog.yowko.com/homebrew-docker/
http://www.voidcn.com/article/p-sfwzrmph-ew.html docker 打包 node 项目
https://joshhu.gitbooks.io/dockercommands/content/Containers/DockerRun.html 快速建立你的第一個Docker服務
https://yeasy.gitbooks.io/docker_practice/
https://www.youtube.com/watch?v=k5iwKUZY9tk 前端工程師一定要知道的 Docker 虛擬化容器技巧 (18:34)
https://www.arthurtoday.com/2009/12/host-guest.html .Host OS 和 Guest OS 是什麼 ?
有像git,但是用在打包OS(operation system, 作業系統)
*12招給前端的密技
https://medium.com/asiayo-engineering/%E7%94%A8-drone-%E6%89%93%E9%80%A0-ci-cd-flow-36b9d14c7620 用 Drone 打造 CI/CD flow
ref:https://medium.com/@stu60610/%E4%BD%BF%E7%94%A8-docker-drone-%E5%BB%BA%E7%AB%8B%E7%B0%A1%E6%98%93%E8%87%AA%E5%8B%95%E9%83%A8%E7%BD%B2%E6%B5%81%E7%A8%8B-part1-a180eb48ff37
webhook
https://ithelp.ithome.com.tw/articles/10193212 第四天:認識 Webhook
Webhook 是讓一個網站能訂閱另一個網站的方法
*上面那篇介紹了實際上是介紹了rails做後端與資料庫,有用到
uri = URI('http://www.cwb.gov.tw/V7/js/HDRadar_1000_n_val.js')
response = Net::HTTP.get(uri)
start_index = response.index('","') + 3
end_index = response.index('"),') - 1
"http://www.cwb.gov.tw" + response[start_index..end_index]
end
把氣象圖丟上imgur(那為什麼不是我們自己保存圖片就好呢?因為存圖片要占空間跟頻寬,所以我選擇用 imgur 的空間放圖。imgur 有一個蠻好的地方是,你可以直接把圖片網址給他,他就會幫你備份圖片了,所以我們不用真的把圖檔抓回來再上傳到 imgur。而且作者當時的氣象圖網址是http開頭,而line要求https,imgur提供的是https,現在的話氣象局已經改成https)
def upload_to_imgur(image_url)
url = URI("https://api.imgur.com/3/image")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["authorization"] = 'Client-ID be2d83405627ab8'
request.set_form_data({"image" => image_url})
response = http.request(request)
json = JSON.parse(response.read_body)
begin
json['data']['link'].gsub("http:","https:")
rescue
nil
end
end
pipeline
https://docs.drone.io/configure/pipeline/
k8s
not clear
其官網ID:a...e8086, 密碼a..e1..6
https://hub.docker.com/
sign in and download install
結果裝不起來
https://skychang.github.io/2017/01/06/Docker-Docker_for_Windows_10_First/
另一種方式安裝https://blog.yowko.com/homebrew-docker/
http://www.voidcn.com/article/p-sfwzrmph-ew.html docker 打包 node 项目
https://joshhu.gitbooks.io/dockercommands/content/Containers/DockerRun.html 快速建立你的第一個Docker服務
https://yeasy.gitbooks.io/docker_practice/
https://www.youtube.com/watch?v=k5iwKUZY9tk 前端工程師一定要知道的 Docker 虛擬化容器技巧 (18:34)
https://www.arthurtoday.com/2009/12/host-guest.html .Host OS 和 Guest OS 是什麼 ?
有像git,但是用在打包OS(operation system, 作業系統)
*12招給前端的密技
- pull
- images (映像檔)
- run
- ps (看行程)
- stop
- start
- exec (進入容器,與run的差別在run會自動開啟來)
- commit (提交image)
- tag (修改標籤名稱)
- rmi (移除image和tag,remove image的縮寫)
- rm (移除容器)
- push
Drone
如果你曾經開發過需要經常更新版本的應用程式(如 API Service),每次把寫完的 code push 到 Git 後,通常還需要做以下這些事情:
- 將修改後的 Release 版本打包完成
- 連線到 Host VM 並停止原有服務
- 覆蓋原有的程式版本
- 重新啟動服務
其實一直以來我都是認命的這樣部署我的 Service 的,直到有一天因為專案有臨時的緊急需求,一整天重複做了快十次這樣的流程後,心裡突然有一個聲音告訴我:
John啊,你一定要做自動部署,你如果現在不出來做,連天公伯都不會原諒你!
剛好團隊近期也導入 Docker 做容器服務管理,在尋找了一些資料以及自動部署流程的教學後,便決定使用 Drone 這套服務來搭配之前已經建置在 Docker 上的 Gitea 版本控制系統來建立一套簡易的 Continuous Delivery 流程。
為什麼選擇Drone?
- 佔用記憶體資源少(僅約20MB)
- 所有建置環境皆在 Docker 上實作,避免與系統互相干擾
- 有多樣 Plugin 可供串接服務
- 可與各種版本控制系統快速串接(GitHub、GitLab、Gitea、Gogs、Bitbucket 等)
- 以簡易撰寫 yaml 檔案的方式定義部署流程
以下會詳細介紹從安裝 Docker 到將 Drone 執行為 Docker Container 提供未來部署使用的流程。
https://medium.com/asiayo-engineering/%E7%94%A8-drone-%E6%89%93%E9%80%A0-ci-cd-flow-36b9d14c7620 用 Drone 打造 CI/CD flow
ref:https://medium.com/@stu60610/%E4%BD%BF%E7%94%A8-docker-drone-%E5%BB%BA%E7%AB%8B%E7%B0%A1%E6%98%93%E8%87%AA%E5%8B%95%E9%83%A8%E7%BD%B2%E6%B5%81%E7%A8%8B-part1-a180eb48ff37
webhook
https://ithelp.ithome.com.tw/articles/10193212 第四天:認識 Webhook
Webhook 是讓一個網站能訂閱另一個網站的方法
*上面那篇介紹了實際上是介紹了rails做後端與資料庫,有用到
- postman
- imgur
學會怎麼把圖檔弄到 imgur
- imgur 有提供 api,這是說明文件:https://apidocs.imgur.com/#4b8da0b3-3e73-13f0-d60b-2ff715e8394f。使用 api 需要 Client-ID,這東西就跟 Line channel secret 那些東西差不多。你可以透過這個網址:https://api.imgur.com/oauth2/addclient 取得你的 Client-ID。照著填就可以。
- heroku(server)
- 連結line
- 連結氣象
去氣象局取氣象圖
uri = URI('http://www.cwb.gov.tw/V7/js/HDRadar_1000_n_val.js')
response = Net::HTTP.get(uri)
start_index = response.index('","') + 3
end_index = response.index('"),') - 1
"http://www.cwb.gov.tw" + response[start_index..end_index]
end
把氣象圖丟上imgur(那為什麼不是我們自己保存圖片就好呢?因為存圖片要占空間跟頻寬,所以我選擇用 imgur 的空間放圖。imgur 有一個蠻好的地方是,你可以直接把圖片網址給他,他就會幫你備份圖片了,所以我們不用真的把圖檔抓回來再上傳到 imgur。而且作者當時的氣象圖網址是http開頭,而line要求https,imgur提供的是https,現在的話氣象局已經改成https)
def upload_to_imgur(image_url)
url = URI("https://api.imgur.com/3/image")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["authorization"] = 'Client-ID be2d83405627ab8'
request.set_form_data({"image" => image_url})
response = http.request(request)
json = JSON.parse(response.read_body)
begin
json['data']['link'].gsub("http:","https:")
rescue
nil
end
end
pipeline
https://docs.drone.io/configure/pipeline/
k8s
not clear
how add class active for parent when child router link clicked
在router parent寫 redirect : { name : 'childName' } ,接著router在想要active by click child's parent view button 寫:to="{name:`parent`}"
2019年10月15日 星期二
TypeScript with querySelector issues,超詭異標準符號!成為新寫法
this.$el.querySelector('.message-bubble__list:last-child')!.scrollIntoView(false);
如果沒有!
會出現Object is possibly 'null'.
!表示必定存在
如果沒有!
會出現Object is possibly 'null'.
!表示必定存在
2019年10月3日 星期四
為什麼使用vue.directive
why use vue.directive
https://css-tricks.com/power-custom-directives-vue/
https://cn.vuejs.org/v2/guide/custom-directive.html 官方文件
https://cythilya.github.io/2017/05/05/vue-custom-directive/ 夏天..
https://ithelp.ithome.com.tw/articles/10204866 use @Directive ...
http://ryanhsutw.blogspot.com/2016/05/directive.html 深入說明與帶實例
https://stackoverflow.com/questions/36170425/detect-click-outside-element 工作上想用但不會寫進去@...(要記得跟rou討論可以可以用再加進去)
https://github.com/InDIOS/vue-ts-decorate use @Directive ...
google "directive 使用時機" 感覺搜出來的文章都挺深的!
https://css-tricks.com/power-custom-directives-vue/
https://cn.vuejs.org/v2/guide/custom-directive.html 官方文件
https://cythilya.github.io/2017/05/05/vue-custom-directive/ 夏天..
https://ithelp.ithome.com.tw/articles/10204866 use @Directive ...
http://ryanhsutw.blogspot.com/2016/05/directive.html 深入說明與帶實例
https://stackoverflow.com/questions/36170425/detect-click-outside-element 工作上想用但不會寫進去@...(要記得跟rou討論可以可以用再加進去)
https://github.com/InDIOS/vue-ts-decorate use @Directive ...
google "directive 使用時機" 感覺搜出來的文章都挺深的!
訂閱:
文章 (Atom)