JavaScript - Yahoo News Search Results

120.22 ¥/$ (5 p.m.)

Sorry, but your browser needs Javascript to use this site. Japan has continued its path as a pacifist nation for 70 years since the end of World War II based on its “deep remorse” over the war, according to a draft of the annual foreign policy report for this year.

Meteor JavaScript framework hits Windows

Until now, developers who wanted to build Web and mobile apps via the Meteor JavaScript framework had to do so via either Mac or Linux clients. That changes today with the release of Meteor 1.1, which features support for Windows clients as well as the MongoDB 3.0 database.

SCENE AROUND Pirate Nurse 5K, March 28

Javascript is Disabled! This slideshow viewer requires javascript. To view this slideshow either enable javascript and refresh the page or go to

Google refocuses Dart as a JavaScript helper

Backing down on ambitions to create a commercial grade Web programming language, Google is shifting work on its Dart programming language to make it an optimization aid for the pervasively popular JavaScript, which Dart was originally designed to supplant. The company no longer plans to incorporate Dart into its Chrome browser, the two creators behind Dart announced in a blog item posted ...

Developer: Dump JavaScript for faster Web loading

Web pages would be loaded quicker sans JavaScript via a proposal being floated by the editor of a fashion magazine, possibly as part of a still-theoretical "HTML6."

Instant feedback arrives for JavaScript code testing

Developers looking for quick results when testing JavaScript code could have a solution with the Wallaby.js test runner tool, a code coverage technology intended to offer nearly immediate reporting of results.

In Programming Language Landscape, JavaScript Variants Gain Ground

The use of JavaScript has become pervasive in Web development, looming large across the entire programming language landscape. JavaScript is particularly significant for managed service providers (MSPs), for whom the Web is a basic tool for making their services available to their customers, whether delivered from the cloud or provided on-site. But JavaScript has its challenges and complications ...

MarkLogic buddies up to JavaScript, throws shade at old pal XML

Database company MarkLogic has extended its NoSQL data store to work natively with JavaScript and the popular JSON data exchange format, in addition to the XML format it has long supported. “All of the same features and functions we have for XML data are available for data that comes in from JSON,” said Joe Pasqua, MarkLogic executive vice president for products. First-class JavaScript support ...

JavaScript Tutorial

JavaScript is easy to learn but it provides powerful control over mobile application. If you wish to learn JavaScript, code for smart...


recent bookmarks tagged JavaScript


Posted on 31 March 2015

Edit fiddle - JSFiddle

Posted on 31 March 2015

(238) Why do a few of my co-workers argue that JavaScript isn't real programming? - Quora

Posted on 31 March 2015

☕️ 郵便番号 - みずぴー日記

Posted on 31 March 2015

Things which aren't magic - AngularJS Dependency Injection - Ainsley Escorce-Jones | Blog

Posted on 31 March 2015


Posted on 31 March 2015


Posted on 31 March 2015

Posted on 31 March 2015

Backbone CoffeeScript

Posted on 31 March 2015

Posted on 31 March 2015

Top Answers About JavaScript (programming language) on Quora

Top Answers About JavaScript (programming language)

I am Java developer who wants to learn JavaScript. Which technology, Angular, jQuery, or Node.js is better to learn nowadays?

Welcome to the front, Java developer! Good to have you.

In comparison to other languages, the JavaScript community changes methodologies, frameworks, build systems and even their virtual machines like most people change their socks. It is therefore much more important to have a fundamental understanding of the language itself, rather than learning a specific framework idiom. If you invest heavily in a certain technology, you'll be in for a world of hurt.

Luckily, JavaScript is also a very small language compared to other languages, so you'll be able to assimilate it quickly. I always recommend people to start with JavaScript: The Good Parts. It's a few years old, but since JavaScript is an open standard the language itself changes very slowly.

All that said, the things that are hot right now in the JavaScript community are (and this list is biased as hell):
  • React and Flux is the hot new thing (especially the just-released React Native. Developed and used by Facebook. It is really good.
  • Angular (the old but popular, big thing, developed by Google). Currently between two very different major versions so I'd stay away for a few months until the dust settles.
  • Backbone is a good-old MVC framework for use in the client side of things.
  • node.js and io.js. They are the same thing, where io.js is a recent fork. Think the hudson/jenkins split. Use node.js for now, but there is a good chance that io.js will win out, so be aware.
  • npm is the major package manager for JavaScript. It's has a module for goddamn everything. There is also jspm and bower. jspm is nice but too new, but Bower is stupid and should be avoided.
  • Browserify is the best thing since sliced bread - it allows you to use npm modules in the browser, not just the server.
  • Gulp and Grunt are build systems. Gulp is the newer one, but pretty mature. It's the one you should use.
  • express.js is what you want if you want to build stuff server-side.
  • Meteor is a super futuristic and cool full-stack framework that is awesome but does pretty much everything in a different way than everyone else. It's very popular, and you should definitely try it to get your mind blown.
  • jQuery is to JavaScript what Wordpress is to PHP. Everyone learns it and then tries to do everything with it. You should not do this. jQuery is a good tool for DOM manipulation, use it for that and nothing else.
  • Learn some functional programming. This is the best way for me to ensure that you can never go back to Java. See my answer to What is a simple explanation of higher order functions and callbacks in JavaScript?

I know, this all feels overwhelming. That feeling doesn't really go away, just embrace it. Breathe deep. Wooooo!

See question on Quora

Posted on 12 February 2015

What are some simple HTML/CSS/JS changes that could boost the visual experience of a website?


Your list is already quite comprehensive, which is great. A few other considerations to add on would be:

Full Page / Boxed Sections
Full page sections. With this styling, your sections run 100% of the page width, and automatically adjust to the height as you add or take away content. Full page websites provide a flatter, richer user feeling, and is synonymous with vastness but also less control. My website
uses this style.

The box layout, on the other hand, constrains content to the fixed width of the section (e.g. 800px width) and leaves lots of space on the left and right. Think of Facebook's layout on a desktop. This style is synonymous with limiting content but also providing more control.

Try making your sections at 100% to get a fully unboxed webpage.

Typefaces can make a big difference to your website's visual appearance. Because so many websites are text-intensive, a great typeface can make a positive difference. And we can't get away from a typeface since the default text on any website uses a typeface. So we might as well take control. There are plenty of professional-grade typeface providers for websites, including (H&Co.), WebType from the Font Bureau, and Typekit from Adobe. These require paid subscriptions. But if you're looking for free and quality webkits, Google's  font library is awesome. Simply pick a typeface, pick the weights you want to use (regular, semi-bold, bold) and Google generates the CSS / HTML link for you automatically. It even tells you where to place the link. Paste the link into your site and now you've got a great typeface. I personally recommend Oxygen, Open Sans, PT Sans Caption, PT Sans, and Varela Round. There are a lot of typefaces though so browse and pick the ones that appeal to you.

On the topic of typefaces, don't forget to adjust the line-height property in CSS. This puts additional space (leading) between your sentences which makes it much easier to read.

Pop-Up Boxes
Pop-ups can be annoying when used for advertising, but are quite cool when used for filling in a form to login. You can style your own pop-up login form or pop-up notification quite easily by creating a div. When doing this, try experimenting with border radius. This CSS property makes your edges rounded or straight. A gently rounded div can give a playful, appealing edge to your pop up boxes. Border radius properties can be independently set as well so you can have the top left and bottom right corner rounded with the others straight, for example. The border-radius property can be set in a lot of units, including pixels (px),  and percentages (%). Now, if you want your div (pop-up or not) to be a perfect circle, set your border-radius to 50%. That way you get a circular div which may look great in the right setting and is very easy to accomplish.

Animating Boxes with JavaScript with CSS
CSS3 is evolving very nicely, and there are some very cool effects you can achieve just by using CSS. The css.animate property is really cool though not as simple as the other points we've discussed so far. But you can use this CSS / JavaScript property to slide in and slide out / fade-in and fade-out your divs, pop-up boxes, blocks of text etc. Rather than just appearing and disappearing like the browser's alert box, this effect is smooth and may get your site visitors to click a few times, which is great.

When you use the HTML <button> tag, you're going to get a browser-generated version of a button, which is not always the best looking. Instead style your buttons in CSS by giving them a background-color, width, height, and border-radius. This immensely increases the appeal of your site's buttons and after all, we do want visitors to click through our content. I recommend styling every button on your site but that's just me.

This is where many of us go nuts because what's the best color to use and in what swatch combination? Fortunately, after years of looking I found an awesome site that gives you a large complement of flat-design colors. Here's the link: As the URL and page title suggests, the color swatches are specifically selected for their visual appeal in flat design, which is all the rage at the moment. But more than that, these colors render beautifully on small and large screens (design note: the size of an object can influence how we perceive a color. For e.g. a red could look deeper red if the box is small, and lighter when enlarged). Pick a maximum of four colors for your site. Any more and the theme may get lost.

Animated GIFs
Because it's just so much fun to do, there's a tendency to go overboard with animated GIFs. But in the right amount, they work great. Keep your animated GIFs to few colors so as not to overwhelm the experience. They're a great alternative to very short instructional videos (how to fill in your site's form, or where to download an article from), and add credibility to your site.

Tool Tips
A tool tip is a small (sometimes large) box that appears when a user hovers over a piece of text or an image. You can easily add tooltips to your site by designing your own divs (see the pop-up section) then using JavaScript and css.animate to generate them. Because tooltips are used for additional helpful information, use a nice, clear typeface when creating your content inside the tooltip. A tooltip usually requires a div with an arrow pointing to your content (left, right, top or bottom). It's quite easy to make these divs with arrows. I'll be uploading a video on YouTube in a few days on how to do these but there are plenty of videos and articles already present so just do a search on this topic. Like everything else, resist the temptation to go overboard with tooltips.

Dynamic Charts
If you're presenting data (population growth, climate change, number of visitors to Paris each month etc.) it's nice to have a chart (pie chart or bar graphs) that animate or slide when users click on these. JavaScript and CSS again are your friends here so definitely make use of these languages to add interactivity to your charts. You can use a simple sliding effect to show growth, changes etc. There are lots of code snippets online, on how to achieve these effects, and they're quite easy to implement. I have simple sliders on my site so check it out the effects.

Last Thoughts on Effects and User Experience:

