Skip to content

Instantly share code, notes, and snippets.

View shaomingquan's full-sized avatar

__qms shaomingquan

View GitHub Profile
// 1
// "internationalization"
function abbr (input) {
const length = input.length
if (length < 3) {
return input
}
return input[0] + (length - 2) + input[length - 1]
}
var oldHeadAppend = HTMLHeadElement.prototype.appendChild
HTMLHeadElement.prototype.appendChild = function () {
var args = [].slice.call(arguments)
var child = args[0]
if (child instanceof HTMLScriptElement) {
child.src = child.src + ('?ts=' + Date.now())
}
return oldHeadAppend.apply(this, args)
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>vertical center</title>
<style>
/* parent */
.p {
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
#a {
height: 300px;
package gopromise
import (
"context"
"errors"
"sync"
"time"
)
//Promise struct