Skip to content

Instantly share code, notes, and snippets.

#Mobile Device Detection via User Agent RegEx

Yes, it is nearly 2012 and this exercise has been done to death in every imaginable language. For my own purposes I needed to get the majority of non-desktop devices on to a trimmed down, mobile optimized version of a site. I decided to try and chase down an up-to-date RegEx of the simplest thing that could possibly work.

I arrived at my current solution after analyzing 12 months of traffic over 30+ US based entertainment properties (5.8M+ visitors) from Jan - Dec 2011.

The numbers solidified my thoughts on the irrelevancy of including browsers/OSes such as Nokia, Samsung, Maemo, Symbian, Ipaq, Avant, Zino, Bolt, Iris, etc. The brass tacks of the matter is that you certainly could support these obscure beasts, but are you really going to test your site on them? Heck, could you even find one?! Unless the folks that pay you are die hard Treo users my guess is "No".

Interestingly enough my research shows that /Mobile/ is more efficient than **/iP(

# 內容
# repo 位置
- https://github.com/facebook/react
- https://github.com/facebook/flux
# 官網
- React
* http://facebook.github.io/react/
var selector = 'img' // Replace this with the selector for the element you want to make transformable
jQuery.getScript('//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js', function() {
jQuery.getScript('//cdnjs.cloudflare.com/ajax/libs/numeric/1.2.6/numeric.min.js', function() {
(function() {
var $, applyTransform, getTransform, makeTransformable;
$ = jQuery;
@pc035860
pc035860 / facebookConnectPlugin.js
Created August 16, 2015 11:05
facebookConnectPlugin.js for Ionic
/* global cordova */
if (typeof cordova !== 'undefined') {
cordova.define("com.phonegap.plugins.facebookconnect.FacebookConnectPlugin", function(require, exports, module) {
"use strict";
/*
* @author Ally Ogilvie
* @copyright Wizcorp Inc. [ Incorporated Wizards ] 2014
* @file - facebookConnectPlugin.js
@pc035860
pc035860 / README.md
Last active October 22, 2021 20:22
All-you-need jQuery plugin for running css animations.

Usage

// With Animate.css
$(...).cssAnimate('animated bounce');

// Chaining animations with promise
$(...).cssAnimate('animated bounce')
.then(function (elm) {
 return $(elm).cssAnimate('animated flash');
@pc035860
pc035860 / gist:a3b00a011ab67791a33c
Created October 7, 2015 04:40 — forked from justinmc/gist:9149719
Sample Gulpfile
var gulp = require('gulp');
var clean = require('gulp-clean');
var jshint = require('gulp-jshint');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var imagemin = require('gulp-imagemin');
var bases = {
app: 'app/',
@pc035860
pc035860 / version_compare.js
Created October 12, 2015 09:10 — forked from TheDistantSea/version_compare.js
Function to compare two version strings (e.g. "1.6.1" is smaller than "1.7"). Developed in order to answer http://stackoverflow.com/a/6832721/50079.
/**
* Compares two software version numbers (e.g. "1.7.1" or "1.2b").
*
* This function was born in http://stackoverflow.com/a/6832721.
*
* @param {string} v1 The first version to be compared.
* @param {string} v2 The second version to be compared.
* @param {object} [options] Optional flags that affect comparison behavior:
* <ul>
* <li>
@pc035860
pc035860 / README.md
Last active January 6, 2016 04:57
Better easing timing function in Sass

Usage

SCSS

@import "better-easing";

.foo {
  transition: all 1s easing(circOut);
}
@pc035860
pc035860 / chart_colors.txt
Created May 9, 2018 09:32 — forked from there4/chart_colors.txt
[CSS] Chart Color Collection
#3366CC
#DC3912
#FF9900
#109618
#990099
#3B3EAC
#0099C6
#DD4477
#66AA00
#B82E2E
@pc035860
pc035860 / debugUpdate.js
Created May 23, 2019 03:31
HoC for debug component update
/* eslint no-console: 0 */
import _ from 'lodash';
import { diff } from 'deep-object-diff';
import { shouldUpdate } from 'recompose';
export default function debugUpdate(groupLabel, collapsed = true) {
if (typeof groupLabel === 'undefined') {
throw new Error('Should provide `groupLabel`.');
}