I've picked fairly simple effects to use (there are plenty others, and still more with more complex applications) but these make a big difference since they are the most popular items you'll find on a website. When applying effects, it's best to aim for a design goal you'd like to achieve. Therefore focus on user-experience, and not so much on features. Otherwise we'll run the risk of overwhelming our visitors. It's great to experiment with these, but when the final product is out, keep it focused on usability. (Like the old copywriting maxim: don't use seven words, when four will do).

Visit Themeforest's WordPress section and check out the themes. Many of the best effects on the web are designed into these themes so there's a great source of inspiration to find the best effects using HTML / CSS / and JavaScript.

Also, try to wireframe your website's effects using PowerPoint or Keynote to see what the effects will look like. I like to do a rough mock up and layout of my site on Keynote, then add one or two bits of interactivity to see how the effect looks. It's a great strategy that works for me, since animation on these programs is very easy to add. Try this tactic and see if it works in giving you an idea of your website's ultimate effects and experiences.

Hope this helps and all the best with your site.

See question on Quora

Posted on 30 January 2015

What is the best way to handle floating point problems with financial calculations in JavaScript?

Never use floating-point numbers for financial calculations. As you have observed, this leads to rounding problems because most decimal fractions like 0.1_{10} = 0.00011001100110011\dots_2 have no exact finite representation in binary.

Instead, just represent all monetary values using an integer number of the smallest relevant units of the currency, e.g., cents. You don’t need a special library for this. Plain JavaScript numbers are guaranteed to be able to accurately represent every integer between -2^{53} and 2^{53}, and 2^{53} cents is about nine quintillion dollars.

(Don’t divide by 100 again and convert to dollars, like the example you gave. Just leave everything in cents.)

See question on Quora

Posted on 28 January 2015

I recently noticed that some companies/developers, migrated or adopted Go language over Node.js. Why is that?

We recently chose Elixir / Erlang as our main back-end language at Taskworld, moving away from a 100% Node.js solution.

The team evaluated 4 different alternatives, building a simple REST API using Go (using Gorilla), Rust (Iron, nickel), Scala (Spray) and Elixir / Erlang (Phoenix, Cowboy).

Elixir won by a slight margin (over Go).

We still use Node and React/Flux for our front-end.
It's perfect for us as we pre-render of our React components on the server and rely on Browserify and Gulp as part of our dev cycle.

But we decided we didn't want to build a large back-end in JavaScript, for a number of reasons;

1. The mutability of JavaScript objects.

This one's pretty simple; Developers pass objects to functions by reference and then end up mutating those objects - in fact, the language encourages them to do so.
This can lead to subtle, hard to detect bugs.

When writing React code (Flux stores in particular), we need to work around this problem by constantly cloning objects on return because JavaScript objects are also returned by reference (objects are allocated on the heap).

Having to keep track of what needs to remain a reference and what needs to be cloned/copied is more than just a nuisance, it's inefficient as cloning large objects is slow.

This problem gets magnified when writing a large back-end, which leads to point number two..

2. Having to test EVERYTHING.

There's no leaning on the compiler when writing JavaScript.

Problems are normally spotted at runtime, and that increases the need for testing.
Don't get me wrong; Testing is important no matter what language you use.
But the amount of tests needed to get decent coverage differs greatly from language to language.

Statically-typed languages like Go, Rust and Scala allow you to detect many errors at compile time (Rust is especially great at this), eliminating the need for some of the unit testing.

We chose Elixir / Erlang, despite it using dynamic typing, mainly because of it's immutable types.
Elixir's functional style, paired with Pattern Matching and Specs make for more solid code.

With JavaScript types being what they are (i.e. inconsistent), it forces developers to test more thoroughly.

3. Asynchronous programming and non-blocking I/O.

While this has upsides and is arguably the main benefit of using Node.js, it's implementation in the Node.js API, with the introduction of the Node callback convention, makes for some odd-looking code.

However you choose to deal with callbacks in Node.js, be it through Fibers, Q / ES6 Promises or Async (we've used all of them, but lean towards Q), having to constantly work around "callback hell" by wrapping functions calls does get old after a while.

Most common back-end programming tasks require a standard synchronous flow; i.e. fetch data, process the data, fetch more data based on the result, do more processing and so on.

Having to compensate for the async programming model of Node.js 75% or more of the time just can't be considered "right".

We much prefer Processes in Elixir, or Go routines, to do parallelism in the back-end.


For more on why the team choose Elixir over Go, have a look at my response in the comments.


See question on Quora

Posted on 19 January 2015

I recently noticed that some companies/developers, migrated or adopted Go language over Node.js. Why is that?

Your app grows up.

A junior developer looks for the ultimate language. An experienced developer knows that a product has different tooling needs when it is in beta compared to a product that has been in production for a year or two.

As humans change partners, living arrangemnets , hobbies, habits and food as we grow older, apps will have different needs.

Go is a pseudo-system language specifically made for concurrency. While Node.js is a great way to very cheaply get a decently performing message-based service running, it is less ideal once your application starts getting more mature. The flexibility of Node.js is not as important to you any more, since you nowadays know what your app is, unlike in the early days when you weren't even sure if your app was a good idea in the first place. Now, your app is successful, and changes less, and you are more willing to sacrifice that flexibility for ease of maintenance and stability.

See question on Quora

Posted on 19 January 2015

Why are IT systems in big enterprises usually built using Java, instead of Python or JavaScript?

Questions like this are usually asked by those with limited experience in large systems development, often after having just learned programming or done some small project work in the first languages they've acquired knowledge in.

For starters, neither Python or JavaScript are modern languages compared to Java.  JavaScript is only a couple of years younger than Java and before that it was called LiveScript.  Python is OLDER than Java by several years.

"Modern" does not mean "better".

Talking to other systems is a function of protocols, not languages.  You need to understand that distinction.  As long as you can speak the protocol, like HTTP or SOAP, you choose the language best suited for the job.

Java is NOT legacy.  It is mainstream.  And it is mainstream for a reason.  Virtually all of the common enterprise tasks one might want to perform is available in Java either natively or through many frameworks. 

It can scale and has many years behind it in how to do this.  That is huge in large enterprises with high volume systems.  JavaScript libraries are playing catch-up here and it will likely 5-10 years before they work out all of the kinks in doing this well and the current framework wars that are being fought right now shake out winners and defacto standards emerge.

What about skillsets?  Too many people who prattle on about JavaScript and Python fail to consider that.  Companies need to hire people.  The number of skilled people determines how hard and how expensive that task is going to be.  Java skills are easier to find.  Paradoxically, they are also harder to find because the demand for skilled Java developers is so high that it is hard to find them because they don't move around much!

Java has had a long time to figure out what works well in a modern web development and service development context.  Python has a couple of well-known options like Django or TurboGears. 

JavaScript is all over the map right now playing the "let's reinvent Java because it is cool to do so" game.  JavaScript was never meant to be a back-end language and adapting it to that role is going to take time.  Hell, .NET developers are have been seeing the "new" MVC framework from Microsoft in the past couple years.  Java web developers are rolling on the floor howling with laughter at that one!  We were doing that 15 years ago and have used that time to refine what works and what doesn't!  Microsoft and the "modern" languages will be playing catch-up for sometime.

Managing large Java codebases is well known at this point.  It inherited that from its C ancestry.  Source control, build and deployment pipelines and most development methodologies like Agile have their roots in the Java space.

Legacy?  I sneer at that.  Give me a couple of good Java developers and I can probably wipe the floor with anyone using Python or JavaScript to roll out an idea and do it in the same amount of time and richness of capability.  With the advantage than when the idea needs to grow, I know my enterprise-grade solution will be able to scale because I'll have engineered it that way applying years of long experience.  Because I won't be reinventing the wheel when I crack out my JDBC frameworks, NoSQL frameworks, JSF2, Primefaces, Web Services components and the like.  You'll still be writing orchestration code or a front-end widget while I'm negotiating with my customers on what text their labels should have, hard work long behind me.

And I say this as some who is fluent in Python and JavaScript and use them in production systems.  And believe it or not, despite Java's strong typing, it is actually as dynamic in its behavior as Python or JavaScript are.  Java Reflection is the core of virtually every modern Java framework and we've been doing runtime inspection, runtime dependency injection and dynamic typing and runtime type determination for well over a decade.  Almost every piece of Java code I write, especially in a web application, is more-or-less a dynamically typed solution (i.e. JavaBean properties and dependency injected classes).

Languages are a means to an end.  They do not exist solely to justify themselves.  They are tools.  You're writing business solutions, not programming solutions. This is the first great epiphany you must come to understand.

See question on Quora

Posted on 18 January 2015

Why are IT systems in big enterprises usually built using Java, instead of Python or JavaScript?

At Spotify, we use Java extensively in the backend. This is not for legacy reasons, it's an active choice. We use Python too, but we have moved more and more to Java. The reason is that Java is much easier to get to perform well. Python is easy to write initially, but getting it to perform well when being hammered by 15 million paying users is another.

I personally don't understand how a medically sane person can like the Java syntax. However, no intelligent person can deny that the JVM is pretty darn good. It is fast, well-tested, well-documented and under active development. This cannot be said about many tools in software development.  

We used to have quite a bunch of C++ services, but while you can get C++ very fast too, it's harder to write, especially if you want the code to be maintainable. Java is a compromise that hits a sweet-spot for us.

Clojure is gaining tractions at Spotify, many new services are written in it, but it's not as wide-spread yet. While Clojure is certainly a better language, Java has the advantage of being non-weird. Java is an uncontroversial programming language that all experienced programmers can jump into with little effort, and that is a big advantage.

See question on Quora

Posted on 17 January 2015

Why are IT systems in big enterprises usually built using Java, instead of Python or JavaScript?

Python and JavaScript are qualitatively different languages from Java. And I would certainly argue against JavaScript being "more modern" than Java: they come from the same time.

Python and JavaScript are both interpreted languages (yes, I know Python complies to .pyc) whereas Java is a compiled language. Java runs under the JVM, which is a carefully designed secure environment; Python and JavaScript are deliberately designed as insecure "you can do anything" languages. Java has language constructs designed to make managing large projects with millions of lines of code possible; neither Python nor JavaScript do. My experience with Python is that it is not suitable for large projects.

If I wanted a "more modern" language than Java, I would probably go for something like Scala.

See question on Quora

Posted on 15 January 2015

Why are IT systems in big enterprises usually built using Java, instead of Python or JavaScript?

  1. Many companies have systems that have to maintained for a long time, yet they do not have dedicated staff to maintain them. Rather, the system is written by some contractors, then just sits there until something new is needed, when a different set of contractors comes in, etc. With that approach, it is important that you use something standardized that is popular for this general type of system, so you can always find somebody to maintain it for you. Java and C# are very popular for writing big business automation systems, so there are many contractors who can write big business automation systems in them, so they remain popular for writing big business automation systems. This becomes a self-fulfulling prophecy, but that makes it no less convincing of an argument.
  2. For similar reasons, it is important that you use something stable. With many dynamic/scripting languages like the ones you mentioned, 3 years is considered more than adequate notice to deprecate a language or library feature. With Java, on the other hand, you can still run a 10-year old program without modification. This is often very important to people doing business automation.
  3. The presence of a big corporation backing a language and the associated set of libraries and tools reassures decision-makers in large corporations that support is good and won't go away soon. (Whether this is actually true is a whole 'nother question.) Python, PHP, and Ruby are all originally hobby/academic projects, and have grown some amount of corporate support, but mostly from rather small firms that do not impress your typical Fortune 500 CIO. C# is backed by Microsoft, and Java comes out of Sun, which may have gone under, but is still backed heavily by Oracle, IBM, and others.
  4. Big business automation projects require different libraries and frameworks than typical dynamic web sites do. You want to be able to talk to Oracle and SAP, for instance. These sorts of frameworks and libraries tend to be for Java or C#, and this too is self-perpetuating.
  5. Sometimes, Java or C# may actually be a technically better alternative. I mention this argument last, but it's not just to point out the logical possibility. For instance, Java has a decent threading model and there exist high-performance concurrent data structure libraries. The standard Python implementation has poorly implemented threading, and the standard PHP implementation has for all practical purposes no threading at all. Also, strong typing and compile-time name resolution, while slowing down exploratory programming, do increase the number of bugs that can be statically caught.
And now an admittedly slightly off topic remark: The question mentions languages with a lot of compile-time checking that are tedious to use, like Java and C#, and languages with very little compile-time checking that are not tedious to use, like Python and Ruby. For completeness, it must be said that the amount of compile time checking a language does need not necessarily correlate directly with the amount of boilerplate that you have to type to help it do so. Among the languages that have very tight compile-time checking but that are considerably cleverer than Java about inferring what it is they are supposed to check, ML (OCaml, Standard ML, F#), Haskell, and Scala are especially worth knowing about. Among these, Scala has the best chances to become truly mainstream, because it integrates so well with the mature and open source Java runtime and libraries.

See question on Quora

Posted on 15 January 2015

How many boring steps in programming were there for you, before it became exciting?

I got stuck playing Grand Theft Auto: San Andreas on my PC! I had to figure out a way to get rid of the update to unlock my old saves. I ended up messing with one piece of the source code that was open to modify, it was written in C (If I only had known what C is).

I went to buy this book (This exact copy) for $75. In North Iraq $75 is a lot of money:

My cousin, Misho, who was an actual Engineer at the time told me few things:

  1. First, that is C++, you wanted C, those are not that close. AND no the ++ doesn't mean a better version. (My logic back then :/ )
  2. Second, this is for someone who can understand at least College level English, wait do you even know what a TextBook is Yad?
  3. Third, why did you break the game again? It doesn't look like that you are going to be playing it anytime soon.

Hence, the journey started my friend! I went on an epic mission to fix the game back! Didn't know what was coming, it got dark really fast.

I ended up making a MOD on the game and never being able to fix it. I downloaded the free available 3D car models and added them to the game.
My first 101 programming project as a 16 years old (It was one of the most exciting things I have ever done in my life).

When I showed the game Mod to my friends, the reaction was something like this:

For those who are interested here is what the game ended up like:
Hitman: Blood Money MOD in GTA :):

