Skip to content

Instantly share code, notes, and snippets.

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();
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: 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';
Vue.use(Vuex)
export default new Vuex.Store({
actions,
getters,
modules: {
@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() {
@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>
func init() {
revel.OnAppStart(InitDB)
}
// Code generated by SQLBoiler (https://github.com/volatiletech/sqlboiler). DO NOT EDIT.
// This file is meant to be re-generated in place and/or deleted at any time.
package models
import (
"bytes"
"database/sql"
"fmt"
"reflect"
var search = location.search.substring(1);
JSON.parse('{"' + decodeURI(search).replace(/"/g, '\\"').replace(/&/g, '","').replace(/=/g,'":"') + '"}')
function glne () {
local str=`git --no-pager log --name-only $* |percol `
if [[ $str =~ ^[[:space:]]*([a-z0-9A-Z_.\/-]*).*$ ]]; then
sublime $(pwd)/${BASH_REMATCH[1]};
fi
}