Skip to content

Instantly share code, notes, and snippets.

func init() {
revel.OnAppStart(InitDB)
}
@aloha1003
aloha1003 / fake-autoplay-audio-ios-safari.html
Created January 26, 2018 21:48 — forked from ufologist/fake-autoplay-audio-ios-safari.html
Fake auto play html audio in iOS Safari the right way
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<title>Fake auto play html audio in iOS Safari the right way</title>
</head>
<body>
<h1>在 iOS Safari 中假装自动播放 HTML5 audio(音乐) 的正确方式</h1>
<p>核心原理: 通过一个用户交互事件来主动 play 一下 audio</p>
@aloha1003
aloha1003 / question-code
Created December 6, 2017 02:03
question-code
My Template :
<f7-list form>
<f7-list-item>
<f7-label>Fruit</f7-label>
<f7-input type="text" placeholder="Fruit" :id="'autocomplete-dropdown-expand'+_uid"></f7-input>
</f7-list-item>
</f7-list>
methods:
initAutoComplete: function() {
Vue.use(Vuex)
export default new Vuex.Store({
actions,
getters,
modules: {
/* Function: download with resume/speed/stream options */
/* List of File Types */
function fileTypes($extension){
$fileTypes['swf'] = 'application/x-shockwave-flash';
$fileTypes['pdf'] = 'application/pdf';
$fileTypes['exe'] = 'application/octet-stream';
$fileTypes['zip'] = 'application/zip';
$fileTypes['doc'] = 'application/msword';
var isLoadingJob = false;
var startTime = {};
var endTime = {};
function pingByImage(host, img_path, pong) {
if (!isLoadingJob) {
isLoadingJob = true;
var img = host+img_path;
var hashId = hashCode(host);
var t = InitiateSpeedDetection(host, img);
function ping(host, port, pong) {
var started = new Date().getTime();
var http = new XMLHttpRequest();
http.open("GET", "http://" + host + ":" + port, /*async*/true);
http.onreadystatechange = function() {
if (http.readyState == 4) {
var ended = new Date().getTime();
//JUST AN EXAMPLE, PLEASE USE YOUR OWN PICTURE!
var imageAddr = "http://www.kenrockwell.com/contax/images/g2/examples/31120037-5mb.jpg";
var downloadSize = 4995374; //bytes
function ShowProgressMessage(msg) {
if (console) {
if (typeof msg == "string") {
console.log(msg);
} else {
for (var i = 0; i < msg.length; i++) {
function getComponent(vm, tagName){
for (var i = 0; i < vm.$children.length; i++) {
if (vm.$children[i].$options.name == tagName) {
return vm.$children[i];
}
}
}
@aloha1003
aloha1003 / xxx
Created September 21, 2017 06:59
"name": /^[\u4e00-\u9fa5_a-zA-Z]+$/ //中英文only