This is now an actual repo:
// ---------------------------------------------------------- | |
// A short snippet for detecting versions of IE in JavaScript | |
// without resorting to user-agent sniffing | |
// ---------------------------------------------------------- | |
// If you're not in IE (or IE version is less than 5) then: | |
// ie === undefined | |
// If you're in IE (>=5) then you can determine which version: | |
// ie === 7; // IE7 | |
// Thus, to detect IE: | |
// if (ie) {} |
#Four Ways To Do Pub/Sub With jQuery and jQuery UI (in the future)
Between jQuery 1.7 and some of work going into future versions of jQuery UI, there are a ton of hot new ways for you to get your publish/subscribe on. Here are just four of them, three of which are new.
(PS: If you're unfamiliar with pub/sub, read the guide to it that Julian Aubourg and I wrote here http://msdn.microsoft.com/en-us/scriptjunkie/hh201955.aspx)
##Option 1: Using jQuery 1.7's $.Callbacks() feature:
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/ | |
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating | |
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel | |
// MIT license | |
(function() { | |
var lastTime = 0; | |
var vendors = ['ms', 'moz', 'webkit', 'o']; |
The official and authoritative source for this document has moved. Please update your bookmarks.
You can still use the comments at the bottom of the page to register comments even for the new official location.
var parser = document.createElement('a'); | |
parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
parser.protocol; // => "http:" | |
parser.hostname; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" | |
parser.host; // => "example.com:3000" |
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc | |
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/ | |
// author: Pawel Kozlowski | |
var myApp = angular.module('myApp', []); | |
//service style, probably the simplest one | |
myApp.service('helloWorldFromService', function() { | |
this.sayHello = function() { | |
return "Hello, World!" |
- https://t.co/1FSFQUfp
- http://t.co/vJzKAzFs
- http://t.co/ncTxB5za
- http://t.co/klb4yNn7
- https://twitter.com/randomfrequency/status/244188321834758145
- https://www.lucidchart.com/
- google drawings (a part of google docs I never noticed somewhow)
- http://t.co/E5uMkjaP
- https://t.co/8w7ob5dc
- Emacs' Artist Mode
var mapLink = "http://maps.google.com/maps?z=12&t=m&q=loc:" + lat + "+" + lon | |
if ($.os.ios && navigator.userAgent.match(/iPhone OS 6_/)) mapLink = "Maps://?q=" + lat + "," + lon | |
if ($.os.android) mapLink = "geo:" + lat + "," + lon + "?z=12&q=" + lat + "," + lon | |
// assumes you have zepto and zepto.detect loaded | |
// also you should use target=_blank on your <a> tags |
(function( window ){ | |
window.watchResize = function( callback ){ | |
var resizing; | |
callback.size = 0; | |
function done() | |
{ | |
var curr_size = window.innerWidth; | |
clearTimeout( resizing ); | |
resizing = null; | |
// only run on a true resize |