Skip to content

Instantly share code, notes, and snippets.

for a blog index

Tower.router.root[methodName] = Ember.State.transitionTo("blogs.index")

{{action blogsIndex href="true"}}

clicking the link would fire Tower.router.root['blogsIndex']

then the url changes

{view App.InlineSelect contentBinding="this.content" optionLabelPath="content.label" optionValuePath="content.value" optionItems="$20,000 - $50,000|$50,000 - $80,000|$80,000 - $100,000|$100,000 - $150,000|$200,000 - $300,000"}}
App.InlineSelect = Ember.Select.extend
  optionItems: null
  content: ( ->
    content = []
 oArray = @get('optionItems').split("|")
/usr/share/nginx/node/kohv4/node_modules/tower/lib/tower-application/server/application.js:117
return app.use(express[middleware].apply(express, args));
^
TypeError: Cannot call method 'apply' of undefined
at Tower.Application.Application.reopen.use (/usr/share/nginx/node/kohv4/node_modules/tower/lib/tower-application/server/application.js:117:44)
at null.<anonymous> (/usr/share/nginx/node/kohv4/app/config/server/bootstrap.coffee:9:12)
at Tower.Application.Application.reopen.stack (/usr/share/nginx/node/kohv4/node_modules/tower/lib/tower-application/server/application.js:179:16)
at Tower.Application.Application.reopen.initialize.initializer (/usr/share/nginx/node/kohv4/node_modules/tower/lib/tower-application/server/application.js:91:19)
at Tower.Application.Application.reopen.configureStores (/usr/share/nginx/node/kohv4/node_modules/tower/lib/tower-application/server/application.js:166:27)
at _.extend.parallel (/usr/share/nginx/node/k
App.configure ->
@use 'favicon', Tower.publicPath + '/favicon.png'
@use 'static', Tower.publicPath, maxAge: Tower.publicCacheDuration
@use 'profiler' if Tower.env != 'production'
@use 'logger'
@use 'query'
@use 'cookieParser', Tower.config.session.key
@use 'session', secret: Tower.config.session.secret, cookie: {domain: Tower.config.session.cookie.domain}
@use 'bodyParser', uploadDir: './public/uploads'
#@use 'csrf'
justin-dev:kohv4 justin$ find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'
.
|____.git
| |____branches
| |____COMMIT_EDITMSG
| |____config
| |____description
| |____FETCH_HEAD
| |____HEAD
| |____hooks
justin-dev:app justin$ find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'
.
|____client
| |____config
| | |____bootstrap.coffee
| |____controllers
| | |____applicationController.coffee
| | |____blogsController.coffee
| | |____contactsController.coffee
| | |____culturesController.coffee
@j-mcnally
j-mcnally / gist:3786217
Created September 26, 2012 05:11
The call that killed my server
Request URL:http://localhost:3000/api/foursquare
Request Headersview source
Accept:application/json, text/javascript, */*; q=0.01
Cache-Control:no-cache
Pragma:no-cache
Referer:http://localhost:3000/contact
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.46 Safari/536.5
X-Requested-With:XMLHttpRequest
@j-mcnally
j-mcnally / fileHandler.js
Created October 1, 2012 17:13
fileHandler.js
module.exports = function fileHandler(){
return function fileHandler(req, res, next){
if (req.form) {
req.form.complete(function(err, fields, files){
var flatFiles = [];
for(var key in files) {
if (files[key] instanceof Array) {
if Rails.env.development?
Rails.application.assets.logger = Logger.new('/dev/null')
Rails::Rack::Logger.class_eval do
def call_with_quiet_assets(env)
previous_level = Rails.logger.level
Rails.logger.level = Logger::ERROR if env['PATH_INFO'] =~ %r{^/assets/}
call_without_quiet_assets(env)
ensure
Rails.logger.level = previous_level
end
@j-mcnally
j-mcnally / gist:4665803
Created January 29, 2013 17:00
HTTP BASIC AUTH FOR API ACCESS
before_filter :check_auth
def check_auth
authenticate_or_request_with_http_basic do |username,password|
resource = User.find_by_email(username)
if resource.valid_password?(password)
sign_in :user, resource
end
end