Pros:
- Shared login without giving out your password. (Not our problem)
- "State-ful" security without cookies or HTTPS (sort-of)
- Ability to de-authorize
Cons:
// Version 0 | |
var express = require('express'); | |
var contacts = require('../control/contacts') | |
var customAuth = require('../lib/customAuth') | |
var app = module.exports = express(); | |
// middleware that only applies to this version of the API | |
app.use(customAuth()); | |
// normal routes, all will be pre-fixed by the version |
// define the versions | |
var VERSIONS = {'Pre-Production': '/v0', 'Version 1': '/v1'}; | |
// route to display versions | |
app.get('/', function(req, res) { | |
res.json(VERSIONS); | |
}) | |
// versioned routes go in the routes/ directory | |
// import the routes |
// easy way to get current pages HTML | |
$.get('#', function(html) { | |
// emulate form post | |
var formData = new FormData(); | |
formData.append('out', 'json'); | |
formData.append('content', html); | |
// make ajax call | |
$.ajax({ |
init: function() { | |
var html = "<!doctype html><html lang='en'>" + $('html').html() + "</html>"; | |
var validatorURL = "http://html5.validator.nu/?out=json"; | |
$.post({url: validatorURL, headers: {"Content-type": "text/html"}, body: html}, | |
function(err, res, body) { | |
alert('response: '+res); | |
if (err) alert(err); | |
var data = JSON.parse(body); | |
console.log(data); | |
}); |
git_prompt () | |
{ | |
if ! git rev-parse --git-dir > /dev/null 2>&1; then | |
return 0 | |
fi | |
git_branch=$(git branch 2>/dev/null| sed -n '/^\*/s/^\* //p') | |
if git diff --quiet 2>/dev/null >&2; then | |
git_color="${c_git_clean}" |
~/Sites/no.desk [master] $ jitsu deploy | |
info: Welcome to Nodejitsu xjamundx | |
info: It worked if it ends with Nodejitsu ok | |
info: Executing command deploy | |
info: Analyzing your application dependencies in app.js | |
info: Creating snapshot 0.0.3 | |
error: Error running command deploy | |
error: Nodejitsu Error (500): Internal Server Error | |
error: npm WARN package.json no.desk@0.0.3 No README.md file found! | |
npm http GET http://nj-npm.irisnpm.com/express/2.5.8 |
SVG is arguably going to be the main image format of the modern web. I recently wrote an article for Safari Books Online called SVG Icons for New Devices that covers some of the basics of dealing with SVG. This article covers more the pain points of using SVG in production and as it turns out there are many.
Here's how you link to your amazing vector image.
<img src="/images/logo.svg">
// HTML5 Validator using http://about.validator.nu/#api | |
exports.validate = function(data, done) { | |
var url = data.url | |
var html = data.html | |
if (!url && !html) return done(new Error("You forget a URL for the validator")) | |
if (html) return complete(html) | |
utils.printTitle("HTML5 Validator") | |
request(url, function(err, res, body) { |