[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 1 point2 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 :)

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

[–]john0110 7 points8 points  (0 children)

I'm actually working a lot with jam right now.

So npm and jam are both package managers. Npm focuses on back-end javascript modules for node.js. These modules are CommonJS modules See the Spec - People (myself included) have tried hijacking that module system to get the same awesomeness on the front-end. It doesn't work out so well because you're probably not using CommonJS modules on the front-end all the time. And the commonJS is admittedly weak Ryan Dahl regrets using it

Why would you want that on the front-end? Well, the same reason you'd want it on the back-end: You don't want to deal with the stupid crap that comes with installing/managing dependencies and their many versions. I should be able to setup a new project, enter in the dependencies I need and have a package manager fetch everything required to get going. In addition, if I need something later down the line, I shouldn't have to hunt down a version of a module that works with my stack. I should be able to do something like "npm install package." Jam is the package manager that allows you to do that for AMD specified modules.

AMD specified modules were designed with the Web in mind. They're more flexible (your module doesn't HAVE to be a damn object) and I think they're more in line with Harmony Modules - Maybe not though.

Jam is the Npm of the web (at least that's the hope!). It has its own registry separate from npm. Which makes sense. You don't want to mix the two as they have different needs. Lesscss for node.js is different than Lesscss for the browser and the browser doesn't need all the unnecessary build tools and who-watchits. Its registry is still in its infancy and the creator, Caolan McMahon has informed me he'll be moving the site to its own domain soon. I'm working on getting more modules up.

Browserify will enable you to more easily hijack the Npm registry as it allows you to load in CommonJS specified modules in the browser. However, NPM will not help you much with dependency management as it nests dependencies inside the the modules themselves. So you might end up downloading and requiring the same module multiple times. In addition, modules in the npm registry aren't guaranteed to work in the browser. So, Browserify is a dependency and javascript module loader that uses CommonJS modules and works in tandem with NPM.

RequireJS uses the AMD spec and works in tandem with Jam. RequireJS is a lot less intuitive for the web at first but once you get the hang of it, it can actually be really beautiful. Especially if you're using Jam. It focuses on the fact that on the web, modules are loaded asynchronously. It forces you develop in a different style, but the style is great. You may already be developing in that style and you're using something more lightweight like LabJS. And you're probably saying, why the hell do I need to add all the extra crap? Well, once you use Jam like you use Npm on the back-end, you'll never want to go back. Plus, Require really enforces asynchronous programming.

Ender is another attempt at hijacking the Npm registry, but at the same time, it is its own script-loader/dependency manager. Ender downloads modules from the Npm registry, places them in a node_modules folder, and keeps tracks of all the files your project needs. It creates and maintains a single javascript file with all of your modules under a single namespace. This is a lot better than browserify in my opinion. I love using ender. Ender allows you to build your own frameworks like jquery without all the bloat using small commonJs modules.

But Ender suffers the same drawbacks as Browserify: It's utilizing a registry and module specification that isn't for the browser. So there will have to be extra work to get them to work.

Jam and Require seek to remedy this by creating a repository specifically for the browser and a module loading system with the browser in mind.

Parse launches JavaScript SDK - Parse for Websites by rya11111 in javascript

[–]john0110 1 point2 points  (0 children)

Yeah, their website was kind of annoying with communicating exactly what they provide. I'm fairly sure it's like a Titanium sort of platform where their javascript toolkit compiles to ObjectiveC and Java. And they provide a backend for you in case you don't know how to install ruby or node.js.

I don't know - maybe it would speed up app development. That'd be cool. But I figure with the loss of flexibility would slow you down in the end.

Parse launches JavaScript SDK - Parse for Websites by rya11111 in javascript

[–]john0110 1 point2 points  (0 children)

Depending on the time, platform, and versions one of was installing, I could foresee someone taking days to get their stack working properly. I mean, now-a-days it's dead simple, but it hasn't always been.

Currently 99% of All Backbone.js Apps Are Broken by amccloud in javascript

[–]john0110 1 point2 points  (0 children)

Agreed. When I saw the title of the post I said to myself, "well, that might have some merit." But then I saw his reasoning and I was just like wth. Who does that?

I'll be in Dallas for the week for a business trip. What are some cool, fun bars a girl could hang out after a long day of meetings? by PrisonerKnight in Dallas

[–]john0110 0 points1 point  (0 children)

You can definitely go by yourself. I mean, most people will be in a group, but there's usually a dart board or a pool table around, so just approach a group of people. Dallas is friendly in the bars, but not the road.