I was looking for two clean,
tiny and elegant element-to-xpath functions
producing short and complete xpaths like
id("main")/ul/li[3]
or
/html/body/ul/li[3]
for a given element,
and figured I'd just craft my own.
Take a website with some kind of notifications system showing the user a count of their unread notifications or similar. (Facebook, Google+, GMail et c.)
Now perform an action in one browser tab, that changes or clears the count. Does this immediately propagate to all other tabs you have open on the site?
If not – this example is for you!
As it happens, this is really easy to do in
(function(){function e(e,t){try{for(var n in t)Object.defineProperty(e.prototype,n,{value:t[n],enumerable:!1})}catch(r){e.prototype=t}}function t(e){var t=-1,n=e.length,r=[];while(++t<n)r.push(e[t]);return r}function n(e){return Array.prototype.slice.call(e)}function r(){}function i(e){return e}function s(){return this}function o(){return!0}function u(e){return typeof e=="function"?e:function(){return e}}function a(e,t,n){return function(){var r=n.apply(t,arguments);return arguments.length?e:r}}function f(e){return e!=null&&!isNaN(e)}function l(e){return e.length}function c(e){return e==null}function h(e){return e.trim().replace(/\s+/g," ")}function p(e){var t=1;while(e*t%1)t*=10;return t}function d(){}function v(e){function t(){var t=n,r=-1,i=t.length,s;while(++r<i)(s=t[r].on)&&s.apply(this,arguments);return e}var n=[],i=new r;return t.on=function(t,r){var s=i.get(t),o;return arguments.length<2?s&&s.on:(s&&(s.on=null,n=n.slice(0,o=n.indexOf(s)).concat(n.slice(o+1)),i.remove(t)),r&&n.push(i.set(t,{on:r})),e)} |
I just want the stickers. :-) (Original)
I decided to try that free month of HBO Now this weekend. It didn't have more than 377 movies when I checked, and it had no way of guessing at what I'd like. Fortunately for me, I have an old Movielens account, which has a fair idea of things I like, so I figured I'd cross-reference the HBO inventory with their guesses at what I'd like, given what I've seen and liked or disliked.
<div id="sleep"></div> |
Hourly solar analemmas (ignoring daylight savings time) as seen from anywhere in the world in 2014.