I found a Forum that gave all the Car Models for free and I gave them my Mod for free. Back then startup tactics was such simple!

See question on Quora

Posted on 14 January 2015

How can I run a Node.js web app on a shared hosting?

I don't know about other people, but for me, shared hosting is a horrible, old technology that I've left behind many years ago. I would not wish it upon my enemies. Whenever I run node in small deployments I always use a PaaS like Heroku, Nodejitsu or Modulus.

There is a wide-spread misconception that shared hosting is simpler and cheaper for small sites than PaaS solutions. In fact, PaaS is extremely easy to set up (if it requires setup at all), and is generally *free* for small apps.

Given that you have a normal node app, the steps to deploy it on Heroku (for free) is a follows:

1. Sign up for Heroku account
2. Install Heroku Toolbelt
3. Run "heroku login" in terminal
4. cd to your app
5. Add a scripts/start line to your package.json to tell Heroku what to run, and commit the change to git.
6. Run "heroku create myappname"
7. Run "git push heroku master"

Your app is now running on

Adding a custom domain, mongo database, or any of the many convenient plugins that they offer is one click away in a pretty web interface that they offer.

See question on Quora

Posted on 7 January 2015

Are all dynamically typed languages as "liberal" as JavaScript?

Yes, most of them are pretty messed up, and this derives from the basic problem with: "On the left we have this thing which could be anything. On the right we have this thing that could be anything.  ¯\_(ツ)_/¯ Are they 'equal'?"

A lot of the time these "things" don't even behave like values. This kind of "flexibility" is not a virtue, and it causes innumerable bugs.

Here's PHP.

See question on Quora

Posted on 7 January 2015

What is the best way to learn JavaScript practically?

1) Build shit! Get an account on Google App Engine, and start launching real web apps, with real CRUD features.
2) AVOID JQUERY. Try as much as you can to write javascript with 0ut Jquery. Jquery is a way overbloated API and you'll spend too much time learning it instead of javascript. document.querySelector() will work just fine!
3) Post every bit of code you write on GitHub, and try to convince people/friends smarter than you to read it and give you advice.
4) Seek failure, and just keep learning!

Good luck, fellow hacker :)

See question on Quora

Posted on 29 December 2014

What types of jobs are available for those that know just HTML/CSS and JavaScript?

By being hired by companies that require front-end development. I don't only know Javascript, CSS and HTML, but they're pretty much the only technologies I ever use at work, because there's so much front-end coding to do and so few other people on the team who know how to do it well. There are exceptions, but most of the server-side developers I know aren't Javascript experts (and vice versa).

This is because the world of computing changes so quickly, there's only so much stuff one person can keep up with. To be a relevant JS programmer, I have to study every single day. There are always new libraries, new frameworks, new techniques, etc. And my employers and co-workers expect me to know them. There aren't enough hours in the day for me to keep abreast of the front-end stuff and new developments in the PHP, Java, and Python worlds, too.

I've been a front-end developer for about ten years, and I've always been able to make a living at it. I imagine that, in the automotive world, there are people who specialize in building dashboards instead of engines.

See question on Quora

Posted on 10 December 2014

How do I outlast the software engineer gold rush/massive influx?

I have lived through the .com crash, the 9/11 downturn, and the housing market crash and I have never been out of work for more than 10 days because of these reasons:

  • Make sure that you keep learning. 
  • Make sure that you you have a few skills in your tool-belt that are tried, true, and used by the enterprise (Like C#, C++, and Java). 
  • Make sure that you actually understand the fundamentals of software engineering and not just some front end frameworks. 
  • Make sure you are competent in the full stack (database, middle tier, UI).
  • Learn about business
  • Practice communicating

To elaborate:

The tried and true languages I mentioned have far and away the most jobs and enterprise companies like banks, insurance, medical... even when the start up market has a downswing these companies will still be chugging along doing business as usual.  These sectors are very stable even if they aren't featured on hackernews. 

You need to understand fundamentals so you can acquire new skills quicker.  I love angularjs for example, but if that's the only framework you know for building front end interactive sites... you are in big trouble if it goes away.  If all you know is auto generating code with rails... again, you are in big trouble if that skill becomes less in demand (or if your company moves to something else).

As a bootcamp owner, we take people through the whole stack so they get more than just front end tech.  They know how to design database tables, use indexes, stored procedures, and basically play a junior dba role.  They understand multiple data access tools.  They know how to write and test business logic and hook it up to a UI.  I don't care if web pages disappear tomorrow... professionals will still be writing business logic, structuring data, and serving it up to whatever replaces the web on the front.

Knowing about how businesses work just flat out makes you a more effective developer.  Too many developers tend to latch on to exciting new frameworks and toys and then go looking for a problem to solve.  I want to be known as the guy on the tech team who understands the business and makes technology decisions that drive business value.

If the market changes and there is a lot of competition for jobs, the best communicators will typically beat out moderately better technicians.

See question on Quora

Posted on 2 December 2014

Being easier to understand and write, why hasn't CoffeeScript gained popularity over JavaScript?

I really like CoffeeScript and almost always use it whenever I can, but it it's not going to replace JavaScript. What is more likely is that JavaScript will pick up features from it over time.

1. CoffeeScript is really just very nice syntactic sugar on top of JavaScript. You have to know JavaScript to use it, and you have to know it pretty well too. Starting out as a programmer with just CoffeeScript seems like a big mindfuck for me.

2. CoffeeScript is easy to write and looks super sleek, but pretty hard to read unless you're experienced with it. The comprehensions and the fact that you can omit parenthesizes encourages writing code that is minimal, yet incredibly hard to skim for a human. One thing that I've learned from CoffeeScript that while parenthesizes are ugly, they do a lot for readability.

3. JavaScript is an OLD language. It's been around. To topple any product in any category with that kind of dominance, you need something that is not 20%, you need something that is at least 200% better. CoffeeScript is not.

4. CoffeeScript does not have any standalone interpreters - it depends on JavaScript interpreters, so there is not even the foundation in place so that it could replace JavaScript.

See question on Quora

Posted on 13 October 2014

Which JavaScript language feature is the most annoying to people?

I have a lot of the same gripes that show up on various websites.

  1. Javascript allows trailing commas which gets confusing in some cases
    // ==> ",,"
  2. Null is converted to zero in special cases
    isFinite(42); // true
    isFinite(1/0); // false
    isFinite(0/0); // NaN is not finite -> false
    isFinite('42'); // true
    isFinite('hi'); // false
    isFinite(null); // true
  3. Null is falsy, in special cases
    !null // true
    null == false // false

  4. It treats arrays in a very confusing manner

    [1, 2, 3] === [1, 2, 3]   // false
    [1, 2, 3] <   [1, 2, 3]   // false
    [1, 2, 3] >   [1, 2, 3]   // false

    But wait, there's more!

    [1, 2, 3] <= [1, 2, 3]   // true
    [1, 2, 3] >= [1, 2, 3]   // true

    Son of a bitch.
  5. Typecasting anything to a number by preceding it with a "+" symbol. So

    +"" // 0
    3 + "2" // 32
    3 + +"2" //5
  6. As Mike Grabowski mentioned, I forgot some more shit with null. Here's some confusing ones

    null == undefined //true
    !null == !undefined //true
    +null == +undefined //false
    !+null == !+undefined // true... wtf
    +!null == +!undefined // true

See question on Quora

Posted on 8 August 2014

Do developers memorize all tags, classes and functions?

I started to learn programming 8 years ago. I am now a software developer in C++ and I do at a professional level for 3 years.

Few days ago I just Google'd "printf format specifiers" (can't use streams, don't ask, long story) to see how the hell I can put some numbers in a string. Even though I did it countless times during my life. Is like one of the first things you learn in C.
I also forget the name of classes or services I use almost daily. Or my source control password. I forget what kind of algorithms STL provides or commonly used commands.

Really, I am just plain bad when it comes to memorizing. But I don't consider myself a bad developer because of this. Part of my bad memory is also because I don't actually try to memorize those. I prefer to memorize things that actually improve the quality of my work.

Sure, you'll get used and learn some of the syntax you use, but even if you forget or can't remember some, just find it. Look in the documentation or whatever. So if I were you I would not worry a single second about memorizing stuff. Worry about understanding.

See question on Quora

Posted on 5 June 2014

Do most Haskell users think JavaScript sucks?

Yeah, pretty much.

Then again, it's hardly a unique position. Most people think JavaScript sucks. Some think it's a valid "worse is better" compromise, some don't, but hardly anyone holds JavaScript up as a paragon of language design.

The most famous book about it is JavaScript: The Good Parts. That characterizes it quite well, doesn't it?

Maybe they should just have left the bad parts out, eh?

Moreover, JavaScript is pretty much the antithesis of Haskell. It's dynamically typed, and even manages to get that wrong with its absolutely terrible system of coercions. This "weak typing" is, in my opinion, one of the single worst features in any programming language.

It's also staunchly imperative. Sure, it supports first-class functions, but good luck actually using functional programming! Pretty much everything is mutable, and idiomatic code uses mutation all over the place. Even if you use your own standard library functions, the DOM is still inescapably imperative—and quite easy to mess up.

Compared to Haskell, JavaScript is not very expressive. It's flexible in all the wrong ways: you can write code that does all sorts of nonsense behind the scenes, but you don't have much control over syntax. You can't write pretty code.

It's simply not a good language.

But! The platform it's attached to is worthwhile. The web makes distribution and deployment truly trivial. It also presents what I view as quite a good model for UI code with HTML and CSS, albeit rather poorly executed. Unlike JavaScript, the web as a platform at least has its heart in more or less the right place.

This is why there are so many solutions for taking decent languages to JavaScript: we want to take advantage of the web without dealing with the morass of normal web programming.

While I haven't used any of the Haskell-specific solutions, I have used
for a couple of projects and found it to be an incredible improvement. It's just much better in almost every way. After a bit of hassle setting it up, the code was easier to write, the project was easier to maintain and everything was much easier to extend. I figure the up-front costs are O(1), but the benefits of not using JavaScript scale with, well, how much you don't use it :).

So yeah, I'd say most Haskellers think JavaScript sucks. More power to 'em!

See question on Quora

Posted on 26 April 2014

Is the "you have ruined JavaScript" article a solid argument against Angular.js?

Angular is fine.

Yes, I do agree with the original article that Angular has an obvious Java heritage that is stronger than it needs and should be. Factories (Factory method pattern) is a pattern that is very common in most Java because of it's very structural nature, but in JavaScript it's rare that you need to use them, and it's actually more of a code smell if you find yourself making factories. However, this is just one aspect of Angular and it is in general much nicer than what came before and Angular is a necessary step in evolving JavaScript. 

The fine part about JavaScript is that it's incredibly elastic. You can code it in whatever way you want. It's few languages where you actually implement class.
This is also one of the most problematic aspects of JavaScript - unlike Java or .NET, there isn't an obvious idiomatic way to code JavaScript. When someone new to JavaScript asks "How do you make a class?" the answer is sort of "How do you want to make a class? And maybe you don't want to make a class at all?"

Angular is nicer than what came before and Angular is a necessary step in evolving JavaScript.

JavaScript has a seemingly inevitable reign as king of scripting languages, so a lot of people are flocking to it. The problem is, JavaScript itself offers no guidance on how to write it, so people look elsewhere when starting out. This is where Google entered, with Angular. It offers a clear and sort-of-familiar way of dealing with building JavaScript apps. It's built by Google, filled with Java kings of over-engineering, so it's going to be bound to have at least a few FactoryProviderProviders in it, but it's pretty okay.  Angular offers a decent way of structuring your applications.  At least it's a huge step up from Google Web Toolkit (GWT), their former Java monster. It's also a step up from Backbone, which held this crown before, that promised minimalism but in reality tended to result in surprisingly large code bases.

