-
重新啟動quokka的即時運算 按F1 並輸入 Quokka.js start on current file 就可以重新執行當前檔案
-
計算程式執行時間
//在要計算的程式後面加上 /*?.*/ 就會顯示當下執行的時間
let num=Math.floor(Math.random()*100);/*?.*/
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>成語松 Idiomthon</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> | |
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script> | |
</head> |
import { createStore, applyMiddleware} from 'redux'; | |
import reducers from '../reducers'; | |
import thunk from 'redux-thunk'; | |
const createStoreWithMiddleware = applyMiddleware(thunk)(createStore); | |
export default function(initialState){ | |
const store = createStoreWithMiddleware(reducers, initialState); | |
if (module.hot) { | |
// Enable Webpack hot module replacement for reducers | |
module.hot.accept('../reducers', () => { | |
const nextRootReducer = require('../reducers'); |
const Koa = require('koa'); | |
const app = new Koa(); | |
const Router = require('koa-router'); | |
//方法一 | |
// 1. 想要用的route 先用變數存, | |
// 2. 一個一個加進route變數中. | |
// 3. app一次使用route變數 | |
const router = Router(); |
override func viewDidLoad() { | |
super.viewDidLoad() | |
for i in 0 ..< 12 { | |
let btnMyButton = UIButton.init(type: .system) | |
btnMyButton.frame=CGRect(x: 47 + (i % 4) * 60, y: 95 + (i/4) * 50, width: 20, height: 20) | |
btnMyButton.setTitle(String(i), for: .normal) | |
btnMyButton.backgroundColor = UIColor.black | |
view.addSubview(btnMyButton) | |
} | |
} |
module.exports = _curry1(function comparator(pred) { | |
return function(a, b) { | |
return pred(a, b) ? -1 : pred(b, a) ? 1 : 0; | |
}; | |
}); |
module.exports = _curry1(function comparator(pred) { | |
return function(a, b) { | |
return pred(a, b) ? -1 : pred(b, a) ? 1 : 0; | |
}; | |
}); |
//排除前端頁面物件動態生成 造成後端爬蟲無法正確抓到內容的錯誤 | |
driver.get('http://grbsearch.stpi.narl.org.tw/search/planDetail?id=2228&docId=35'); | |
driver.wait(until.elementLocated(By.id('maincontent')),5000).then(()=>{ | |
driver.getPageSource().then(body => { | |
const $ = cheerio.load(body); | |
console.log($('#maincontent')); | |
}); | |
}); |
重新啟動quokka的即時運算 按F1 並輸入 Quokka.js start on current file 就可以重新執行當前檔案
計算程式執行時間
//在要計算的程式後面加上 /*?.*/ 就會顯示當下執行的時間
let num=Math.floor(Math.random()*100);/*?.*/