This is a simple web server for auto browsersync.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 利用 validate function 可以驗證 object 中的必填欄位有無填寫 | |
**/ | |
// object validation rules | |
const schema = { | |
firstName: { | |
required:true | |
}, | |
lastName: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-disable */ | |
const request = require('request') | |
const cheerio = require('cheerio') | |
const async = require('async') | |
const path = require('path') | |
const fse = require('fs-extra') | |
let getLocationURL = 'https://event.moc.gov.tw/' | |
let pageSize = '100' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// package.json | |
{ | |
"name": "webpack-sandbox", | |
"sideEffects": false, | |
"version": "1.0.0", | |
"description": "", | |
"private": true, | |
"scripts": { | |
"build": "webpack -p", | |
"watch": "webpack --watch", // 當檔案有變更時會重 build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- ./app/views/posts/_form.html.erb --> | |
<div class="form-group mb-3"> | |
<%= content_fields.label :body, class: 'col-form-label' %> | |
<div data-controller="quill-editor"> | |
<div data-target="quill-editor.container" style="min-height: 250px;"></div> | |
<%= content_fields.text_area :body, class: 'form-control d-none', placeholder: 'Content' %> | |
</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// async function 本身會回傳 Promise, | |
// 因此 async function 之後也可以用 `.then()` 串起來 | |
main().then(value => { | |
console.log(value); | |
}); | |
async function main () { | |
console.log('start fn') // STEP 1-1 | |
let val = await get() // STEP 1-2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Person(name, interests) { | |
this.name = name; | |
this.interests = interests; | |
}; | |
Person.prototype.greeting = function() { | |
console.log(`Hi! I'm ${this.name}.`); | |
}; | |
function Teacher(name, interests, subject) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let alphaPhoneX = { | |
name: 'AlphaPhoneX', // String | |
price: 14999, // Number | |
features: ['long battery life', 'AI camera'], // Array | |
showSpec: function() { // Function | |
console.log('show the spec of the phone') | |
}, | |
hardware: { // Object | |
ram: '8GB', | |
storage: '64GB' |