Having both Node.js and io.js installed with NVM was giving me a load of problems, mainly with npm. So I uninstalled NVM and manage Node.js and io.js with homebrew.
Heres how.
Install Node.js and io.js
$ brew install node
$ brew install iojs
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <!-- Make a DNS handshake with a foreign domain, so the connection goes faster when the user eventually needs to access it. This works well for loading in assets (like images) from another domain, or a JavaScript library from a CDN. --> | |
| <link rel="dns-prefetch" href="//ajax.googleapis.com" /> | |
| <link rel="dns-prefetch" href="//s3.amazonaws.com" /> | |
| <!-- Make sure the latest version of IE is used --> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> |
| <!doctype html> | |
| <html lang="en"><!-- or "de" --> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <title>Style links by hreflang</title> | |
| </head> | |
| <body> | |
| <!-- this link will have "de" appended --> | |
| <a href="http://petergrassberger.at/" hreflang="de">German Site</a> | |
| <!-- this link will stay the same because the site lang is "en" --> |
Having both Node.js and io.js installed with NVM was giving me a load of problems, mainly with npm. So I uninstalled NVM and manage Node.js and io.js with homebrew.
Heres how.
Install Node.js and io.js
$ brew install node
$ brew install iojs
| # Change YOUR_TOKEN to your prerender token and uncomment that line if you want to cache urls and view crawl stats | |
| # Change http://example.com (at the end of the last RewriteRule) to your website url | |
| <IfModule mod_headers.c> | |
| #RequestHeader set X-Prerender-Token "YOUR_TOKEN" | |
| </IfModule> | |
| <IfModule mod_rewrite.c> | |
| RewriteEngine On |
| background: linear-gradient(270deg, #c9dcd7, #80a097, #588f7f, #164034, #8b8b2a, #4f4f19, #c597dc, #8d2887, #3faede, #6b1631, #a5697c, #ebe7e8, #668d4a, #75d82d, #2a4417, #c76921); | |
| background-size: 3200% 3200%; | |
| -webkit-animation: AnimationName 59s ease infinite; | |
| -moz-animation: AnimationName 59s ease infinite; | |
| -o-animation: AnimationName 59s ease infinite; | |
| animation: AnimationName 59s ease infinite; | |
| @-webkit-keyframes AnimationName { | |
| 0%{background-position:0% 50%} | |
| 50%{background-position:100% 50%} | |
| 100%{background-position:0% 50%} |
Lately there's been some discourse on so-called module shaming1 — which can go both ways — with lots of confusion and misinformation all around.
So let's get to the meat of the topic: why would anyone publish a single-function module?
It might seem odd to have a module with just a single function (examples: clamp, lerp, is-clockwise, xtend, point-in-polygon). Sometimes your tests and documentation are longer than the function itself. Let's examine some of the benefits to this approach...
| // Node.js CheatSheet. | |
| // Download the Node.js source code or a pre-built installer for your platform, and start developing today. | |
| // Download: http://nodejs.org/download/ | |
| // More: http://nodejs.org/api/all.html | |
| // 0. Synopsis. | |
| // http://nodejs.org/api/synopsis.html |
| # NPM CheatSheet. | |
| # Super easy intall: npm comes with node now. | |
| # To create your own npm package: https://www.npmjs.org/doc/misc/npm-developers.html | |
| # More: https://www.npmjs.org/doc/ | |
| # 1. NPM Command Lines. | |
| # Local mode is the default. | |
| # Use --global or -g on any command to operate in global mode instead. |
The idea is to have nginx installed and node installed. I will extend this gist to include how to install those as well, but at the moment, the following assumes you have nginx 0.7.62 and node 0.2.3 installed on a Linux distro (I used Ubuntu).
In a nutshell,
So for example, www.foo.com request comes and your css, js, and images get served thru nginx while everything else (the request for say index.html or "/") gets served through node.
| <?php | |
| /* | |
| GeoRSS formatted output for Google Maps | |
| Authors: Alastair Mucklow, Chris Toppon | |
| */ | |
| //header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true); | |
| //$more = 1; | |
| echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'" standalone="yes"?'.'>'; ?> |