If you haven't already set your NPM author info, now you should:
npm set init.author.name "Your Name"
npm set init.author.email "you@example.com"
npm set init.author.url "http://yourblog.com"
npm adduser
| (function() { | |
| var CSSCriticalPath = function(w, d) { | |
| var css = {}; | |
| var pushCSS = function(r) { | |
| // The last selector wins, so over-write | |
| // merging existing css will happen here... | |
| css[r.selectorText] = r.cssText; | |
| }; | |
| var parseTree = function() { |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>Box Shadow</title> | |
| <style> | |
| .box { | |
| height: 150px; | |
| width: 300px; | |
| margin: 20px; |
| //http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#2117523 | |
| function uuid() { | |
| return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { | |
| var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8); | |
| return v.toString(16); | |
| }); | |
| } | |
| var id = uuid(); |
| /** | |
| * 1. utf-8 BOM bytes get translated to \ufeff. Unicode character "Zero width no-break space", can't see them... | |
| * | |
| * Example: Node crashes when trying to parse JSON with BOM as first character | |
| * | |
| * {"Location":{"City":"AMSTERDAM","Country":"NETHERLANDS","CountryCode":"NL","I | |
| * ^ | |
| * SyntaxError: Unexpected token | |
| * at Object.parse (native) | |
| */ |
| <!doctype html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/> | |
| <title>No Zoom for You</title> | |
| </head> | |
| <body> | |
| </body> | |
| </html> |
| function trim(message, maxLength) { | |
| var m = message; | |
| var maxLen = maxLength; | |
| //string is too long, lets trim it and append ... | |
| if (m.length > maxLen) { | |
| var lastSpace = m.lastIndexOf(' '); | |
| //there is no space in the word | |
| if (lastSpace === -1) { | |
| m = m.slice(0, maxLen-3); |
| //http://tamsler.blogspot.com/2012/06/mongodb-connection-from-nodejs-to.html | |
| var mongo = require('mongodb'); | |
| var Server = mongo.Server; | |
| var Db = mongo.Db; | |
| var server = new Server('ds1234.mongolab.com', 12345, {auto_reconnect : true}); | |
| var db = new Db('db-name', server); | |
| db.open(function(err, client) { |
| var style = document.createElement('style'), | |
| styleContent = 'body{background-color: red;}'; | |
| //IE 8 and below | |
| if (style.styleSheet) { | |
| style.styleSheet.cssText = styleContent; | |
| } | |
| else { | |
| style.innerHTML = styleContent; | |
| } |