background preloader

Advanced

Facebook Twitter

Ember Components: A Deep Dive. Ember.js is a JavaScript MVC framework that allows developers to create ambitious web applications.

Ember Components: A Deep Dive

Although pure MVC allows a developer to separate concerns, it does not provide you with all the tools and your application will need other constructs. Packaging Ember Libraries. Ember computed meta properties. Ember and D3: Building a simple dashboard. Boston Ember - August 2013. Ember and D3 - Sep 2013 by Sam Selikoff. Interactive dashboards Audience Beginner to intermediate D3Little to no experience with JS MV*Want to incorporate D3 into applications (e.g., a dashboard)Curious about Ember!

Ember and D3 - Sep 2013 by Sam Selikoff

So, You're leveling up in D3 Why use a framework? Like in everything... Separation of concerns Store your data somewhereHandle eventsWill you want routing? Why reinvent the wheel? Ember + D3 == "the future" of visualization? It has been a long while since I attended a talk as engaging and relevant as "Ember and D3 Interactive Dashboards" by Sam Selikoff at the Boston D3 Meetup.

Ember + D3 == "the future" of visualization?

He presented a thoroughly elegant approach to developing Web-based interactive data visualization systems. The approach involves merging the Ember.js MVC API with reusable D3 visualizations coded using the API style described in Mike Bostock's "Towards Reusable Charts". The result is a stunningly elegant system that manages to solve many reoccurring implementation challenges that come up when building interactive Web-based data visualization systems. This approach fits particularly well with systems involving multiple linked views and extensive UI elements for various filtering and selection options.

I built an interactive visualization dashboard with multiple linked views this summer for Rapid7.

Performance

SEO in JS Web Apps. JavaScript and search engines have always had a tricky relationship, and SEO is often used as an argument against single page applications.

SEO in JS Web Apps

I’m aiming to put some of those misconceptions to rest in this article and show you that it’s perfectly possible to create a pure JavaScript web application and still have good SEO. To demonstrate, take a look at the search results for Monocle, a single page web app. You can see that even though the application relies on JavaScript, articles are still getting fetched and indexed correctly. While there are indications that Google’s spiders can index some urls they find in JavaScript, in my experience they haven’t been able to render and index complex JS web apps without a little help. The key to spidering JS apps lies in Google’s Ajax crawling specification. Firstly, add the follow meta tag onto every page that needs to be spidered: This will instruct Google’s spider to use the Ajax crawling specification with your site.

Kudos. Observing Enumerables & Arrays with Ember.js. If you’ve built an app in Ember.js, by now you will be familiar with observers.

Observing Enumerables & Arrays with Ember.js

Observers watch a given path (or paths), and run a function when the value at that path changes: Enumerables (a group of items without order) and arrays can be observed in the same manner: However, Ember also provides a set of observers that share details about which items in an enumerable or array changed. Say hello to addEnumerableObserver and addArrayObserver. The API documentation for these functions isn’t that great, but they are fantastic and powerful tools once you learn how they work. Enumberable observers [docs here] give you a simple way to see objects added into a list or being removed. Before an enumerable is changed, a “will change” callback is run.After an enumerable is changed, a “did change” callback is run. The events receive different arguments: “will change” callbacks receive the enumerable, the objects being removed, and the number of objects that will be added. By Matthew Beale. Bindings on ObjectController - Ember.js.

The architecture of Ember.js apps - statecharts. For last 5 months, I've been working with Ember.js (previously called SproutCore 2.0) on building an app for one of our clients.

The architecture of Ember.js apps - statecharts

And since that time, we've estabilished what I think is a pretty solid and clean application architecture and I would like to it describe here. Please take a note that this is not intended to be introductory post to Ember.js, nor the guide to statecharts or MVC. It's intended for people who have some experience with the framework and who know the Ember object model, bindings, and other stuff. Change connectOutlet API to prefer Strings · be69395 · emberjs/ember.js. Ember.js Router API v2. This gist is outdated!

Ember.js Router API v2

For the most up-to-date information, please see An Ember application starts with its main template. Put your header, footer, and any other decorative content in application.handlebars. <header><img src="masthead"></header><footer><p>© Joe's Lamprey Shack - All Rights Reserved</p></footer> If you already know CSS, awesome! You may have noticed something missing in the above template. <header><img src="masthead"></header><div class="content"> {{outlet}} </div><footer><p>© Joe's Lamprey Shack - All Rights Reserved</p></footer> As your user navigates around the page, you will render templates into this outlet.

