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
require './lib/jsend' |
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... |
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
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
# this gist will use the schema and the val of a property to determine if we should normalize the incoming reference | |
Type = mongoose.model(resource._type) | |
# normalize references, since this seems to be broken... | |
for prop, val of resource | |
if Type.schema.path(prop)?.options?.ref | |
if utils.type(val) is 'object' then resource[prop] = val._id else resource[prop] = val | |
else if Type.schema.path(prop)?.options?.type?[0]?.ref | |
newArray = [] |
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
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
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
# 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
# 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() |