inner = 'window';
function say() {
console.log(inner);
console.log(this.inner);
}
This file contains hidden or 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
//min: 内径长度 | |
//max: 外径长度 | |
function pentagon5(min, max) { | |
const minPoint = transform(getBasePoint(min), max); | |
const maxPoint = transform(getBasePoint(max), max); | |
maxPoint.reverse(); | |
return toStr(minPoint) + toStr(maxPoint) | |
function getBasePoint(base) { |
This file contains hidden or 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 f32 = event.inputBuffer.getChannelData(0); | |
// 复制一份内存数据 | |
const f32Ret = new Float32Array(f32); | |
// 把一个音频文件切片,分次上传 | |
this.http.get('http://local.yuanfudao.ws:3000/assets/rec-001.wav', { | |
responseType: 'blob' |
This file contains hidden or 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 speedtest() { | |
var xmlhttp = new XMLHttpRequest(), | |
method = "GET", | |
url = "http://109.123.87.183/speedtest.256mb"; | |
const start = Date.now(); | |
xmlhttp.open(method, url, true); | |
xmlhttp.onprogress = function (e) { | |
const dnow = Date.now(); | |
const miao = (dnow - start) / 1000; | |
const mb = 1024 * 1024; |
This file contains hidden or 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 getCurrentSize() { | |
let dirCount = 0, fileCount = 0; | |
let path = location.href.match(/path=([^&]+)/); | |
path = decodeURIComponent(path[1]) | |
console.log('starting...') | |
const res = await getSize(path) | |
console.log(res, dirCount, fileCount) | |
async function getSize(path) { | |
const res = await getInfo(path) |
This file contains hidden or 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
You also need to install the XCode Command Line Tools by running xcode-select --install. | |
Alternatively, if you already have the full Xcode installed, you can find them under the menu | |
Xcode -> Open Developer Tool -> More Developer Tools.... | |
This step will install clang, clang++, and make. |
This file contains hidden or 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
var ms = new SpeechSynthesisUtterance("ある程度の人数を集めなければいけなかったので、実父の趣味で「祭り」の仲間に大勢来てもらう事が出来ました。そのおかげで、友人は居ませんでしたが、和太鼓の演舞や新郎を簡易のお神輿に乗せて練り歩く等の余興をしてもらう事ができて、とても賑やかな式になりました。 (40歳/女性)"); | |
msg.lang = 'ja-JP'; | |
msg.rate = 0.8; | |
var list = speechSynthesis.getVoices(); | |
var newlist = list.filter(l => l.lang.indexOf('ja') >= 0) | |
console.log(newlist) | |
msg.voice = newlist[0] | |
window.speechSynthesis.speak(msg); | |
This file contains hidden or 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
//content scripts 与页面通信 | |
var port = chrome.runtime.connect(); | |
window.addEventListener("message", function(event) { | |
// We only accept messages from ourselves | |
if (event.source != window) | |
return; | |
if (event.data.type && (event.data.type == "FROM_PAGE")) { | |
console.log("Content script received: " + event.data.text); |
This file contains hidden or 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
//重写UploadFile和xhrUploadImg | |
function changeGlobalUploadFilePrototype() { | |
if (!window.FileReader || !window.FormData) { | |
// 如果不支持html5的文档操作,直接返回 | |
return; | |
} | |
var E = wangEditor; | |
wangEditor.UploadFile.fn.selected = function(e, input) { |
NewerOlder