Just like we moved from random hacking to jQuery plugins to Backbone to Angular, I believe the culture around JavaScript will evolve again in a year or two, and leave our AngularFactoryProviderFactoryEnterpriseServices behind.

See question on Quora

Posted on 26 April 2014

What can PHP do that JavaScript can't?

This is a bit like asking what you can say in German that you can't say in English. In general, there is very little that you can't do with programming language X that you strictly cannot do in programming language Y. Almost all programming languages are pretty general-purpose, and it's more about what one language is more suited to do. There are of syntactical differences about how you do things in one language but cannot do in the other (For example, PHP has variable variables while JavaScript has closures, and German has the excellent word Schadenfreude) but that's generally just different ways of approaching things.

Also, to clear some things up, because I feel there is a bit of misinformation going on in other answers:

Both JavaScript and PHP can run server-side. Web browsers have JavaScript engines built in, and this makes a lot of people assume that JavaScript is for clients and PHP is for servers. This is false. JavaScript is widely used in production server-side, using node.js. Node.js is not another language, it's just JavaScript. Simple, low-cost options are available for small deployments, and large companies like PayPal uses it in production.

Both JavaScript and PHP are object-oriented, and has extensive support for inheritance and polymorphism. PHP is more classically oriented and you will be more comfortable with it if you're coming from a background of Java, while JavaScript has a more flexible (but harder to understand) inheritance model called prototypal inheritance. JavaScript and PHP both have classes, but PHP has a more extensive support for them. (You tend not to need classes as much in JavaScript though for a number or reasons, but that's beyond the scope of this answer).

Both JavaScript and PHP both have extremely cheap hosting options available. For initial small-scale deployments, both have very cheap or free options available and when moving to VPS or bigger they both have similar performance requirements.

See question on Quora

Posted on 19 April 2014

What are the most interesting HTML/JS/DOM/CSS hacks that most web developers don't know about?

* { background-color: rgba(255,0,0,.2); }
* * { background-color: rgba(0,255,0,.2); }
* * * { background-color: rgba(0,0,255,.2); }
* * * * { background-color: rgba(255,0,255,.2); }
* * * * * { background-color: rgba(0,255,255,.2); }
* * * * * * { background-color: rgba(255,255,0,.2); }

This is one of my favourite inventions.

But what does this horrible thing do?

It is meant to be used when you are working with layout, e.g. take

The problem is that unless the element on the page has a solid background or it is a picture, you do not see how does it fit into the layout, e.g. most of the text nodes, pictures with transparency, etc.

With the above CSS, you will see something along the lines of:

Different depth of nodes will use different colour allowing you to see the size of each element on the page, their margin and their padding. Now you can easily identify inconsistencies.

See question on Quora

Posted on 19 March 2014

What are 5 essential skills every Web Developer should have?

The idea here is that most of us should already know most of what is on this list. But there just might be one or two items you haven't really looked into before, don't fully understand, or maybe never even heard of.

Interface and User Experience
  • Be aware that browsers implement standards inconsistently and make sure your site works reasonably well across all major browsers. At a minimum test against a recent Gecko engine (Firefox), a WebKit engine (Safari and some mobile browsers), Chrome, your supported IE browsers (take advantage of the Application Compatibility VPC Images), and Opera. Also consider how browsers render your site in different operating systems.
  • Consider how people might use the site other than from the major browsers: cell phones, screen readers and search engines, for example. — Some accessibility info: WAI and Section508, Mobile development: MobiForge.
  • Staging: How to deploy updates without affecting your users. Have one or more test or staging environments available to implement changes to architecture, code or sweeping content and ensure that they can be deployed in a controlled way without breaking anything. Have an automated way of then deploying approved changes to the live site. This is most effectively implemented in conjunction with the use of a version control system (CVS, Subversion, etc.) and an automated build mechanism (Ant, NAnt, etc.).
  • Don't display unfriendly errors directly to the user.
  • Don't put users' email addresses in plain text as they will get spammed to death.
  • Add the attribute rel="nofollow" to user-generated links to avoid spam.
  • Build well-considered limits into your site - This also belongs under Security.
  • Learn how to do progressive enhancement.
  • Redirect after a POST if that POST was successful, to prevent a refresh from submitting again.
  • Don't forget to take accessibility into account. It's always a good idea and in certain circumstances it's alegal requirement. WAI-ARIA and WCAG 2 are good resources in this area.
  • Don't make me think


  • Implement caching if necessary, understand and use HTTP caching properly as well as HTML5 Manifest.
  • Optimize images - don't use a 20 KB image for a repeating background.
  • Learn how to gzip/deflate content (deflate is better).
  • Combine/concatenate multiple stylesheets or multiple script files to reduce number of browser connections and improve gzip ability to compress duplications between files.
  • Take a look at the Yahoo Exceptional Performance site, lots of great guidelines, including improving front-end performance and their YSlow tool (requires Firefox, Safari, Chrome or Opera). Also, Google page speed (use with browser extension) is another tool for performance profiling, and it optimizes your images too.
  • Use CSS Image Sprites for small related images like toolbars (see the "minimize HTTP requests" point)
  • Busy web sites should consider splitting components across domains. Specifically...
  • Static content (i.e. images, CSS, JavaScript, and generally content that doesn't need access to cookies) should go in a separate domain that does not use cookies, because all cookies for a domain and its subdomains are sent with every request to the domain and its subdomains. One good option here is to use a Content Delivery Network (CDN).
  • Minimize the total number of HTTP requests required for a browser to render the page.
  • Utilize Google Closure Compiler for JavaScript and other minification tools.
  • Make sure there’s a favicon.ico file in the root of the site, i.e. /favicon.ico. Browsers will automatically request it, even if the icon isn’t mentioned in the HTML at all. If you don’t have a/favicon.ico, this will result in a lot of 404s, draining your server’s bandwidth.

SEO (Search Engine Optimization)
  • Use "search engine friendly" URLs, i.e. use Page on instead Page on
  • When using # for dynamic content change the # to #! and then on the server$_REQUEST["_escaped_fragment_"] is what googlebot uses instead of #!. In other words,./#!page=1 becomes ./?_escaped_fragments_=page=1. Also, for users that may be using FF.b4 or Chromium, history.pushState({"foo":"bar"}, "About", "./?page=1"); Is a great command. So even though the address bar has changed the page does not reload. This allows you to use ? instead of #! to keep dynamic content and also tell the server when you email the link that we are after this page, and the AJAX does not need to make another extra request.
  • Don't use links that say "click here". You're wasting an SEO opportunity and it makes things harder for people with screen readers.
  • Have an XML sitemap, preferably in the default location /sitemap.xml.
  • Use <link rel="canonical" ... /> when you have multiple URLs that point to the same content, this issue can also be addressed from Google Webmaster Tools.
  • Use Google Webmaster Tools and Bing Webmaster Tools.
  • Install Google Analytics right at the start (or an open source analysis tool like Piwik).
  • Know how robots.txt and search engine spiders work.
  • Redirect requests (using 301 Moved Permanently) asking for www.Example Domain to Example Domain(or the other way round) to prevent splitting the google ranking between both sites.
  • Know that there can be badly-behaved spiders out there.
  • If you have non-text content look into Google's sitemap extensions for video etc. There is some good information about this in Tim Farley's answer.

  • Understand HTTP and things like GET, POST, sessions, cookies, and what it means to be "stateless".
  • Write your XHTML/HTML and CSS according to the W3C specifications and make sure they validate. The goal here is to avoid browser quirks modes and as a bonus make it much easier to work with non-standard browsers like screen readers and mobile devices.
  • Understand how JavaScript is processed in the browser.
  • Understand how JavaScript, style sheets, and other resources used by your page are loaded and consider their impact on perceived performance. It is now widely regarded as appropriate to move scripts to the bottom of your pages with exceptions typically being things like analytics apps or HTML5 shims.
  • Understand how the JavaScript sandbox works, especially if you intend to use iframes.
  • Be aware that JavaScript can and will be disabled, and that AJAX is therefore an extension, not a baseline. Even if most normal users leave it on now, remember that NoScript is becoming more popular, mobile devices may not work as expected, and Google won't run most of your JavaScript when indexing the site.
  • Learn the difference between 301 and 302 redirects (this is also an SEO issue).
  • Learn as much as you possibly can about your deployment platform.
  • Consider using a Reset Style Sheet or normalize.css.
  • Consider JavaScript frameworks (such as jQuery, MooTools, Prototype, Dojo or YUI 3), which will hide a lot of the browser differences when using JavaScript for DOM manipulation.
  • Taking perceived performance and JS frameworks together, consider using a service such as theGoogle Libraries API to load frameworks so that a browser can use a copy of the framework it has already cached rather than downloading a duplicate copy from your site.
  • Don't reinvent the wheel. Before doing ANYTHING search for a component or example on how to do it. There is a 99% chance that someone has done it and released an OSS version of the code.
  • On the flipside of that, don't start with 20 libraries before you've even decided what your needs are. Particularly on the client-side web where it's almost always ultimately more important to keep things lightweight, fast, and flexible.

Bug fixing
  • Understand you'll spend 20% of your time coding and 80% of it maintaining, so code accordingly.
  • Set up a good error reporting solution.
  • Have a system for people to contact you with suggestions and criticisms.
  • Document how the application works for future support staff and people performing maintenance.
  • Make frequent backups! (And make sure those backups are functional) Ed Lucas's answer has some advice. Have a restore strategy, not just a backup strategy.
  • Use a version control system to store your files, such as Subversion, Mercurial or Git.
  • Don't forget to do your Acceptance Testing. Frameworks like Selenium can help.
  • Make sure you have sufficient logging in place using frameworks such as log4j, log4net or log4r. If something goes wrong on your live site, you'll need a way of finding out what.
  • When logging make sure you capture both handled exceptions, and unhandled exceptions. Report/analyse the log output, as it'll show you where the key issues are in your site.
Lots of stuff omitted not necessarily because they're not useful answers, but because they're either too detailed, out of scope, or go a bit too far for someone looking to get an overview of the things they should know. Please feel free to edit this as well, I probably missed some stuff or made some mistakes.

Resource>> What technical details should a programmer of a web application consider before making the site public?

See question on Quora

Posted on 26 January 2014

How do I become better at JavaScript?

I had similar questions about 2 years ago. I would like to write what I have done to improve my skills not only JavaScript but as a programmer.

  • I have read couple of books. I personally believe that reading a book is completely different experience and it helps you to understand a lot of concepts that you do not find on blogs and article online. Some of my fav books are:
    • Professional javascript for web developers
    • Secrets of JavaScript Ninja
    • High Performance JavaScript
    • JavaScript Good Parts
  • Then I subscribed to couple of channels on youtube. Like jsconf. You get to learn a lot about what is new coming up in JavaScript.  I drive almost 1 hour a day I listen to these channels or some podcasts. You may not be able to understand completely but you get some idea. I was able to utilize my time while driving.
  • I am following a lot of people on twitter who have written book on JavaScript or have written libraries. It helps a lot. Whenever they write a new article they tweet it. Twitter is a great way of knowledge sharing.
  • Then I started reading how browser works. HTML5Rocks has some great articles on how browsers work. It is very important to know. It helped me a lot in writing good fast and reliable javascript. You can see few good resources here Round-up of Web Browser Internals Resources
  • I also joined local javascript community. It helped me a lot because I was able to collaborate with other JavaScript people. I was able to contribute in some of the open sources.
  • I love reading others code and try to think if I can make it better. I fork open source code on github and try to read the code and understand. I started with very small JS libraries. I loved it.
  • I Joined Code triage and subscribe to js libraries that I like.I get notifications about new bugs that are reported on github. If I can solve it I create a new branch and try to solve it. It helps a lot.
  • I started giving trainings within my team and local JavaScript community. I started writing blog about JavaScript. Knowledge sharing is very very important.
  • I also started going to forums and try to see if I can answer anything there.
There are many many ways you can improve your skills. I would also suggest you to read this article Adventures in JavaScript Development . In the article there is a link to some test driven js assessment. Try to do that it will help you a lot. I hope my answer will help you. One more thing Love JavaScript and have faith in it :).

