/* | |
* Your Stylesheet | |
* | |
* This stylesheet is loaded when Atom starts up and is reloaded automatically | |
* when it is changed and saved. | |
* | |
* Add your own CSS or Less to fully customize Atom. | |
* If you are unfamiliar with Less, you can read more about it here: | |
* http://lesscss.org | |
*/ |
<?php | |
# Implements a recursive null object pattern. | |
# | |
# Implemented as a trait so any object can make it's properties use | |
# the null pattern without resorting to inheritance. | |
# | |
# The goal is so you can pull data off a partially populated object | |
# without excessive existance checks. | |
trait NullPattern { |
// Returns a function, that, when invoked, will only be triggered once every | |
// browser animation frame - using tram's requestAnimationFrame polyfill. | |
// tram.js - https://github.com/bkwld/tram | |
_.throttle = function(func) { | |
var wait, args, context; | |
return function () { | |
if (wait) return; | |
wait = true; | |
args = arguments; | |
context = this; |
var root = this; | |
(function( jQuery ) { | |
if ( root.XDomainRequest ) { | |
jQuery.ajaxTransport(function( s ) { | |
if ( s.crossDomain && s.async ) { | |
if ( s.timeout ) { | |
s.xdrTimeout = s.timeout; | |
delete s.timeout; | |
} |
find . -type f -size +10000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }' |
#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(
var oldSync = Backbone.sync; | |
Backbone.sync = function(method, model, options){ | |
options.beforeSend = function(xhr){ | |
xhr.setRequestHeader('X-CSRFToken', CSRF_TOKEN); | |
}; | |
return oldSync(method, model, options); | |
}; |