Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
* {
background-color: rgba(0,0,0,0.07);
}
@xieranmaya
xieranmaya / stuns
Created October 14, 2016 12:37 — forked from zziuni/stuns
STUN server list
# source : http://code.google.com/p/natvpn/source/browse/trunk/stun_server_list
# A list of available STUN server.
stun.l.google.com:19302
stun1.l.google.com:19302
stun2.l.google.com:19302
stun3.l.google.com:19302
stun4.l.google.com:19302
stun01.sipphone.com
stun.ekiga.net
@xieranmaya
xieranmaya / Promise.delay.js
Last active August 29, 2015 14:22
Implement a delay in ES6 Promise.
Promise.prototype.delay = function(duration) {
return this.then(function(value) {
return new Promise(function(resolve) {
setTimeout(function() {
resolve(value)
}, duration)
})
}, function(reason) {
return new Promise(function(resolve, reject) {
setTimeout(function() {
@xieranmaya
xieranmaya / loading-anim.css
Created June 4, 2015 09:19
纯CSS给一行文字后面加上简单的loading效果
.loading-anim {
font-size: 64px;
display: inline-block;
}
.loading-anim:after {
content: "\2026";
font-family: serif;
overflow: hidden;
display: inline-block;
vertical-align: bottom;
.loading-anim{
font-size: 16px;
display: inline-block;
&:after{
content: "\2026";
font-family: "Simsun";
overflow: hidden;
display: inline-block;
vertical-align: bottom;
animation: loading-anim 1.2s infinite;
var escapeJSON = (function() {
var _escape = function(string) {
string = string == null ? '' : '' + string;
return /(?:&|<|>|"|'|`)/.test(string) ? string.replace(/(?:&|<|>|"|'|`)/g, function(match) {
var escapeMap = {
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
"'": '&#x27;',
@xieranmaya
xieranmaya / china-city-area-zip-uincode.js
Last active August 29, 2015 14:09
中国省份-城市-地区-邮编数据,来自小米
var china_city_area_zip = [{
"id": 2,
"name": "\u5317\u4eac",
"child": [{
"id": 36,
"name": "\u5317\u4eac\u5e02",
"child": [{
"id": 377,
"name": "\u4e1c\u57ce\u533a",
"zipcode": "100011"
// src: https://cb.qq.com/bank/js/pinyin.js?v=1.0.3
;
(function(global) {
var dict_combo = {
"yā,ā": "吖",
"ā,ē": "阿",
"hē,a,kē": "呵",
"shà,á": "嗄",
"ā,á,ǎ,à,a": "啊",
"ā,yān": "腌",
@xieranmaya
xieranmaya / 0_reuse_code.js
Created June 1, 2014 16:05
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
div{
display: table-cell;
vertical-align: middle;
text-align: center;
width: 323px;
height: 295px;
background-color: lightgreen;
}
img{
max-width: 100%;