See question on Quora

Posted on 24 January 2014

What are the most interesting HTML/JS/DOM/CSS hacks that most web developers don't know about?

Some people doesn't know, but everything in JS is object.
Some people think that numbers isn't objects because you can't do something like 1.toString().
But they doesn't know that full syntax for numbers is 1. (with dot) and 1 (without dot) is short syntax. You can write something like 0.5 == .5 == 1. / 2 and also you can write 1..toString() and it will work! lol

See question on Quora

Posted on 4 December 2013

What is the better way to program - should I write code by hand or use a framework?

My experience:

It's going to be faster and more efficient for small, young applications maintained by just a programmer or two. But if all developers in a project over and over make the call "this code will be smaller to write than adding a library" you will eventually accumulate quite a bit of code. Often a codebase that is bigger than it's framework equivalent would have been, and also very complex and hard to navigate and maintain, and maintenance is always by far the biggest cost of ANY software project older than 6 months.

We recently refactored an app written in vanilla JavaScript over the course of a 18 months, to use Knockout.js instead of vanilla JS (written by very talented developers, mind you, Spotify has a very tough interview process) and we dropped the size of the application by 2/3. You read that right, 66% of the code just went away because the vanilla JavaScript caused so many subtle duplications of effort. We've done this quite a bit during the last six months at Spotify, because we've historically had a strong "vanilla" culture going around here.

If performance is the reason that you're thinking about writing custom code,
remember that performance optimization is not a theoretical field, it's field work. For instance, jQuery is 19k gzipped or something like that. Thinking about performance on a theoretical level on individual parts of your code instead of actually profiling the app in its entirety is sort of like adjusting someones tie at party without checking if they have pants on. Once you start profiling, the performance bottlenecks you are going to find and be fixing during your first 100 hours or optimizing are going to be much more severe than a 19k lib.

See question on Quora

Posted on 5 October 2013

What are 5 essential skills every Web Developer should have?

  1. Be an egoless programmer. Remember that you are not your code. The only way to improve is to be open to feedback from others and give honest, non-judgemental feedback to others.
  2. Be a team player. Building software is a team sport. You don’t “own” your parts of the code. Instead, your job is to make sure the whole package works as expected. Don’t be a typical “well, it works on my machine” guy. It has to work on users machines.
  3. Be a learner. Technology is changing fast. What was hot 5 years ago is no longer the best—stuff that’s relevant today didn’t even exist 5 years ago. You have to constantly learn new things (e.g. languages, libraries, patterns).
  4. Be a T-shaped person. Specialize in one narrow field and have a general understanding of a broader range of technologies. This makes you a very valuable asset within any organisation.
  5. Be relentlessly resourceful. Become a go-to person that can solve any problem. You don’t have to be able to solve every problem yourself, but you always know where to go to find the answer.

    As in Why no one is looking for ‘rockstar programmers’ stop believing in the Ninja/Rockstar myth.

See question on Quora

Posted on 2 October 2013

What's preventing HTML based apps from taking on native apps?

First: JavaScript is NOT the problem.

I need to get this one out of the way, because there is a lot of misinformation here. This article has been circulating around the internet lately - Why mobile web apps are slow - and I think it's completely misses the point. It's titled "Why mobile web apps are slow", and then goes on an epic rant on why JavaScript is slow, and just silently and falsely assumes that JavaScript performance === web app performance.

I don't know what web apps the author of that article works in all day, but I work in the Spotify web player, which I think is a very good example of an app of over-average complexity, and I can tell you that JavaScript is very, very rarely a performance bottleneck. Yes, JavaScript is slow, but in practice, it's fast enough for what it's doing. Instead, slowdowns that I hunt down in my daily work is related to network calls and DOM manipulations, and just throwing out piles of code that shouldn't be done in the first place. I've never had a moment where I went "Oh, I wish that this piece of optimized JavaScript executed even faster".

Ok, so what is the problem, then?

Primitive framework ecosystem.
Compared to desktops, mobile devices have tiny processors, tiny batteries and tiny RAM. To get 60 FPS performance on these devices that doesn't drain the battery in a couple of hours takes a LOT of work. Therefore, Apple and Google has done a lot of that job FOR you, creating ultra-optimized components that you can re-use in your applications. They also offer quite powerful tooling to debug and profile these components.

The equivalent tooling simply doesn't exist for web apps yet. Sure, stuff like jQuery has become defacto-standard, and that has increased web app development productivity tenfold, but there is no jQuery equivalent on a higher level - the web is still a place where you build most things yourself. jQuery UI and whatnot does exist, but it simply doesn't have the same impact on interfaces that jQuery had on the DOM.

Debugging and Profiling.
The Chrome dev tools is now reaching some kind of maturity, offering quite a bit of advanced tooling support for your apps. However, this is a very nice development and hasn't spread to other browsers, and absolutely not to mobile browser debugging.

Crappy browsers, especially when embedding them.
Android just recently got Chrome - before that, it had some horrible thing that I shall leave unnamed in hopes of eveyone forgetting about it so that it doesn't become the IE6 of mobile, so to speak. Safari on iOS is sort of decent, but if you try to embed it in your app (to get notifications and in-app purchases and whatnot) you get a crappy watered-down version, and the same principle goes for Android.

See question on Quora

Posted on 17 September 2013

How is TJ Holowaychuk so insanely productive?

TL;DR It is very likely that TJH is a hive mind.

First, lets admit the facts: as of today, it is possible to produce a competitive Node application whose entire stack will comfortably rest on various frameworks, tools and libraries developed exclusively by TJ. If you are doing things with Node, you will not escape TJ. He is omnipresent. His license is MIT. His name is cited over 1.3 million times in public source code on Github. He is single, 26 years old. His pet ferret Tobi is a running gag in the JavaScript community. On his typical Sunday, TJ will write more JavaScript code than you will write in a week, and it will be better and cleaner than yours, and even then he will find time to tweet up to 20 times a day about that Riddick movie, respond to all of his Github feedback and finish off with some landscape photography. TJ is someone to wonder about and look up to.

And now for some conspiracy theory:

  1. If you ever wrote any code to make a living, and tend to believe that "OCD-driven" fits the bill of someone who has become such a huge factor in JavaScript movement, take a closer look at how TJ presents himself to the world. He is a graphic designer who "never reads books" and "never went to school". Back in 2008, he was actively contributing to Drupal and designed a few UI themes for it, while his website design business in Victoria BC, which lent its name to TJ's Github account, was slowly fading away.
  2. In late 2008, TJ published a gist where he solves a simple problem in PHP, JavaScript, Haskell, Ruby and ANSI C — showing consistent, concise and mature coding style.
  3. In course of 2 years starting around late 2009, TJ emerged to become responsible for a fair half of the core Node.js ecosystem, wrote a few Unix daemons, and then moved on to a statically typed programming language with cooperative thread concurrency. Ever since, he is consistently in top three npm contributors. Amazingly, during the same period of time (since Sept 2010) he also had time to remain a full-time employee of a Californian startup LearnBoost. Too bad no one ever saw him in San Francisco, since he prefers to work remotely.
  4. The best and most prolific coders are the most reclusive of species — TJ is yet to be spotted at any major software conference. Have you ever met him in person, or at least heard him speaking in public? I didn't, and I couldn't find any videos. One person reportedly attended TJ's workshop ubat JSConf in Argentina(wat?), but the cover slide is just a mash-up of photos you can google up in 15 seconds, and the full presentation just never surfaced.
  5. Yet, way back at QCon SF 2010, I have had the pleasure to attend Ryan Dahl's full-day tutorial on Express framework, which is written and maintained by a certain enigmatic web designer from Canada (see initial commit).
  6. A few Vimeo screencasts narrated by TJ (along with a handful of self-portraits found in the wild) are not too convincing, although all of them are about submitting us into simplicity and comfort of using one of his JS libraries and frameworks. We hear a confident, relaxed voice of someone who has failed to make a public appearance in five years.
  7. If you think that's ok, check out a live feed of Notch coding in real-time for a much better evidence of one's existence. Or try googling for Obie Fernandez, the Ruby guy. Or Mike Bostock, of d3 fame. This is Dominic Tarr and his videos. Substack lives off his contributions. Here are Tarr and Substack mounting a flag, as pictured by Rod Vagg. All these amazing guys have healthy, believable digital footprints. They add up.
  8. Another hint is a bit more subtle. While randomly peeking around .io TLD for your next startup, you are pretty much guaranteed to stumble into a domain name taken by TJ.
  9. Since there is no shortage of TJ's code and commit messages, there is plenty of room for analysis. Here is a naive example. Throughout 2011-2012, TJ has been faithful to his trademark style of declaring imports:

    var EventEmitter = require('events').EventEmitter
      , debug = require('debug')('mocha:suite')
      , milliseconds = require('./ms')
      , utils = require('./utils')
      , Hook = require('./hook');

    However, in 2013, he had a sudden change of heart and now sometimes prefers to declare them like this:

    var Emitter = require('events').EventEmitter;
    var debug = require('debug')('slate-irc');
    var Parser = require('slate-irc-parser');
    var replies = require('irc-replies');
    var welcome = require('./lib/plugins/welcome');
    var privmsg = require('./lib/plugins/privmsg');
    var notice = require('./lib/plugins/notice');
    var topic = require('./lib/plugins/topic');
    var names = require('./lib/plugins/names');
    var nick = require('./lib/plugins/nick');
    var quit = require('./lib/plugins/quit');
    var away = require('./lib/plugins/away');
    var pong = require('./lib/plugins/pong');
    var join = require('./lib/plugins/join');
    var part = require('./lib/plugins/part');
    var kick = require('./lib/plugins/kick');
    var whois = require('./lib/plugins/whois');

    Use blame if you still don't believe that both were committed by the same person. Hmm.

  10. The real fun begins when you start looking for habitual patterns in TJ's commit messages across his ~300 projects. I hate to spoil it for you, but you really want to begin with his use of capitals. Then look at his tweets. Then back at commit messages. Then back at tweets. Repeat.
  11. Although TJ never reads books, he occasionally finds time to write them. As you would guess, books by someone who went from a local web designer in Victoria to the top figure in the most vibrant software community in the world in just three years must be selling pretty well.
  12. The idea itself is not entirely new (and there might be some more recent examples). Regardless whether TJ Holowaychuk is a carefully crafted Node hype device, or indeed an actual sleep-deprived prodigy, his contribution to the Node.js community is enormous. For one, it is hard to imagine the amount of code produced in a desperate bid to match his productivity.

If history teaches us something, it's this — given enough time, a cult following will emerge pretty much around anything that glitters in the dark:
Contemplating TJ's towering achievement, one might get an idea that the art of programming can actually be mastered overnight. Computer science departments have outlived their purpose — anyone can, and probably just should, start doing everything in JavaScript and Node.js, and that is a clear path to one's future career and recognition.

Everyone who is ready to embrace Node because of its perceived simplicity, should keep in mind that although all its glory comes to you MIT-licensed, Node platform is very far from being altruistic.

And, oh, If you ever happen to drive through Victoria BC, could you please stop by and give TJ a hug.


Three months after publication of this answer and over 40k views, TJ Holowaychuk forever parted ways with Node community, citing its shortcomings and lack of leadership compared to Go, his new lightsaber of choice. As he doesn't seem to care much about his JS legacy, everyone is welcome to claim ownership of his former projects.

You will be missed, TJ.

See question on Quora

Posted on 16 July 2013

What are the tradeoffs of client-side rendering vs. server-side rendering?

Since Google Plus and a few other cutting-edge websites now render entirely on the client, let's review why server-side rendering is desirable at all.

Server-side rendering means when the browser fetches the page over HTTP, it immediately gets back HTML describing the page.  Server-side rendering is nice because:

  1. Your content is visible to search engines like Google.
  2. The page loads faster.  There's no "white page" while the browser downloads the rendering code and data and runs the code.
  3. It maintains the idea that pages are documents, and if you ask a server for a document by URL, you get back the text of the document rather than a program that generates that text using a complicated API.

