24 April 2014

The Ruby Reflector

Topic

DOM

  Source Favicon
Email

…it is inherently asynchronous. In most code, this begins and ends with event handlers on individual DOM elements. This can be better abstracted if we think about the larger interactions a user can take, and represent that as a single asynchronous operation in the code.

A user may or may not be signed in. We could expose that, and let that conditional bubble throughout our code. However, most of the time, if a user isn't signed in, we're just going to prompt them to sign in. That means …

robots.thoughtbot.com Read
  Source Favicon
Email

jquery-ujs wires event handlers to eligible DOM elements to provide enhanced functionality. In most cases, the eligible DOM elements are identified by HTML 5 data- Attributes .

Let's have a look at the progressive enhancements jquery-ujs provides.

POST, PUT, DELETE Links <%= link_to 'Delete', item, method: :delete %>

Clicking a link will always result in an HTTP GET request. If your link represents an action on a resource it may be more semantically …

robots.thoughtbot.com Read
  Source Favicon
By Nate Hunzaker of Viget.com Blogs 6 months ago.
Email

…= 'destination-in';

// Apply the mask ctx.drawImage(mask, 0, 0);

ctx.restore(); }

requestAnimationFrame(function loop() { requestAnimationFrame(loop.bind(this)); drawMaskedVideo(); });

As for the original <video> tag, there are a couple of ways to hide it. However on haunted-hills.com we actually don't even attach the <video> tag to the DOM. I've demonstrated this in the following prototype. Enjoy!

viget.com Read
  Source Favicon
By Assaf Arkin of Labnotes 6 months ago.
Email

…makes working with your SVG assets as easy as jQuery makes working with the DOM".

Startup Life

Entrepreneur PSA - Advertising Businesses are Hard : you'll need volume, suffer through long sales cycles, and most will not be repeat customers.

@ kvnsmth captures what software startups are like, circa 2013:

"I'm going to spin up another company soon."

None of the Above

Creative Mom Turns Her Baby's Naptime Into Dream Adventures …

blog.labnotes.org Read
  Source Favicon
By Giles Bowkett of Giles Bowkett 7 months ago.
Email

…to my mind was my own mini-app, Hacker Newspaper , because it had a tiny DOM and zero dynamic elements. So I got in the habit of having that open in iOS at all times. Then I wrote another mini-app which loaded even faster, an hourly tracker for the Bitcoin exchange rate , and I got in the habit of having that constantly open on iOS instead. This habit made me a little money , but I didn't really want to be constantly aware of the Bitcoin exchange rate, and …

gilesbowkett.blogspot.com Read
  Source Favicon
By Jacob of Heroku 7 months ago.
Email

…the client. Client-side JavaScript running in your browser updates the DOM every time a new value is received. This is a very simple example meant to demonstrate the most basic WebSocket functionality.

Next we'll look at a more interesting example of what you can build with WebSockets.

WebSocket Geolocation App

The map below uses WebSockets and the browser Geolocation API to plot a point for every client currently viewing this post. The Node.js app powering this map …

blog.heroku.com Read
  Source Favicon
By miraculous1 of mir.aculo.us 7 months ago.
Email

…borders can't just be "0.5px" high (the CSS px unit requires integers, and DOM elements always are positioned on integer-based coordinates as well). One workaround are scaled CSS background images.

In the following example the data URL contains a 2px high PNG image that has a transparent upper pixel, and the pixel in the color I want the hairline to be as the lower pixel. An other way, which has the advantage of allowing you to easily customize the color but is slightly …

mir.aculo.us Read
  Source Favicon
On Labnotes 8 months ago.
Email

Don't use nesting, element selectors, or excessive pseudo-selectors - they enforce DOM structure in your CSS.

§ Unibox is a curated HTML, CSS, JS UI Component Library :

In order to get into UIBox, every UI component must meet a few requirements:

Must have a working demo page.

Must be documented atleast well enough to get it working without much trouble.

Once I find a component that meets those requirements, I will test those UI components myself and find …

blog.labnotes.org Read
  Source Favicon
By miraculous1 of mir.aculo.us 9 months ago.
Email

…transfers about 14KB of HTML, but even if the cache is empty, it takes less than 200ms for the DOM to be ready (this is with all extra JavaScript that's loaded for analytics and whatnot):

Freckle (empty cache): 34 requests ❘ 699 KB transferred ❘ 1.90 s ( onload: 875 ms, DOMContentLoaded: 196 ms)

Freckle (primed cache): 30 requests ❘ 14.2 KB transferred ❘ 1.22 s ( onload: 202 ms, DOMContentLoaded: 56 ms)

Here's a few of our competitors …

mir.aculo.us Read
  Source Favicon
By wycats of Katz Got Your Tongue? 11 months ago.
Email

CSS by writing a full selector engine and application engine, and apply rules via .style as the DOM changes. With mutation observers, this might even be feasible. In fact, this is how some of the most devious hacks in the platform today (like the Polymer Shadow DOM polyfill) actually work.

That kind of "extensibility" doesn't fit the bill. It doesn't compose well with other extensions, defeats the browser's ability to do performance work on unrelated parts of the …

yehudakatz.com Read