Let's start by defining what happens when the user navigates to /, the application's home page. Advanced Ember.js Bindings - holy moly. Bindings are one of the killer features of Ember.js.

Advanced Ember.js Bindings - holy moly

When you use the framework your are likely to use this good stuff probably via adding a Binding to your property name, like valueBinding: 'App.controller.value'. There are some enhanced ways of using bindings which are covered in this blog post. I’ll show how you can create bindings which transform values, convert a value to a boolean and how chained bindings work. Hey! Ember Noob: Beginning the Ember.js Journey.

I'm not starting this blog about Ember.js because I'm an expert.

Ember Noob: Beginning the Ember.js Journey

I'm starting it because I'm not. The Current Situation Me Not only am I new to Ember.js, I'm also new to JavaScript and jQuery , so I'm having to figure out a whole lot of stuff at multiple levels of the development stack all at once. This is incredibly daunting, but it means I'm in a position to communicate effectively with others going through the same experience — and with the recent growth in the popularity of and demand for client-side apps, there are a lot of people out there like me, especially in the Rails community (my preference for the server-side). Tools. Ember Noob: Ember.js Tools & Resources 1 — Official Libraries. Dependencies jQuery A JavaScript utility library so useful and important that most of the major websites in the world now include it, and most major JavaScript projects build on top of it.

Ember Noob: Ember.js Tools & Resources 1 — Official Libraries

If you're not already familiar with it, take an hour or two right now to fix that. I'm no fan of Microsoft, but the best videos for newcomers to jQuery I've seen are chapters 14-17 of this series . Ember Noob: Ember.js Tools & Resources 2 — Official Docs & Starter Kit. Documentation Official docs (all on the website) include the API docs, the giant "documentation" page, and the guides. They are all inconsistent and out-of-date to varying degrees due to the rapidly-changing nature of the project. Ember Noob: Ember.js Tools & Resources 3 — Community. Many of these resources are less than a month old. This is not just because I left out the older stuff due to out-of-dateness, but also because there's been a lot of growth lately in the landscape around the Ember.js core. (Like this blog!) Aggregators. Ember Noob: Ember.js Tools & Resources 4 — jsFiddle.

You've hopefully heard of Gist ( gist.github.com ), the service that lets you dump some code into a box, hit save, and get a URL that you can share with others — without even logging in. (It has more cool features, but I couldn't find docs or a tutorial to link to...) Well, jsFiddle is like Gist on steroids. Not only can you dump code and get a shareable URL, you can execute the code, play with it, and save new versions as you go. You can even give them names and collect them under your user account (if you're logged in) for your future convenience and others' benefit. Lastly, others can easily fork your fiddle in order to modify and re-share it. It's an essential tool for experimenting with client-side code (which is what we'll be using it for in this blog), as well as hosting client-side miniapps to share with others when reporting bugs or asking for help. Debugging. Ember Noob: Ember.js Debugging 1 — Firefox.

Note: Debugging was going to part 5 of the "Tools & Resources" series, but when I started outlining it and doing additional research, it became apparent that it's simply too big a topic for that. I've instead spun it out into a separate series. This post is about the tools built-in to Firefox which are relevant to debugging Ember.js apps. I'll be using the latest version, which is 15 as of this post. Mozilla Development Network The MDN site is incredible — a wealth of information about everything a web developer could want to know about the browser platform: However, the most important section (for us) isn't linked from here — or anywhere else on the site that I could find.

Ember Noob: Ember.js Debugging 2 — Firebug. Firebug is a legendarily awesome Firefox add-on with just about everything a web developer could want. It has equivalents for almost all features in the built-in tools, and much more. Ember Noob: Ember.js Debugging 3 — JavaScript. I already covered the console object, which is built-in to the browser and is essential for debugging your Ember apps. The Emberist: {{bind}} and {{bindAttr}} I've noticed recently that there's been some confusion about {{bind}} and {{bindAttr}} in Ember. Both of these helpers serve the same purpose, to bind properties into your templates, so why do we have two versions? To understand this a better, we need to know a bit about how {{bind}} works behind the scenes. NOTE: {{bind}} is the default helper. If you do {{propName}} it's the same as doing {{bind propName}}.

Mixins

Ember.js Live Collections « Thomas Reynolds. Understanding Ember.Object. Bootstrap your Ember.js application - Neethack. Advice on & Instruction in the Use Of Ember.js. Ember.js how to display different filtered lists for a view? complex setup. Eight Ember.js Gotchas With Workarounds - CodeBrief.