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
| ;// to launch mobile app | |
| var insideWeChat = typeof window.WeixinJSBridge == "object"; | |
| var isMobileDevice = 'ontouchstart' in window || /Android|webOS|iPhone|iPad|iPod|BlackBerry|BB10|IEMobile|Opera Mini/i.test(navigator.userAgent); | |
| ;(function(document, window){ // | |
| var ua = navigator.userAgent; | |
| var tid, callfn, duration = 1300; | |
| function bind(el, en, fn, useCapture){ | |
| el.addEventListener ? el.addEventListener(en, fn, useCapture||false): (el.attachEvent ? el.attachEvent('on'+en, fn) : el['on'+en]=fn); | |
| } | |
| function unbind(el, en, fn, useCapture){ |
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(r,k){"use strict";var N=1023,N0=56320,N6=65536,z={f:Math.floor,s:"string",r:"Character outside valid Unicode range: 0x",e:"Bad UTF-8 encoding 0x"},q=function(c,i,j){if(!i&&!j)throw new Error(c||"Unfinished UTF-8 octet sequence");return j?c.subarray(i,j):(i==1?(0===c||null===c||0===c.length):(i==2?c.toString(16):(i>2&&i<6?new [Uint8Array,Uint16Array,Uint32Array][i-3](c):String.fromCharCode.apply(String,c))))};function e(r,e){var n=r.length,t=n<<2;if(e){var a=r[n-1];if(t-=4,t-3>a||a>t)return null;t=a}for(var o=q(t,3),i=0;t>i;++i)o[i]=r[i>>>2]>>>((3&i)<<3);return o}function n(r,e){var n=r.length,t=n>>>2;0!==(3&n)&&++t;var a;e?(a=q(t+1,5),a[t]=n):a=q(t,5);for(var o=0;n>o;++o)a[o>>2]|=r[o]<<((3&o)<<3);return a}function t(r,e,n,t,a,o){return(n>>>5^e<<2)+(e>>>3^n<<4)^(r^e)+(o[3&t^a]^n)}function a(r){if(r.length<16){var e=q(16,3);e.set(r),r=e}return r}function o(r,e){var n,a,o,i,c,f,u=r.length,s=u-1;for(a=r[s],o=0,f=0|z.f(6+52/u);f>0;--f){for(o+=y,i=o>>>2&3,c=0;s>c;++c)n=r[c+1],a=r[c]+=t(o,n,a,c,i,e);n=r[0] |
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
| /* download ppt pdf from dtcc 2017 | |
| * Author: Mindon <mindon@gmail.com> http://mindon.github.io | |
| */ | |
| package main | |
| import ( | |
| "bufio" | |
| "fmt" | |
| "io/ioutil" | |
| "net/http" |
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
| // gohtml-cli command tool to format html files using yosssi's gohtml | |
| // [NOTICE] some issues are in yosssi's gohtml - which has not updated for years <https://github.com/yosssi/gohtml/issues> | |
| // DO MAKE BACKUPs before you trying this | |
| // it's recommended using js-beautify instead: <https://github.com/beautify-web/js-beautify> | |
| // Jun. 25, 2017 - Mindon <mindon@gmail.com> | |
| package main | |
| import ( | |
| "fmt" |
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
| // The Monty Hall problem | |
| // 蒙提霍尔问题 | |
| var posibilities = [ | |
| ['C', 'A', 'B'], | |
| ['C', 'B', 'A'], | |
| ['B', 'C', 'A'], | |
| ['B', 'A', 'C'], | |
| ['A', 'B', 'C'], | |
| ['A', 'C', 'B'], | |
| ];// Apple, Banana, Car |
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
| // track feature | |
| // author: Mindon <mindon@gmail.com> | |
| // updated: July 13, 2017. Shenzhen, Guangdong, China P.R. | |
| // track.bind(audio-element, cues) | |
| // track.bind(audio-element, cues, track-bubble-container-element) | |
| // cues-array = track.get(cues-data or cues-dataUrl, cb) // cb = (cues)=>{} | |
| // supports VTT and lyric format | |
| var track = (function(){ | |
| // ------ track namespace begin |
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
| // javascript bisect | |
| // const z=[0, 20, 50, 80, 110, 141, 173, 204, 235, 266, 297, 327]; console.log(bisect(25, z)); | |
| function bisect(v,d){let i=n=0,j=d.length;if(j==1){return 0}n=Math.floor(j/2);if(d[n]>v){j=n}else{i=n}return i+bisect(v,d.slice(i,j))} |
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
| // CONVERT simple .ai (adobe illustrator) file to svg format | |
| // http://www.fileformat.info/format/ai/egff.htm | |
| // | |
| package main | |
| import ( | |
| "fmt" | |
| "io/ioutil" | |
| "math" |
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
| // simple heart shape for OpenSCAD | |
| // author: Mindon <mindon@gmail.com> | |
| // from https://mindon.github.io/ | |
| heart(width = 160, height = 160); | |
| module heart(width, height = 0) { // 0 = auto height | |
| w = width; h = height; | |
| r = 2 * w/7; // top circle radius | |
| i = r/4.0; // top circle intersect-part width |
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
| // http request testing helper | |
| // author: Mindon Feng <mindon@gmail.com> | |
| // site: https://mindon.github.io | |
| package mindon | |
| import ( | |
| "bytes" | |
| "errors" | |
| "io/ioutil" | |
| "net/http" |