Client-side rendering means JavaScript running in the browser produces HTML or manipulates the DOM.  The benefit is you can update the screen instantly when the user clicks, rather than waiting a few hundred milliseconds at least while the server is contacted to ask what to display.  Sites where you mostly navigate and view static content can get away with mostly server-side rendering, but I can't think of any website that doesn't do any client-side rendering.  Any portion of a page that's animated or highly interactive (a draggable slider, a sortable table, a dropdown menu) almost certainly uses client-side rendering.

People don't usually realize there doesn't have to be a tradeoff.  Why not render the initial state of the page on the server, interactive widgets and all, and then re-render the parts that need to be updated on the client?  Though it's typical to render the meat of a page on the server and then "enhance" it on the client with a library like jQuery, it's rare that a site performs the same rendering tasks on the server and client as appropriate.

The reason server-side and client-side rendering aren't typically mixed is that they are typically done in different programming environments, usually in different languages.  For example, almost all websites render the overall page layout and the content, such as blog posts, on the server, generating HTML in a language like Ruby, PHP, or Python.  On the other hand, a chat widget or an image gallery might be written entirely in client-side JavaScript, while a slider or a rich text editor certainly would be.

For websites that blend static, navigable content and app-like interactivity (or for companies that seek to provide an added measure of sanity for their engineers and designers), this divide becomes a huge pain.  This is why Google Plus does all rendering on the client.  Quora cleverly does almost all rendering on the server (including when you, say, click a "Follow" button), but only the updated parts are sent to the client.  (Particular widgets like the editor and "Promote" slider that provide instant feedback are clearly client-side.)  In an effort to increase responsiveness and flexibility, many sites now render Ruby templates on the server and Backbone templates on the client for different parts of the same user interface.  AirBnB has experimented with running client-side JavaScript templates on the server.

With server-side JavaScript on the rise, I believe the solution is simply to have a single UI framework that runs on both the client and the server, generating the initial HTML on the server and providing an interactive experience on the client.  I'm working on bringing such a framework to Meteor, which already unifies other APIs between the client and server such as fetching a URL or querying a collection of data.

In the absence of such a solution, programmers usually end up arguing either that client-side rendering isn't very important (because most sites or apps consist of large "pages" or "screens" and a round-trip to the server is acceptable when navigating between them), or that server-side rendering isn't very important (because an all-client app just needs a loading screen and a little extra attention to search engine optimization).  These arguments are motivated by the pain of having to deal with both types of rendering in the same application when they involve different languages and APIs.

Edit: More examples of major sites and their rendering strategies:  Facebook is mostly PHP but certain parts of the UI are pure JavaScript -- the chat, the comment form, probably the photo gallery.  Gmail is written in something like C++ or Java, and I'm not sure where the rendering takes place, but I'd guess it's mostly or completely on the client (given the progress bar it displays while it loads).  The old or "basic" Gmail view is presumably server-side rendered.  Github's Markdown implementation is written in C and runs on the server.  StackOverflow has two Markdown implementations, one for live preview on the client and one for the server.

See question on Quora

Posted on 7 July 2013

How would you explain objects in JavaScript to a child?

A Javascript Object is like a Mr Potato Head.

mrPotatoHead=new Object();

Every Mr. Potato Head has 'properties', or words that describe him. To assemble a Mr Potato Head out of all his properties, we can use literal notation:

