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 winston = require('winston'); | |
function getLogger(module) { | |
var path = module.filename.split('/').slice(-2).join('/'); //using filename in log statements | |
return new winston.Logger({ | |
transports : [ | |
new winston.transports.Console({ | |
colorize: true, | |
level: 'debug', |
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
# handle all global ajax errors (we get a response that server is down or something) | |
$(document).ajaxError (e, xhr, settings, exception) -> | |
root.showMessage("error", "Service currently unavailable.") |
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
# setup a 'root' var inside a coffee wrapper that is a reference to the global scope | |
window.App = {} | |
# set a global variable | |
App.config = | |
serviceUrl: "" | |
# set a global function | |
App.hideMessage = -> | |
$("#message").hide() |
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
# get page name | |
pathArray = window.location.pathname.split('/') | |
page = pathArray[pathArray.length - 1].split('.html')[0] |
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
amplify.request | |
resourceId: "login" | |
data: | |
username: @username | |
password: @password | |
success: (data) -> | |
alert "success! " + data.sessionToken | |
error: (message, level) -> |
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
package wookets.json; | |
import org.codehaus.jackson.annotate.JsonTypeInfo; | |
import org.codehaus.jackson.annotate.JsonTypeInfo.As; | |
import org.codehaus.jackson.annotate.JsonTypeInfo.Id; | |
@JsonTypeInfo(use=Id.NAME, include=As.PROPERTY, property="_type", defaultImpl=Object.class) | |
public class JacksonType { | |
} |
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
$scope.$on '$beforeRouteChange', (ngEvent, route) -> | |
console.log 'before: ' + route.template | |
$scope.$on '$afterRouteChange', (ngEvent, route) -> | |
console.log 'after: ' + route.template | |
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
express = require 'express' | |
jsend = require './lib/jsend' | |
module.exports = app = express() | |
app.configure () -> | |
app.use(express.bodyParser()) # standard express http stack | |
app.use(jsend) # attach jsend and error on to every response | |
app.use(app.router) |
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
express = require 'express' | |
error_handler = require './lib/error_handler' | |
module.exports = app = express() | |
app.configure () -> | |
app.use(express.bodyParser()) # standard express http stack | |
app.use(app.router) | |
app.use(error_handler) # attach error handler | |
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
domain = require './server/lib/domain' | |
app.use(domain) # this will setup a domain for us in case an error is thrown that we haven't caught, for some reason this only works up here... |
OlderNewer