Skip to content

Instantly share code, notes, and snippets.

@ndarville
ndarville / business-models.md
Last active January 13, 2024 17:27
Business models based on the compiled list at http://news.ycombinator.com/item?id=4924647. I find the link very hard to browse, so I made a simple version in Markdown instead.

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
$ = jQuery
TIMEOUT = 20000
lastTime = (new Date()).getTime()
setInterval ->
currentTime = (new Date()).getTime()
# If timeout was paused (ignoring small
# variations) then trigger the 'wake' event
if currentTime > (lastTime + TIMEOUT + 2000)
@Tomalak
Tomalak / isNodeList.js
Last active February 24, 2021 20:36
A function to test if a JavaScript object is a DOM NodeList. This is designed to work across all browser implementations. StackOverflow question reference http://stackoverflow.com/a/7238344/18771.
/* Released under the MIT License in 2014. http://opensource.org/licenses/mit-license */
function isNodeList(nodes) {
var stringRepr = Object.prototype.toString.call(nodes);
return typeof nodes === 'object' &&
/^\[object (HTMLCollection|NodeList|Object)\]$/.test(stringRepr) &&
nodes.hasOwnProperty('length') &&
(nodes.length === 0 || (typeof nodes[0] === "object" && nodes[0].nodeType > 0));
}
@julianshapiro
julianshapiro / IE.js
Last active August 2, 2017 01:02
Future-Proof IE Version Detection Without User Agent Sniffing
var IE = (function() {
if (document.documentMode) {
return document.documentMode;
} else {
for (var i = 7; i > 4; i--) {
var div = document.createElement("div");
div.innerHTML = "<!--[if IE " + i + "]><span></span><![endif]-->";
if (div.getElementsByTagName("span").length) {