var mrPotatoHead = {
     mrPotatoHead.height : "6 inches",
     mrPotatoHead.width : "3 inches",
     mrPotatoHead.isMarried : "true",
     mrPotatoHead.wife : "mrsPotatoHead"

Or we can use a constructor function:

function mrPotatoHead() {
     this.height = "6 inches";
     this.width = "3 inches";
     this.roasted = function(){
          var i;
          var slices;
          for (i=1,i<=mrPotatoHead.length;i++) {
          lunch = bake(slices,salt,pepper,oliveOil);
          return lunch;

That last part is the beginning of a nice snack, but is a little advanced for children, and the bake(); method is beyond the scope of this tutorial.

Some properties describe things he has or is wearing:

mrPotatoHead.hasOwnEyes = true;
mrPotatoHead.hasOwnPants = false;

Methods are things we can do to Mr. Potato Head. Sometimes it's a simple action:


Sometimes we need to give him more information by adding a parameter inside the parentheses:


JavaScript isn't what's called 'typed', so if we put in the wrong type of variable, it will do its best even if it doesn't make sense to mix types.


It will usually work anyway, but, yeah, it's best not to mix types.

Isn't that how everyone learned it? :-/

See question on Quora

Posted on 21 April 2013

Who is hiring JavaScript programmers purely for their JavaScript skills?

Spotify does.

All the apps in Spotify run on top of a platform written entirely in JavaScript which lets third-party developers access information about all the songs in our catalog, play music, load playlists, deal with real-time updates and concurrently running clients. This platform needs to run on mobile devices, native Windows, Mac, and Linux clients, and in the browser.

Furthermore, the guts of our web player are also entirely written in JavaScript and deal with real-time communication with our backend as well as all the other things a music player has to do, with some really great optimizations to keep the player as fast and responsive as possible.

That's why we're hiring people with awesome JavaScript skills.

See question on Quora

Posted on 4 February 2013

What are the most interesting HTML/JS/DOM/CSS hacks that most web developers don't know about?

You can create containers that maintain a constant aspect ratio by using padding-bottom as a percentage. The CSS spec says that padding-bottom is defined relative to the *width*, not height, so if you want a 5:1 aspect ratio container you can do something like this:

<div style="width: 100%; position: relative; padding-bottom: 20%;">
<div style="position: absolute; left: 0; top: 0; right: 0; bottom: 0;">
this content will have a constant aspect ratio that varies based on the width.

This is useful for responsive layouts where you want the width to adjust dynamically but want to keep, say, square photo thumbnails.

See question on Quora

Posted on 10 November 2012

How will mobile carriers react to iMessage?

AT&T responded by eliminating all of their metered SMS plans. Before the change you could pay for a certain number of SMS messages sent/received per month (500/1500 I believe).

They changed their rate plans to only have two options:

  • $0.20/message sent/received, no monthly fee
  • $20/mo, unlimited messages sent/received.

For people that receive or send over 100 SMSes per month the unlimited plan is now a better deal, and new customers are unlikely to choose al-la-carte prices when signing up for service. AT&T forces everybody into an extremely lucrative unlimited plan, leading to customers ignoring their SMS usage as iMessage/Facebook Messages/etc begin to take away their traffic.

Most users will never elect to remove the unlimited package from their monthly bill and SMS charges will become even more profitable in the long run as their overall volume decreases to zero.

See question on Quora

Posted on 25 September 2012

Why is JavaScript the only client-side language available?

Before I go on answering your question, I must point out that JavaScript is a pretty darn nice language. If you don't think that, you haven't given it a fair chance. It had lambdas before C#, Java and C++ added it, has higher-order functions, and has .map and .filter built into the language! In ES6, JavaScript gets proper tail calls, making it possible to do full-fledged functional programming. If you can get over the fact that it has some (avoidable) flaws it's a very, very cool language with enormous versatility.

JavaScript has some warts, but so does all languages that has been around for a while and of the same level of popularity. C++ and Java have their fair share of ugly warts, but that always comes with popularity and age. New languages look pretty when they are young, but after years of welding on features and design compromises, they too, would have warts.

The Internet is a cobweb of different technologies cobbled together with duct tape, string and chewing gum. It's not elegantly designed in any way, because it's more of a growing organism than it is a machine constructed with intent.

We engineers always look with dread upon the existing, popular tools (not just programming languages), and see all the horrors of it. Oh, the things that now, with hindsight, could have been made so much better! But you know what, the tools are here, now. They work! And not only that, they are actually pretty darn good. Not as good as the tools of our imagined future, of course, but still very useful.

What we have today might have some glaring flaws, but you just have to work around that if you want to get stuff done during your short time on earth, or you'll be stuck in a loop creating new tools instead of using what you have to help your fellow man. Try to view your flawed, present-day tools as a relationship - your wife, girlfriend or partner will have some pretty big issues no matter how awesome they are, and that is just something that you have to work with, because that is who they are.

But I digress. Your question was why has nobody actually managed to replace JavaScript? There are two reasons.

The first reason is that people simply underestimate how hard it would be to replace. Designing a fantastic, spectacular language would only be 0.0001% of the work. Getting a language to the point where JavaScript is today is a task on the same level of difficulty as solving the Israel-Palestine conflict. Millions of hours of development time and other efforts have been spent to get JavaScript to have the advantages it has today:
  • Built in into all major browsers.
  • Multiple, well-maintained open-source engines available (JavaScriptCore, SpiderMonkey and V8) competing hard for faster and faster interpretation.
  • Incredibly well-known. Few people can code JavaScript properly, but almost everyone that has coded has written some JavaScript.
  • Not controlled by any major player (Apple sacrificed a lot gunning down Flash for this reason).
  • JavaScript has been very well kept as a standard. It is completely unique in that it's 19 years old, yet it has very few language constucts. C++ has an unfathomable amount of language constructs and takes years and years to master. JavaScript enjoys the same perks of maturity (massive documentation, lots of talent around etc) yet can be learned in a few weeks.
But the second, more important reason, is that we seem to want a single language. Java, JavaScript, VBScript and ActionScript were pretty active contenders at different points in time, but after a while, it turned out to be extremely beneficial for, us as an industry, to converge on one platform. It might have flaws, but the massive benefits of so many people working with a single (comparatively simple) language standard seem to outweigh that.

See question on Quora

Posted on 7 July 2012

What does Charlie Cheever think of Node.js?

I think Node.js is cool for mostly the same reasons that everyone else does.

The things that are really appealing about it to me are:

(1) You can use the same language on the client and the server when writing web applications.  In most cases, this probably just means that you don't have to learn two separate languages for web development.  But writing an app in JavaScript does open the really cool possibility of writing some code that can be executed on both the client and the server.  In practice, there are a lot of challenges with this (How do you avoid having to pull in all the library code from your application onto every pageload but still have enough code available for use on the client to do interesting stuff?  How do you deal gracefully with cases where the client needs data from the server to do a computation?), but there are some exciting projects addressing these questions like Meteor and Lunascript.

(2) JavaScript has a lot of momentum as a language.  There is a lot of investment going into improving its performance.  V8 is one of the best, most performant implementations around for a scripting language.  From what I've read, it's faster than almost anything comparable out there except LuaJIT and sometimes PyPy.  There's also likely to be continued investment in making it better and better over time since everyone has to use it in browsers.

Some things that I don't love about it yet:

(1) JavaScript as a language has some warts that are hard to fix because of its popularity and the many implementations that exist across many browsers.  Ex. It's awkward to iterate over an object -- you have to check
to do it properly -- and even though there are things like underscore.js that make this less bad, it's not as clean as Python.

(2) For a lot of things you tend to want to do on the server, it's much easier to think in sequential/serial/synchronous terms, rather than asynchronously, using callbacks.  Node.js started with an almost religious adherence to never blocking on anything, I/O, etc., and so that can nudge you towards awkward programming styles.  From what I've read, Node and its maintainers and community of users have been moving steadily towards a more pragmatic stance on this -- being asynchronous where it makes sense but also supporting sequential programming better, so this may be less and less of an issue going forward.

(3) Library support for a lot of things you want to do on the server isn't as good as languages like Python, Ruby, and Perl yet.  This is getting better every day and I don't think it will be much of an issue in the future, but for now, there are great tools for Ruby and Python, and I'm not aware of as-good debuggers, database interfaces, web frameworks, etc.

The strongest concrete thing I can say about it is that if I were writing an application from scratch and writing my own framework, I would probably first look at Node.js as my base (though I don't think that it provides a huge win over Python on the server + JS on the client and I'm happy with our setup at Quora).  I would be even more excited about this if mobile apps -- with their own set of languages and protocols weren't becoming as important as the traditional web stack, undermining the one-language-for-everything benefit. Overall, I think Node.js is really cool, exciting, and promising and hope to get a chance to use it beyond the playing around I've done so far!

See question on Quora

Posted on 30 April 2012

What's cool about Meteor?

I really think that Meteor is a game changer.
In the words of Ron Burgundy: If you disagree, I will fight you.

Real-time collaboration is awesome.
I think this because I think that real-time collaboration will be THE SHIT in web applications of the future. Real-time notifications and updates like the one in Google Docs, Etherpad, the instant notifications of Quora and Facebook and so on make applications much more engaging and useful. When you see the contributions of other people appear immediately on your screen in response to what you did, it creates an engagement that is just not there in apps that are not real-time.

Creating real-time collaboration apps is ass-hard.
The problem is that building stuff like this is really, really hard. Quora can do it because they have the best people and a lot of them, but a small team simply won't prioritize real-time collaboration.

Meteor makes it super-easy.
The revolutionary thing about Meteor is that it pulls all the awesome that has been happening in various projects (LunaScript, Etherpad, node.js,, Mongo, ember.js etc) into one beautiful package that makes building these kind of applications approachable to mere mortal developers like me.

Exactly 6 hours after I first heard of Meteor I had created and deployed my first application - an app to suggest and vote on where we should eat lunch at work) and had deployed to the free hosting service that meteor provides. This fucker does real-time collaboration with automatic conflict resolution more or less automatically, and it was SO easy. Do you know how INCREDIBLY hard this would be to do from scratch? I sure as hell don't, because I'm to scared to even try.

The guys behind Meteor are gods to me.
Just look at this shit: They have Geoff Schmidt, one of the guys behind LunaScript ( AND David Greenspan, creator of EtherPad ( To me, that is an extreme killer combo that can turn out nothing but awesome, and they are working on this full-time. To them, Meteor is not first-generation, they've already done this before, and learned a lot from it, and I cannot wait how this turns out.

I'm so fucking excited, man! Follow me if you're interested in Meteor, I'm sure I'll be writing tons about it..

See question on Quora

Posted on 13 April 2012

What are the most interesting HTML/JS/DOM/CSS hacks that most web developers don't know about?

A lot has been mentioned here. Just to add a few more:

1. in keyword ( All )
3 in [1,2,3,4] // => true since index 3 exists (not value)
Infinity in window // => true for objects

Also interesting to note that arrays are implemented in JS as associative arrays (which is why the example above works) and are more like shortcuts where the keys are indices and the entries are values.

["a", "b", "c"]["0"] === { "0": "a", "1": "b", "2": "c" }["0"]

2. Neat array functions ( Chrome, FF )
[1,2,3,4].reduce(function(x,y) { return x + y; })
[1,2,3].some(function(x) { return x === 2 });

3. Shorthand anon functions (FF)
(x) => x*x

4. Conversions (All)
Convert/copy arguments array or NodeList to a real array object:
function() {
     args =; // real argument array

Unary operator, which converts a string to a number, shorter and faster than parseInt
+"55" === 55 // => true

Shorter and faster replacement for Math.truncate()
~~27.4 === 27

See question on Quora

Posted on 30 August 2011

What are the most interesting HTML/JS/DOM/CSS hacks that most web developers don't know about?

You can make a triangle with just CSS(just like the tiny triangle on Vimeo sidebar).
.triangle {
    width: 0;
    height: 0;
    border-top: 100px solid #0099ff;
    border-left: 100px dashed transparent;
    border-right: 100px dashed transparent;
    border-bottom: 0;
   display: block;
   overflow: hidden;


Update: fix bugs in fucking IE6, and add a new demo.

See question on Quora

Posted on 18 June 2011

What are the most interesting HTML/JS/DOM/CSS hacks that most web developers don't know about?

1. You can pass arguments into setTimeout and setInterval
Say you want to pass in two variables to the function you call in setTimeout.  You'd probably think this is the only way to do it:

var callback = function(a,b){
    console.log(a + b);  // 'foobar'

    callback('foo', 'bar');
}, 1000);

But you can accomplish the same thing with this: 

window.setTimeout(callback, 1000, 'foo', 'bar');

Note that this isn't supported on IE (not even IE9).

2. Old String functions
If you type in String.prototype into your console, you can see a bunch of old functions you can use to wrap the text in HTML tags (some deprecated HTML obviously):


...will return this:


Similarly for strike(), sub(), small(), link() (Brian Yee refers to this in his comment), etc.

3. An HTML element with an ID creates a JavaScript global with the same name
Surprising but true, and it's done by modern browsers as a means of backwards compatibility:

<div id="someInnocentDiv"></div>

console.log(someInnocentDiv);  // <div id="someInnocentDiv"></div>

4. You can read the text at any XY coordinate on a webpage
var x = 50, y = 100;
var range = document.caretRangeFromPoint(x, y);
if(range) {
    var word = range.startContainer.textContent.substring(range.startOffset, range.endOffset);

A cross-browser compatible way of doing this:

5. You can base64 encode files dropped onto the document from your desktop

document.ondrop = function (e) {
    e.preventDefault();  // prevent browser from trying to run/display the file
    var reader = new FileReader();
    reader.onload = function(e) {
      console.log(;  // base64 encoded file data!

This only works in recent browsers that support the new HTML5 File API:

EDIT: I can't get some of the new line formatting to work, sorry about that!

See question on Quora

Posted on 14 June 2011

What are the most interesting HTML/JS/DOM/CSS hacks that most web developers don't know about?

Some answers to my own question :)

You can quickly run HTML in the browser without creating a HTML file:
Enter this in the address bar:
data:text/html,<h1>Hello, world!</h1>

(This won't work in IE)

You can make a page's CSS editable in the browser without using JS:
<!DOCTYPE html>
<style style="display:block" contentEditable>
body { color: blue }

(This also won't work in IE)

You can have the browser parse a URL for you like this:
var a = document.createElement('a');
a.href = url;

// any property of window.location works here:
document.write('The hostname of ' + url + ' is ' + a.hostname);

(Works in all major browsers)

You can invalidate a URL in the browser's cache by sending a PUT method xmlhttprequest to it:
var xhr = window.XMLHttpRequest ?
    new XMLHttpRequest() :
    new ActiveXObject('Microsoft.XMLHTTP');'PUT', url);

(Works in all major browsers)

You can put multiple statements in an
block without using curly brackets
like this:
if (confirm("Do you wish to see two alerts?"))
  alert(1), alert(2);

(Works in all major browsers)

See question on Quora

Posted on 10 June 2011

What are some good resources for Backbone.js?

Edit on December 7th 2012:

This answer is super old. I keep getting upvotes on it, so people are still finding it useful. However there are a ton more resources out there since this was first published over a year and a half ago.

Besides the official documents and wiki, I suggest that anyone coming across this answer now instead begin with Addy Osmani's very complete guide to developing Backbone apps.

Developing Backbone.js Applications

Besides that, the guides for Chaplin are also pretty good. You don't necessarily have to use the Chapin framework to appreciate the guides. Chaplin also uses a pretty standard approach to class-based inheritance. If you like that approach, you'd also benefit from reading Apple's iOS documents, especially the UIKit documents. A lot of the ideas for iOS apps are transferrable to backbone.js if you are using ideas similar to those in Chaplin.

=== Original Answer ====

After posting this answer, I was asked by Jeremy Ashkenas if I would like to help maintain the Backbone.js wiki. While I will keep my answer below, you should check the backbone.js wiki for the most recent information:

Official Backbone.js Resources

Startups/Apps Built on Backbone.js

Example Apps

OpenSource/Github Projects

Blog Posts & Tutorials

Backbone.js Google Group -

See question on Quora

Posted on 7 March 2011

What are the most important JavaScript concepts to know for a job interview?

You will want to understand, or at least have a passing familiarity with:

  • Closures (seconding Kevin Dangoor)
  • Prototype Inheritance (ibid.)
  • The Module Pattern
  • Aspect Oriented Programming (aka "Duck Punching")
  • Asynchronous Programming
  • Function Expressions vs. Function Declarations
  • For client-side development -- the major inconsistencies between various implementations of the Document Object Model (the infamous DOM).

See question on Quora

Posted on 11 February 2011

What is the best way to educate yourself on HTML, CSS, JavaScript, and AJAX?

Doing beats simply reading every time so: go build a single-page site, now, then improve it as you learn.

Other resources: is a solid starting point, and reading the docs and faqs (and learning about why it includes what it does) is educational. is excellent for best practices and advanced topics. is a great tool to try things out. is excellent. has a fantastic, long list of tons of additional resources.

Finally, while I agree with many of the other answers to this question, I have to disagree strongly with those who have recommended is NOT a trustworthy resource. Its owners are SEO experts and prominently rank for most webdev-related searches, but the quality and accuracy and depth of their content is badly lacking. The awesome people at explain why to avoid w3schools:

We are passionate about the web, learning, and craftsmanship.
We want you, as web designers and developers, to be successful in your careers. We feel, though, that W3Schools is harming the community with inaccurate information. Like any other authoritative educational resource, W3Schools should both hold itself to, and be held to, the highest standards.
We hope we can illuminate why W3Schools is a troublesome
resource, why their faulty information is a detriment to the web, and what you (and they) can do about it.


See question on Quora

Posted on 30 March 2010 search results

Understanding Javascripts role in development.

I have been a developer for a very long time, and I am struggling to understand what is happening with Javascript these days. I was always under the impression that javascript being clientside meant that it was mostly utilized for the interface. Lately I have been reading about react, node and a couple of other libraries and I am struggling to understand javascripts place in the world.

I am still using a backend language to do my data work, sometimes PHP, Python, and or .NET depending upon the client. I am doing mostly visual representation and a fair amount of form validation in javascript.

What is javascripts role in modern program development?

submitted by Bonejob to javascript
[link] [48 comments]

Posted on 20 March 2015

I'm making an RPG in JavaScript! Without canvas! Yes, I'm an idiot!

Update: I got a test version of the current build up and running if anyone wants to check it out!

Controls: Up/W, Down/D, Left/A, Right/D, Enter/Spacebar

Hello there! I am a budding JavaScript developer looking to make a name for himself (read: find employment), and so I decided making an RPG might be a fun way to test out my skills. It's far from finished, but I think I'm far along enough that I can share with people, and hopefully get some feedback!

The GitHub repo:

I'm also getting into the habit of making write-ups of the process:

I don't have screenshots, but here's a really quick video I posted just recently:

I'm posting in /r/javascript primarily to get some constructive criticism on the code aspect of it, not so much the game design aspect. Also, this is technically my first GitHub repo, so if I messed up the setup instructions in any way, let me know.

Any and all feedback is welcome!

Edit #1: A clarification! I work primarily as a front-end developer and UI/UX designer. Hence, my DOM-only approach. I'm using this project as a way to hone my DOM manipulation skills, and have a little bit of fun while doing it!

Edit #2: After some of your feedback, I'm definitely going to refactor some of the code to stop relying on jQuery as a kind of framework.

Edit #3: Thanks for all the support, everyone! There's a lot of really good advice on this thread, and I'm gonna do my best to put it to good use!

submitted by robobeau to javascript
[link] [126 comments]

Posted on 12 August 2014

Do JavaScript app developers typically use object-oriented javascript?

I'm a Java Developer and i'm about to learn JavaScript and AngularJS. Do folks that make full-blown enterprise apps with things like AngularJS tend to use a lot of object-oriented JavaScript or not? I don't find the object oriented features of JavaScript to be very intuitive (i.e. prototypes etc). Do folk actually make a lot of prototypes and use inheritance etc?

submitted by vt97john to javascript
[link] [57 comments]

Posted on 14 July 2014

Javascript Interview Question

What are some common Javascript and problem solving questions that are asked on interviews. Any level of difficulty questions you have been asked? It would be great to have some links and posts about this. Thank You well in advance, anything will help

submitted by arcoboy to javascript
[link] [71 comments]

Posted on 14 June 2014

Why do so many Javascript libraries get this wrong?

And why does no one notice?

All too often I see a promising Javascript library follow this approach to creating classes:

function Library(a, b) { this.publicMethod = function() { return a + b; }; ...etc... } 

Instead of the superior prototypical way:

function Library(a, b) { this.a = a; this.b = b; } Library.prototype = { constructor: Library, publicMethod: function() { return this.a + this.b; } }; 

For those of you who don't understand the difference, in the first (non-prototypical) approach, every time you initialise a new Library object you also unnecessarily recreate every single method. If your class is instantiated a lot and/or has a large number of methods, this will lead to much heavier memory consumption. The other approach only creates the Library methods once to be reused in different contexts (the typical inheritance model), which is much better for memory.

Now the average jQuery plugin isn't going to see a whole lot of decrease in memory consumption by using the prototypical approach, but how has it not been the standard this whole time? It's clearly the intended way of creating anything like a class in Javascript.

I remember years back when I first started learning Javascript, every tutorial I found taught the former approach. I didn't even hear the word prototype until years later. Yet after all these years with Javascript maturing as it has I still run into recent GitHub projects that base it around the obviously inferior design approach. And no one even mentions it in the issues, even on ones with thousands of users and hundreds of contributors.

Maybe I'm missing something here...

EDIT: It seems I've stumbled upon quite a controversial topic in the Javascript community. A lot of really great points here, let's just try to not downvote comments only because we don't agree with them.

EDIT 2: It seems the general consensus is that they each have their appropriate uses. My views have definitely been challenged and I recognise that my opinion was a little flawed. This has been an excellent discussion, thank you!

submitted by poisondwarf to javascript
[link] [116 comments]

Posted on 2 April 2014

Advanced Javascript

I've been working in javascript for 5 years, and I understand prototypal inheritance, scoping, call / apply, and the usual concepts that people consider "advanced". However, I feel like there must be more to learn about vanilla js. What are some hidden features about the language that even the advanced user may not know about?

I'm not very interested in external libraries or upcoming versions of JavaScript, but practical things that I could use (with an optional shim) all the way back to IE7.

Any thoughts?

submitted by pirateNarwhal to javascript
[link] [52 comments]

Posted on 13 August 2013

Is the option to disable Javascript in browsers outdated?

Do you think the option to turn Javascript off in most browsers is outdated?

It seems like more and more of elements of the user experience that users really like and find really useful, necessary, are dependent on Javascript. AJAX is the best example.

All of that gets bollixed up if someone shuts Javascript off. Yes, the programmer can detect if Javascript is enabled, but it seems out of date for browser makers to give the users the ability to shut off a major.....close to being a defacto standard technology, s/he may need.

submitted by cyanocobalamin to javascript
[link] [99 comments]

Posted on 12 August 2013

What are your vanilla JavaScript knowledge standards that every JS developer should know?

I have an interview coming up for a front end position. I have used JavaScript while at uni for the last 2.5 years and am familiar with Modular JavaScript and other design patterns. Also am familiar with scoping in JavaScript and ...inheritance.

What other things would you recommend I brush up on? Your help would really be appreciated!

submitted by js_coder to javascript
[link] [230 comments]

Posted on 7 August 2013

My javascript game as native application for Android, Windows / Linux / OSX

I will be writing some "How to" articles soon but for now I would like to share what I consider finished work - and spawn a few initial thoughts on different platforms / systems.

Quick vine/video of the game if you are wondering is it worth reading.

Link to the game is at the bottom of post - because I mostly want to share my bitter-sweet joy after spending 500+ hours on this title.

Technical details:

  • Done with canvas - supported by my unfortunately named library Canvas Query
  • No DOM/CSS rendering
  • Sound based on Audio element (no WebAudio API)
  • GamepadAPI - w3c/chrome specification

Windows / Linux / Osx - node-webkit

Very pleasant to work - absolutely nothing has to be tweaked. Managed to do both windows and linux packages under Ubuntu (using WINE). Unfortunately for Mac you need OSX. Also you need special build for OSX < 10.7 - alsooooooo your app will not get accepted in Ubuntu Store for Ubuntu > 12 because of some dependencies craziness

Android / IOS - CocoonJS

Everything goes rather smooth if you are creating the game with cocoon in mind from the start - no DOM, first canvas element is screen, some traps like audio.load - pros is that it is WAY faster (thanks to OpenGL) than PhoneGap and other solutions - also you don't need OSX, nor developers account in development process. Cons are that you will loose your hair searching for bugs that are not in your code.

I have failed to make port for IOS because imageData related functions are not working properly - also it kill the app randomly for some reason - also context.arc is broken on IOS.

CocoonJS will support Gamepad API which makes it possible to make OUYA games. If you can't get your game working on IOS - ejecta is an alternative.

Firefox OS

Deploying application is the easiest of all platforms - you just upload some manifest file and voila - no porting at all. However the OS is still too slow to render more complex games like QbQbQb - tho I've been able to run different one in built-in browser (which performance is no-different from native apps) with promising results (but that's not the topic).


Currently my game is available on Humble (bundle) Store and Google play store, Newgrounds, Kongregate. Pending approval for Desura. Rejected by GOG and Rovio stars. Will be trying greenlight. However this is marketing - I am failing hard in this field so won't play wise guy :)

One advice: do not put DEMO in title on Kongregate - even if it is true :) They like/ask to be cheated by disguising demo as a normal version - and then full game is called "SUPER" or "HD" despite it has all the same assets.

I will be trying to find time to reveal little by little details on publishing on different platforms - especially how to build packages for android, ubuntu or making windows installers because this is something that javascript programmer may find extremely repulsive (I DID... it breaks the whole idea of HTML5 portability with browser as a vessel - and I am not yet sure was it the best business decision).

Also to show you a glimpse of how many twists are there check my distribution/ folder structure

The game:

|~o Click this o~|

Also - if you are currently porting html5 game and got stuck on something - ask - maybe I have encountered the same problem and managed to go through.

I will announce articles on /r/javascript but you can follow me on twitter or tumblr

submitted by rezoner to javascript
[link] [60 comments]

Posted on 4 August 2013

Javascript != Java

3rd-party contractor came to visit office yesterday, who has "decades" of experience. Conversation came up about JavaScript in one of our products. He says, "Our product doesn't use Java." After an awkward moment with someone who works on the knowledge base nodding in agreement with him, I speak up and delineate the difference between Java and JavaScript.

Later on in the conversation, the same 3rd-party guy followed up with this jewel: "besides, what would anyone even use JavaScript for on the web?"

I proceeded to disable Javascript in my browser and show him.

tl;dr: lasers, dinosaurs, & drums made a guy's head explode

[edit spelling]

submitted by raiderrobert to talesfromtechsupport
[link] [364 comments]

Posted on 22 May 2013

I'm trying to learn JavaScript, and all of the books I've looked at begin with a heavy dose of binary and memory allocation - is it really necessary to learn this??

I fully understand that in order to be a fantastic, brilliant programmer learning about how the computer converts your code and how much memory it takes to process it could be of benefit, but as a beginning programmer, I feel like it is a great waste of my time (for now) to know that the number 114 is made up of 64 bits. I'm feverishly trying to up my skill set so that I can move out of my horrific tech support job and into the world of programming, and in order to maximize my time, is it okay to skip over this or will it haunt me further down the line?

edit: Thank you for all the feedback, insight, and encouragement! I have ordered Professional JavaScript for Web Developers and The Definitive Guide from Amazon. They won't be here for another week, so in the meantime, I am 25 pages into homoiconic's book JavaScript Allonge (a very clever and informative read!) and I'm pressing on :)

submitted by have_u_restarted_it to javascript
[link] [131 comments]

Posted on 1 February 2013

If JQuery is so easy to implement, why learn vanilla javascript?

So im learning front end development as i go along, and i've been asked by some clients to include things like accordian and datepicker UI elements of JQuery. Im really struggling with the code academy exercises and am beginning to ask myself 'do i really need to learn vanilla javascript if everyones using libraries anyway?'. What possible use could vanilla have these days?

Also, should i be doing more than just doing the exercises on code academy? i.e read books on jscript/work on some sort of basic project?


Edit : Why downvote? I've been doing front end coding for 2 months now so i really dont know that much. Help a guy out!

Edit 2 : Some great posts here guys. Thanks for you input. In hindsight I maybe should have stated my aspirations ; I dont desire to be a programmer. I don't find writing code for the sake of it fun, HOWEVER, I do get inspired by browsing and seeing beautiful websites with such interactivity and fluidity. I want to be able to make visually stunning websites as opposed to soley being a 'programmer' in the traditional sense if you understand. Thanks again.

submitted by jsthrow to javascript
[link] [114 comments]

Posted on 8 November 2012

r/javascript is not Stack Overflow

I don't know how other users of r/javascript feel about this, but I think this should be a forum for discussion of Javascript itself and sharing interesting examples.

Every day new threads hit the top of the page which are just asking for help with, or critique of code. IMO, these kinds of posts belong in a different forum, preferably Stack Overflow, a link to which is posted right over there --->

Am I being a fusspot? How do other people feel about this?

submitted by mitchellrj to javascript
[link] [115 comments]

Posted on 23 October 2012

Suggestions for attacking tech debt in the javascript?

Like many developers, I'm on a team with a lot of people interested in the back-end. What I've noticed is that tech debt accumulates more quickly in our front-end than anywhere else. It is here that devs seem more likely to let mediocre code slide and have the least expertise. Most of us have read 'Javascript: The Good Parts' and have years of experience writing javascript. The problem is, we've been writing it second-class, and we haven't accumulated the expertise I feel is necessary to write a decent FE component.

I know that's all rather vague, but I hope it gets at the what I'm trying to ascertain. If not, here are some specific questions:

  • What practices are critical to writing better javascript?
  • At this point in our education, would adopting a framework like backbone.js facilitate or inhibit our growth?
  • How have you succeeded in legitimizing javascript at work? How have you failed?

Thank you.

submitted by Carnilawl to javascript
[link] [31 comments]

Posted on 18 June 2012

What program do you use to write Javascript?

I hope you guys don't get this a lot. Currently I'm using Dreamweaver code mode, but there's got to be a better tool out there for OO Javascript right?

Edit: Thanks for the advice guys, I'm going to give a couple of these a shot.

Also, I was going to ask for some up-votes, so that this would be more prominent on /r/javascript, but then I remembered it was /r/javascript. 2 is enough.

submitted by 90yoboy to javascript
[link] [139 comments]

Posted on 9 August 2011

Recommendations for mastering JavaScript.

I'm making it a goal of mine to master JavaScript and was hoping someone else had done the same and wouldn't mind sharing their regime.

EDIT: ** **I've created a new post to host all the references from this post. Find it here.

EDIT: Thanks guys. I've compiled a list of references mentioned here. I appreciate all your contributions.

  1. Anything written by Douglas Crockford. This includes: JavaScript: The Good Parts and YUI Theater
  2. Read other people's code, jQuery source, Node's source, etc.
  3. Understand JavaScript before becoming dependent on libraries (eg. jQuery, Prototype).
  4. Addy Osmani's Javascript 101 audio course
  5. Build Things - "think of something cool, and try and build it."
  6. Participate at StackOverflow.
  7. References -o- plenty: Gecko DOM Reference, HTML and DHTML Reference, Yahoo! YUI Theater, HTML DOM Tutorial, Annotated ECMAScript 5.1, JavaScript, JavaScript Blog

  8. And finally, Lord loves a working' man, don't trust whitey, and see a doctor and get rid of it.

submitted by fl0at to javascript
[link] [93 comments]

Posted on 21 February 2011

Javascript is NOT a bad language

Venting here. I'm sick of hearing that Javascript is a bad language. It's not perfect (what language is?) but it is quick and easy to write clean, flexible and reusable code. It's extremely well documented. It has some sweet debugging tools (these days). I love the powerful dynamic nature of it, and the event driven programming that it enables. Occasionally I sit down with people that "used to do some Javascript back in the day", people who were left with a bad taste in their mouth. Together we (ok, mostly me) hash out some clean, concise, and readable Javascript... and I laugh as they slowly realize that they don't know as much about it as they thought they did.

I love Javascript. It's the web browsers that I usually have issues with.

submitted by spiderworm to javascript
[link] [83 comments]

Posted on 29 December 2010