Skip to content

Instantly share code, notes, and snippets.

#user nobody;
worker_processes 2;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
pid /run/nginx.pid;
Mozilla/5.0 (Linux; U; Android 4.0.3; ko-kr; LG-L160L Build/IML74K) AppleWebkit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30
Mozilla/5.0 (Linux; U; Android 4.0.3; de-ch; HTC Sensation Build/IML74K) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30
Mozilla/5.0 (Linux; U; Android 2.3; en-us) AppleWebKit/999+ (KHTML, like Gecko) Safari/999.9
Mozilla/5.0 (Linux; U; Android 2.3.5; zh-cn; HTC_IncredibleS_S710e Build/GRJ90) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1
Mozilla/5.0 (Linux; U; Android 2.3.5; en-us; HTC Vision Build/GRI40) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1
Mozilla/5.0 (Linux; U; Android 2.3.4; fr-fr; HTC Desire Build/GRJ22) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1
Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; T-Mobile myTouch 3G Slide Build/GRI40) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1
Mozilla/5.0 (Linux; U; Android 2.3.3; zh-tw; HTC_Pyramid Build/G
[Desktop]
https://myip.ms/browse/comp_browseragents/Computer_Browser_Agents.html
[All]
https://udger.com/resources/ua-list
http://www.useragentstring.com/pages/useragentstring.php
https://deviceatlas.com/blog/list-of-user-agent-strings
[PHP redirect script]
if ($version != "desktop") {
$useragent=$_SERVER['HTTP_USER_AGENT'];
if(preg_match('/android|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|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/i',$useragent)||preg_match('/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)
@c7x43t
c7x43t / $$.js
Last active March 22, 2018 08:23
merc={
_kEquip:function(e){
e.setDefaultValue=function(value){
if(!(e instanceof Array)) e=merc._Array.from(e);
e.map(e=>{
e.value=value;
e.addEventListener("focusin",(e)=>{
if(e.target.value===value) e.target.value="";
});
e.addEventListener("focusout",(e)=>{
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>compare</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
.font-smoothing {
/* Adjust font size */
font-size: 100%;
-webkit-text-size-adjust: 100%;
/* Font varient */
font-variant-ligatures: none;
-webkit-font-variant-ligatures: none;
/* Smoothing */
font-smooth: always;
text-rendering: optimizeLegibility;
@c7x43t
c7x43t / round n to m decimals.js
Last active May 9, 2018 09:40
roundN(1.005,2) -> 1.01
function roundN(n,m){
return Math.round(n*Math.pow(10,m)+72e-16)/Math.pow(10,m);
}
@c7x43t
c7x43t / serialize.js
Last active April 29, 2018 11:08
serialize <input>
function serialize(form){
if (!form || form.nodeName !== "FORM") return;
var el, op, obj = {}, name, type, value, node;
for (el of form.elements) {
name=el.name;
if (name === "") continue;
type=el.type;
value=el.value;
node=el.nodeName;
if(/INPUT/.exec(node) && (/text|hidden|password|button|reset|submit/.exec(type) || /checkbox|radio/.exec(type)&&el.checked) ||
// https://mozilla.github.io/server-side-tls/ssl-config-generator/
server {
listen 80 default_server;
listen [::]:80 default_server;
# Redirect all HTTP requests to HTTPS with a 301 Moved Permanently response.
return 301 https://$host$request_uri;
}
server {
(function(global) {
var PARENT = "[[__PARENT__]]";
function Immutable(obj) {
if (obj instanceof Object) {
for (var keys = Object.keys(obj), i = 0; i < keys.length; i++) {
this[keys[i]] = obj[keys[i]];
}
}
if (obj !== false) Object.freeze(this);