Skip to content

Instantly share code, notes, and snippets.

View huyinghuan's full-sized avatar
🤑
working

L.T huyinghuan

🤑
working
View GitHub Profile
server {
listen 80;
server_name test.com;
set $mobile_rewrite do_not_perform;
if ($http_user_agent ~* "android.+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino") {
set $mobile_rewrite perform;
}
if ($http_user_agent ~* "^(1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(
@huyinghuan
huyinghuan / isIE.js
Created April 28, 2016 17:23
判断IE版本
var isIE = function(verArr){
var b = document.createElement('b');
if(!verArr){
b.innerHTML = '<!--[if IE]><i></i><![endif]-->';
return b.getElementsByTagName('i').length === 1
}
for(var i = 0, len = verArr; i < len; i++){
b.innerHTML = '<!--[if IE ' + verArr[i] + ']><i></i><![endif]-->'
if(b.getElementsByTagName('i').length === 1){
return true
async = (queue, over)->
next = ->
step = queue.shift()
if step
step.apply(null, arguments.concat(next))
else
over and over()
next()
formatNum = (number)->
number = "#{number}".replace(/\d+?(?=(?:\d{3})+$)/img, "$&, ")
function numToChart(queue){
var s = [];
for(var a = 0, len = queue.length; a < len; a++){
s.push(String.fromCharCode(+queue[a]))
}
return s.join('')
}
function strToNum(str){
queue = str.split('');
function Arabia_to_Chinese(num) {
num = String(num)
for (i = num.length - 1; i >= 0; i--) {
num = num.replace(",", "")
num = num.replace(" ", "")
}
if (isNaN(num)) {
return false;
}
part = String(num).split(".");
@huyinghuan
huyinghuan / LICENSE
Created August 15, 2014 07:06
LICENSE-MIT
Copyright (c) 2014 huyinghuan
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions: