CoffeeScript is a little language that compiles into JavaScript. Underneath all of those embarrassing braces and semicolons, JavaScript has always had a gorgeous object model at its heart. CoffeeScript is an attempt to expose the good parts of JavaScript in a simple way.
0
votes
0answers
4 views
grunt-contrib-handlebars - Output is different than when I run the handlebars npm task
Thank you in advance for your time and help.
I'm trying to precompile handlebars (.hbs) templates using grunt-contrib-handlebars
When I run the run task I end up with this:
this["JST"] = ...
0
votes
1answer
22 views
Better way to check bounds
I am checking to see in an object is outside the bounds of a box. If it is outside the bounds of the box, then I put it back in.
if position.left < dot_radius
dot.css 'left', dot_radius
if ...
0
votes
1answer
23 views
Programmatically modify existing mongo document
Resolved, the issue was with the PUT request , I had to specify the header properly and go on with one at a time.
curl -X PUT -H "Accept: application/json" -d "prenom=Maxwell" ...
0
votes
1answer
11 views
Defining Meteor collections when using coffeescript; ReferenceError saying that collection not defined
I am using coffeescript. I have read on the web that when using coffeescript with Meteor, the global variables, such as collections,
should be defined using @. I have done this but I am still getting ...
1
vote
1answer
22 views
Mongodb multiple criteria , return wrong result
I use mongodb in node.js with the mongo-native package and im trying to exclude a document which contains the value 1 in a field called "archive", and I keep getting results that are not appropriate.
...
0
votes
0answers
10 views
keyup binding and updateAttribute in spine.js only grabbing first few characters of string
I'm working with a spine.js application and a django restful backend. A simple binding for a keyup event on an input fires off a function in my controller that tries to updateAttribute a certain model ...
0
votes
0answers
11 views
Using Karma-runner with AngularJS, Jasmine, CoffeScript
My app besides jRuby/Rails uses AngularJS, CoffeScript. I'd like to test my javascript with Jasmine and run it with Karma, but I get an error stating that my Angular module is nowhere defined. What ...
0
votes
1answer
16 views
Rails javascript becomes one line [duplicate]
Javascript and coffeescript files in my Rails app are rendered with proper spacing and indentation on my local server. However, once deployed to a remote server, they render as a single line with ...
0
votes
2answers
18 views
Mongoosejs can't query with findById
I have a meteor application saving stuff to mongodb and I have an api I wish to make and expose via REST.
express = require 'express'
mongoose = require 'mongoose'
app = express()
mongoose.connect ...
0
votes
0answers
17 views
accessing uploaded file.body in backbone +rails
I'm making a simple application that takes logfiles and shows the most recently added lines depending on content (server requests vs other data) and i'm using backbone.js and rails.
I want to get ...
1
vote
1answer
33 views
Mouse up event does not appear to work after several clicks on element
I am trying to detect start/drop drags etc in an element. Sometimes these events seem not to be triggered. The source is on JSFiddle. Try holding down mouse in the orange bar and dragging to create ...
0
votes
1answer
11 views
Return jquery-ui widget from function
I have a requirement wherein i need to return a widget instance from a coffeescript class method.
class Chart
constructor: (@chartData) ->
getChartType: ->
@chartData.type
...
0
votes
1answer
21 views
Testing toUpperCase with Jasmine
I'm trying to test if the String.toUpperCase method is called with Jasmine. However whenever I try it just returns
toUpperCase() method does not exist
here is my jasmine test:
...
0
votes
1answer
8 views
How to write jasmine test to check update
I'm trying to write jasmine test to check is view changing time or not
it 'ticks the time', ->
@time = parseInt($('#timer h1').text())
setTimeout (->
@after = parseInt($('#timer ...
0
votes
0answers
17 views
info: [APP config] Database initialized: MongoError: auth fails
I am trying to connect my node.js application on AppFog to mongodb and get this error:
info: [APP config] Database initialized: MongoError: auth fails
here is my code utils/dbconnect.coffee;
# ...
0
votes
2answers
26 views
JQuery animate() doesn't work in FF or Opera
I have a short piece of CoffeeScript and this code scrolls my page to top with animation. It works in Chromium but there is some issue in FF or Opera.
$('#scrolltop').click ->
...
0
votes
1answer
36 views
Environment detection: node.js or browser
I'm developping a JS-app that needs to work both on the client side and the server side (in Javascript on a browser and in Node.js), and I would like to be able to reuse the parts of the code that are ...
0
votes
2answers
15 views
How to mock up Date object?
I'm trying to write jasmine test for this method
currentTime: ->
Math.round(new Date().getTime()/1000)
In the test trying this:
@date = new Date()
@date = Date(@date.getTime() + 70)
...
1
vote
1answer
20 views
XSS Problems with Ajax GET Request
I have the following coffee script which performs some sort of login:
signIn: (url, completion) ->
$.ajax
method: 'GET'
url: url
dataType: 'json'
error: (jqXHR, status, ...
1
vote
1answer
30 views
Bakcbone events not firing as expected
I initialise the View:
notifications = new tvr.notifications.Collection
notifications.fetch()
new tvr.notifications.View collection:notifications
Im adding "notifications" to a backbone collection:
...
7
votes
1answer
45 views
Why does CoffeeScript compile a for loop in this way?
This piece of CoffeeScript:
for i in [1..10]
console.log i
is compiled to:
for (i = _i = 1; _i <= 10; i = ++_i) {
console.log(i);
}
I don't understand why it doesn't just use an i. Any ...
0
votes
1answer
13 views
How to debug CoffeeScript using the generated source maps?
How to debug CoffeeScript using the generated source maps? Do I need to include the map file? What else do I need to do? I'm currently including both the compiled JS file and the map file, but my ...
0
votes
0answers
6 views
hubot-scripts.json throwing error
I've successfully got Hubot running on my Windows server. Unfortunately, I'm trying to install some scripts, and added the following (as an example to my) hubot-scripts.json file:
...
1
vote
1answer
17 views
Performance implications of using :coffescript filter inside HAML templates?
So HAML 4 includes a coffeescript filter, which allows us coffee-loving rails people to do neat things like this:
- word = "Awesome."
:coffeescript
$ ->
alert "No semicolons! #{word}"
My ...
1
vote
1answer
31 views
jQuery each() finish outer function after the end of iterations
I have a function that needs to loop through all the select tags and the cheackboxes, take their name and value and then assign it to the "data" object. Here's the code
data_query:->
data ...
0
votes
1answer
23 views
d3.js / CoffeeScript: Access execution context (this) of both class and path in mouseover
I'm using a d3.js Streamgraph in a CoffeeScript class. I've adapted it so that on mouseover the color of the path changes and a tooltip appears.
Now I want to pull out some of the tooltip logic into ...
0
votes
0answers
27 views
Clicking on a web element using coffee script
I'm a newbie and I'm trying to write integration test using coffee.
This is how my coffee file looks like
casper.start()
casper.open 'http://localhost:4000/my_project/?mylink',
headers:
...
0
votes
1answer
29 views
Trouble with JSON.parse
I have a string which I would like to turn into an object so I can pass it to mongoose
string = "{setting: {foo: false}}"
options = JSON.parse(string)
but this is giving me this error
...
1
vote
0answers
25 views
FIlepicker upload_widget shows two button
Hey I am a newbie on the meteor and currently trying to upload the image and I found filepicker.I have used jade-handlebars and coffeescript packages in my project.
Here is the code
test.coffee
...
0
votes
1answer
24 views
Debug CoffeeScript with IntelliJ
I'm starting a fresh web project and the last part of my configuration is to enable debugging for my CoffeeScripts files.
The whole project is build using a Grunt task that compile coffee to js and ...
-2
votes
0answers
36 views
How to connect Batman.js to an API [on hold]
I am quite new to client side JS frameworks, so bare with me.
I know Batman.js allows you to store data in a backend through Batman.RestStorage but my question is, how do you connect a Batman.js ...
0
votes
1answer
62 views
Empty Object in Coffeescript
I want to make an if statement to check if an object is an empty object or not.
By empty string I mean if I do console.log(object) it prints out {}.
How do I do this?
0
votes
1answer
41 views
Update Common AngularJS HTTP Headers at Runtime
How can I update the common HTTP headers at runtime from an AngularJS controller, e.g. $httpProvider.defaults.headers.common['Authorization']? It seems $httpProvider can only be accessed from a config ...
0
votes
1answer
24 views
Jquery change event not working in coffeescript
hey guys I have just try to implement my change event in coffeescript but its not working. Will any help me
$('#subscription_id").on "change", ->
console.log "Hello"
outputs = $(this).val()
if ...
-1
votes
1answer
46 views
Hyperlink in Javascript / Coffeescript
I saw this on stackoverflow which works
a = document.createElement("a")
linkText = document.createTextNode("my title text")
a.appendChild linkText
a.title = "my title text"
a.href = ...
0
votes
1answer
27 views
Coffeescript doing list comprehension object
Why coffeescript doesn't return object keys but instead treats value of x as string 'x' ?
coffee> a = { test: '0', super: '1' }
coffee> x for x,y of a
[ 'test', 'super' ]
coffee> {x:y} ...
0
votes
0answers
37 views
how can I parse an object definition like in coffeescript
let's say we have this in cofeescript
obj =
one:
one: 11
two: 12
two: 2
three:
four: 34
and that compiles to
var obj = {
one: { one: 11, two: 12 },
two: 2,
three: { four: 34 }
...
0
votes
0answers
61 views
Grunt: Watch multiple files, compile only changed - livereload breaks?
I am new to Grunt and to Javascript/Coffeescript altogether.
We are using Grunt in a rather large project with hundreds of .coffee - files. Since Grunt compiles all coffeefiles (although only one ...
0
votes
2answers
44 views
Chaining Promises in Coffeescript
Is there a way to chain Promises together in Coffeescript. For example, consider the following javascript code,
return $.getJSON('/api/post.json')
.then(function(response) {
// do something
...
0
votes
1answer
30 views
Hide/show particular element on click with AngularJS
I have an HTML table with many rows in it and want to hide a row when the user clicks the delete button for that particular row. I'm having trouble doing it with Angular and the ng-hide directive.
...
1
vote
1answer
59 views
jQuery returns status code 404 instead of 403
I'm having trouble with jquery 2.0.2 and getting it to identify a HTTP 403 status code when calling my API (hosted on the same machine, just like the static web page the call is coming from). From a ...
-1
votes
0answers
24 views
Javascript Link() Method in Coffee Script [on hold]
I want to display a link from coffeescript, I'm using
(pd["name"]).link pd["url"]
which I found here http://www.w3schools.com/jsref/jsref_link.asp
but it actually shows the url and not the string
...
-1
votes
2answers
40 views
Function to group equivalent elements of an array
Is there a javascript or coffeescript function (or maybe an extension of the underscore groupBy function) that receives as parameters an array and an equivalence comparator (a boolean function with ...
0
votes
1answer
31 views
Calling CoffeeScript file for html form validation using external reference
I am a beginner with CoffeeScript doing my first html validation.
I can't get my html form validated.
The code goes like this:
<script type="text/coffeescript">
usernameValidate = ->
x = ...
0
votes
1answer
18 views
Rails controller.js.coffee not showing up
I just started using Rails.
Inside assets javascripts there's a file (welcome.js.coffee) that says
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will ...
1
vote
0answers
30 views
Running an open-source project on heroku
I am trying to run HabitRPG on Heroku because I don't have root access in the machines in my school's library to install the dependencies.
The wiki to HabitRPG gives instructions on how to run it on ...
0
votes
0answers
39 views
Backbone events not firing
So I think I've narrowed this down to my el element not being defined. Here's where I'm newing the view -
class TableManager
tables : {}
tableViews :{}
nextId : 0
rootEl : 'body'
...
-1
votes
0answers
52 views
Why doesn't underscore.js provide methods for “adding” to arrays and “updating” objects? [closed]
Here's some background of me: I went from Haskell to Clojure to CoffeeScript/JavaScript and now I'm trying to make my CoffeeScript/JavaScript code more functional. I've discovered underscore.js and ...
0
votes
1answer
25 views
Simple Q Promises Node Example
I'm trying to wrap my head around the Q library/promises in general so I can implement it in my node application, but I'm having trouble finding something concise and specific enough to quickly get ...
2
votes
2answers
55 views
Why do I need to angular.bootstrap even when I declare ng-app=“MyApp” in JSFiddle
I do not truly understand why it is necessary to do an angular.bootsrap document, ['MyApp'] at the end of my CoffeeScript code that manages the module and controllers in the following test ...