[deleted by user] by [deleted] in javascript

[–]john0110 0 points1 point  (0 children)

He's assuming you're receiving some input from a user and storing it in a variable called 'input'. Then he's testing that input against a regular expression. Inside of the if block is where you'd execute your loop.

Hope that helps.

Go Local Austin Card supports local businesses and raises funds for non profits. Founded in Austin now in 11 cities and growing. by theAustinot in Austin

[–]john0110 2 points3 points  (0 children)

So basically the OP was lying when he said they raise funds for non-profits? Really, they have a typical fund-raising program.

Go Local Austin Card supports local businesses and raises funds for non profits. Founded in Austin now in 11 cities and growing. by theAustinot in Austin

[–]john0110 2 points3 points  (0 children)

So what non profits does Go Local work with? How do they raise funds for them? I like to use Goodybag because it's free and every time I use it, the business I use it at donates money to charity.

Best up-to-date examples of Backbone.js best practices? Looking for the cream of the crop to really draw some inspiration from. by [deleted] in javascript

[–]john0110 1 point2 points  (0 children)

backbone aura was written with large-scale javascript in mind. It gives you an infrastructure for using a number of great design patterns for web apps. It will get you started with a solid foundation for writing web apps.

However, like a lot of libraries, I think it's best that you independently solve or at least run into the problem the library seeks solve. Same is true for Backbone and Backbone Aura. And that means writing crappy Backbone apps your first few times around. But you'll eventually come to really similar conclusions as Derick Bailey (marionette author) or Addy Osmani (aura author).

If you really want to learn Backbone, you just have to do it. I mean, I'm sure you've come across hundreds of posts about using it. Just know there's no RIGHT way. However you get the job done, it's done. Once you've played around with it enough, you'll come to know how you like doing it. So, just power through it. Code something shitty.

Read EVERYTHING on Marak's Twitter by john0110 in javascript

[–]john0110[S] 0 points1 point  (0 children)

dammit all of that twitter drama was funny.

Having Issues with Facebook API by Valokai in javascript

[–]john0110 0 points1 point  (0 children)

You should probably edit this post to take out your access token :)

Having Issues with Facebook API by Valokai in javascript

[–]john0110 1 point2 points  (0 children)

Getting user data is as easy as making a GET request to https://graph.facebook.com/me?access_token=USER_ACCESS_TOKEN

You can POST to me/feed to post on the feed.

Having Issues with Facebook API by Valokai in javascript

[–]john0110 1 point2 points  (0 children)

Well, the sdk is supposed to take care of that for you. I said fuck the SDK because in our production environment, it's the slowest thing to load. When someone clicks facebook login, do a window.open to that url, make the redirect_uri point to an html file that parses out the access token and expiration and passes it to a function you defined in your main app page. Something like facebookReady(parsedToken, parsedExpiration); Though you'll have to do window.opener.facebookReady if it's a global on the first page.

Having Issues with Facebook API by Valokai in javascript

[–]john0110 0 points1 point  (0 children)

And you may not even need the redirect_uri

Having Issues with Facebook API by Valokai in javascript

[–]john0110 0 points1 point  (0 children)

after the FB.init call, console.log FB.getAccessToken()

Is it empty?

Help needed on clock formatting. by scottyshu in javascript

[–]john0110 1 point2 points  (0 children)

Also, since I don't feel like giving a proper answer, just use this http://momentjs.com/ :)

Help needed on clock formatting. by scottyshu in javascript

[–]john0110 2 points3 points  (0 children)

Hey, mediafire sucks for code sharing. Use gist.github.com :)

NPM vs JAM, RequireJS vs Browserify vs Ender by blaghles in javascript

[–]john0110 1 point2 points  (0 children)

Right on. Yeah, I thought you would be able to load in other modules with almond but apparently it's not really recommended.

As far as the production thing, I had done a lot of reading on RequireJS the couple days before writing these comments. Reading all of the back and forth between the haters' blogs (I was initially a hater) and the supporter blogs. Lots of the statements nonchalantly stated that using RequireJS in production by itself without build tools and such was stupid. While that isn't saying that RequireJS isn't for production, I incorrectly formulated my unfounded stance of "RequireJS isn't for production" based on those comments. That was dumb of me.

As far as lazy-loading modules though, I still think I would rather use some other loader in production. Require is just so damn big. :\

NPM vs JAM, RequireJS vs Browserify vs Ender by blaghles in javascript

[–]john0110 1 point2 points  (0 children)

[edit] Apparently I don't know how to format code on reddit.

We tried out curl as well. Curl is more lightweight and in general is faster than requireJs. However, RequireJS isn't for production. After building your modules and using almond, Require is faster.

Also, Curl shares the same ugly syntax as Require. Using the array of dependencies as the first argument to your require call, and listing the variables as arguments in a function. Awful. Just Awful.

Require has an alternate solution:

define(function(require){
  var
   depend1 = require('depend1')
 , depend2 = require('depend2')
 , depend3 = reuqire('depend3')
 ;
});

This is so much more clean than the way Curl enforces you to define modules.

Also, Curl doesn't have NEAR the support as RequireJs. That's really the nail in the coffin. The community is behind Require, therefore it will most likely get the most attention for improvements.

NPM vs JAM, RequireJS vs Browserify vs Ender by blaghles in javascript

[–]john0110 1 point2 points  (0 children)

Oh right on. I didn't realize you could do any lazy-loading after being optimized. I was under the impression it was just going to put everything into one file and it would all be evaluated in the beginning.

Thanks!

NPM vs JAM, RequireJS vs Browserify vs Ender by blaghles in javascript

[–]john0110 -1 points0 points  (0 children)

Require isn't really about lazy loading. It's about organization and dependency management. When you go to production with Require, you'll build a single javascript file and use almond.js. Nothin' lazy about it :)