Skip to content

Instantly share code, notes, and snippets.

class Singleton
# We can make private variables!
instance = null
# Static singleton retriever/loader
@get: ->
if not @instance?
instance = new @
instance.init()

#How you get Sail.js running on Openshift#

This instruction is tested with:

  • Sails.js v0.9.16
  • Node.js 0.10 on Openshift ( 05 May 2014)

###1) package.json

If you use the package.json build by sails new Projectname than you have to add a few fields for openshift – so the server can start you app automatically. Sails uses Grunt to build minify css/js and so on. Openshift dont have grunt installed so you have to add this also.

// make a module in node_modules named 'my-validation-utils'. create a index.js file there. and put the following content there:
var user = {
email:{
required:'Email Required',
email:'Should be an email'
},
name:{
required:'name required'
}
###
Detect browser name, version and OS
@ref: http://www.quirksmode.org/js/detect.html
###
class Detector
constructor: ->
@browser = @searchString(Detector.dataBrowser) or "An unknown browser"
@version = @searchVersion(navigator.userAgent) or @searchVersion(navigator.appVersion) or "An unknown browser"
@OS = @searchString(Detector.dataOS) or "An unknown OS"