同步教學連結 http://lepidllama.net/blog/how-to-push-an-existing-cloud9-project-to-github/
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 logFunc(func){ | |
console.log(`[${func.name}] has been excute`); | |
func.exec=function(...param){ | |
try{ | |
console.log(`param is`, param); | |
const start=Date.now(); | |
console.log(`start at`,start); | |
const execResult= func(param); |
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
const groupBy = function(xs, key) { | |
return xs.reduce(function(rv, x) { | |
(rv[x[key]] = rv[x[key]] || []).push(x); | |
return rv; | |
}, {}); | |
}; | |
//usage: | |
const data =[{id:1, v:1},{id:1, v:2},{id:3, v:1}] | |
const result= groupBy(data, 'id'); |
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
/* | |
* 使用方法 | |
* step 1: 新增一個書籤(隨便位置都可以) | |
* step 2: 編輯書籤的資訊 | |
* step 3: 複製下面的程式碼, 貼到網址列裡面後儲存 | |
* step 4: 開啟clip後, 點選剛剛你新增的書籤, 接著再對影片點右鍵, 就可以直接下載了 | |
*/ | |
javascript:(()=>{ | |
document.querySelector('.player-overlay').className='media' |
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
import React, { Component } from 'react'; | |
import { View, Text, Image, TouchableOpacity, Dimensions } from 'react-native'; | |
const Width = Dimensions.get('window').width; | |
const Height = Dimensions.get('window').height; | |
export default class FirstTabScreen extends Component { | |
constructor(props) { | |
super(props); | |
this.props.navigator.setOnNavigatorEvent(this.onNavigatorEvent.bind(this)); | |
this.state = {}; | |
} |
-
重新啟動quokka的即時運算 按F1 並輸入 Quokka.js start on current file 就可以重新執行當前檔案
-
計算程式執行時間
//在要計算的程式後面加上 /*?.*/ 就會顯示當下執行的時間
let num=Math.floor(Math.random()*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
module.exports = _curry1(function comparator(pred) { | |
return function(a, b) { | |
return pred(a, b) ? -1 : pred(b, a) ? 1 : 0; | |
}; | |
}); |
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
module.exports = _curry1(function comparator(pred) { | |
return function(a, b) { | |
return pred(a, b) ? -1 : pred(b, a) ? 1 : 0; | |
}; | |
}); |
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
//排除前端頁面物件動態生成 造成後端爬蟲無法正確抓到內容的錯誤 | |
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')); | |
}); | |
}); |