Skip to content

Instantly share code, notes, and snippets.

View Hogent's full-sized avatar

Karel Van Achte Hogent

View GitHub Profile
// routes/notes.js
...
var uristring = process.env.MONGOHQ_URL || "mongodb://localhost/notes";
...
// server.js
...
app.configure(function () {
app.set('port', process.env.VCAP_APP_PORT || 3000);
}
<link href="apple-touch-startup-image-iphone.png" media="(device-width: 320px)" rel="apple-touch-startup-image">
<link href="apple-touch-startup-image-iphone-retina.png" media="(device-width: 320px) and (-webkit-device-pixel-ratio: 2)" rel="apple-touch-startup-image">
<link href="apple-touch-startup-image-ipad-portrait.png" media="(device-width: 768px) and (orientation: portrait)" rel="apple-touch-startup-image">
<link href="apple-touch-startup-image-ipad-landscape.png" media="(device-width: 768px) and (orientation: landscape)" rel="apple-touch-startup-image">
<link href="apple-touch-startup-image-ipad-portrait-retina.png" media="(device-width: 1536px) and (orientation: portrait) and (-webkit-device-pixel-ratio: 2)" rel="apple-touch-startup-image">
<link href="apple-touch-startup-image-ipad-landscape-retina.png" media="(device-width: 1536px) and (orientation: landscape) and (-webkit-device-pixel-ratio: 2)" rel="apple-touch-startup-image">
<link rel="apple-touch-icon-precomposed" href="apple-touch-icon-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="apple-touch-icon-72x72-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="apple-touch-icon-114x114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="apple-touch-icon-144x144-precomposed.png">
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
# notesapp.appcache
...
lib/backbone.localstorage.js
lib/backbone.localcache.js
...
// lib/backbone.localcache.js
Backbone.serverSync = Backbone.sync;
Backbone.onLine = function () {
if (navigator.onLine) {
console.log('Online');
return true;
} else {
console.log('Offline');
return false;
// routes/notes.js
...
exports.updateNote = function(req, res) {
var id = req.params.id;
Note.findById(id, function (err, doc){
if(!err) {
doc.title = req.body.title;
doc.note = req.body.note;
doc.save(function(err, result) {
if (err){
<!-- index.html -->
...
<script src="lib/backbone-min.js"></script>
<script src="lib/backbone.localcache.js"></script>
<script src="lib/backbone.localstorage.js"></script>
...
// lib/backbone.localcache.js
Backbone.serverSync = Backbone.sync;
...