This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* global define:true */ | |
define([ | |
"backbone" | |
], function(Backbone) { | |
"use strict"; | |
// Extend Backbone's Model to override the sync function. Doing so allows us | |
// to get a hook into how the errors are handled. Here we can check if the | |
// response code is unauthorized, and if so, navigate to the login page | |
return Backbone.Model.extend({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require("express"), | |
fs = require("fs"), | |
cons = require("consolidate"), | |
app = express(); | |
// configure the app (all environments) | |
app.configure(function() { | |
// read the port from the environment, else set to 3000 | |
app.set("port", process.env.PORT || 3000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To list the Java versions installed on your machine (note the big V): | |
/usr/libexec/java_home -V | |
To change the version of Java (note the small v): | |
export JAVA_HOME=`/usr/libexec/java_home -v 1.7` | |
export JAVA_HOME=`/usr/libexec/java_home -v 1.6` | |
The default JAVA_HOME is: | |
export JAVA_HOME=/Library/Java/Home |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE project> | |
<Context> | |
<Resource name="jdbc/web" | |
auth="Container" | |
type="javax.sql.DataSource" | |
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" | |
testWhileIdle="true" | |
testOnBorrow="true" | |
testOnReturn="false" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* MODEL | |
*/ | |
return Backbone.Model.extend({ | |
urlRoot: "/api/resource", | |
defaults: { | |
id: null, | |
name: null, | |
num: null, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* MODEL CODE | |
*/ | |
formSubmit: function(ev) { | |
var formValues; | |
ev.preventDefault(); | |
formValues = this.$("form").serializeObject(); | |
this.model.save(formValues); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* CLIENT SIDE CODE | |
*/ | |
// perform a file upload | |
file = this.$("input[name='image-file']").prop("files")[0]; | |
formData = new FormData(); | |
formData.append("image", file); | |
$.ajax({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var app, routingProxy, apiProxy, proxyHost, proxyPort; | |
var express = require("express"), | |
httpProxy = require("http-proxy"), | |
fs = require("fs"); | |
// Should we dynamically define these by environment? | |
proxyHost = "localhost"; | |
proxyPort = "8080"; | |
// Create and define the Express server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function (grunt) { | |
grunt.loadNpmTasks('grunt-contrib-clean'); | |
grunt.loadNpmTasks("grunt-mocha-test"); | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
clean: ["test-reports.xml"], | |
mochaTest: { | |
"test": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return Backbone.View.extend({ | |
... | |
events: { | |
"click #submit-button": "submit" | |
}, | |
initialize: function() { | |
this.model.on( "sync", this.syncSuccess, this ); |