background preloader

Javascript

Facebook Twitter

Calipers: The Fastest Way to Measure Image Dimensions in Node. Every JPG, PNG and PDF file passed to Lob’s Print & Mail API is measured to guarantee that the dimensions of the provided file match the dimensions of the medium.

Calipers: The Fastest Way to Measure Image Dimensions in Node

For example, 4.25”x6.25” postcards requires an image of at least 1275 x 1875 pixels, and a PDF document with a page size of 8.5” x 11” is required for letters. A common way to retrieve the dimensions of images and PDFs is to use the premier tool for working with images, ImageMagick’s identify tool.

However, dealing with the huge volume of files we receive every day revealed performance issues when using ImageMagick. To improve the performance of our API, we built Calipers, a simple and performant node module for measuring the dimensions of JPG, PNG, and PDF files. It is important to note that the measurements we take on images take place during the life-cycle of a single API request.

Calipers Source Code Benchmarks ImageMagick Performance There were two main factors limiting the performance when shelling-out to ImageMagick. Clipboard.js — Copy to clipboard without Flash. Jwagner/smartcrop.js. ES6 Overview in 350 Bullet Points. Apologies about that long table of contents, and here we go.

ES6 Overview in 350 Bullet Points

ES6 – also known as Harmony, es-next, ES2015 – is the latest finalized specification of the languageThe ES6 specification was finalized in June 2015, (hence ES2015)Future versions of the specification will follow the ES[YYYY] pattern, e.g ES2016 for ES7Yearly release schedule, features that don’t make the cut take the next trainSince ES6 pre-dates that decision, most of us still call it ES6Starting with ES2016 (ES7), we should start using the ES[YYYY] pattern to refer to newer versionsTop reason for naming scheme is to pressure browser vendors into quickly implementing newest features (back to table of contents) A new primitive type in ES6You can create your own symbols using var symbol = Symbol()You can add a description for debugging purposes, like Symbol()Symbols are immutable and unique.

Time for a bullet point detox. Then again, I did warn you to read the article series instead. Cdnjs - the missing cdn. LLJS : Low-Level JavaScript. Home · kripken/emscripten Wiki. AltJS compile-to-JavaScript language list. Js2coffee: convert JavaScript code to CoffeeScript. About php.js. Php.js is a resource that offers community-built JavaScript alternatives to PHP functions.

About php.js

Why on earth would you port php to js? To see if we canto learn JavaScriptto help others learn JavaScriptto see how php scripts perform with V8 strapped on their backsto profit from helpful functions like: strip_tags, strtotime, md5, strftime, number_format, wordwrap, vsprintf, and date, that are too high-level for JavaScript. PHP is a language with many high-level functions and while they’re not always implemented as consistently as we’d like (mimicking their underlying C parts), they do get many programming jobs done without the need for additional libraries or abstraction. We recognize JS has beautiful language features, and we encourage you to learn them (never let php.js be an excuse not to!).

That said, we do think it’s a challenge to port everything and decided to also port low-level PHP functions like strpos that have perfectly good (and more performant!) And what not. Contributing Licensing. New Tricks in XMLHttpRequest2. Introduction One of the unsung heros in the HTML5 universe is XMLHttpRequest.

New Tricks in XMLHttpRequest2

Strictly speaking XHR2 isn't HTML5. However, it's part of the incremental improvements browser vendors are making to the core platform. I'm including XHR2 in our new bag of goodies because it plays such an integral part in today's complex web apps. Turns out our old friend got a huge makeover but many folks are unaware of its new features. This tutorial highlights some of the new features in XMLHttpRequest, especially those that can be used for working with files.

Benvie/continuum. New Tricks in XMLHttpRequest2. About php.js. Js2coffee: convert JavaScript code to CoffeeScript. AltJS compile-to-JavaScript language list. Omniscient.js. Intercooler.js - Simple, declarative AJAX using HTML attributes. Esprima. Opal: Ruby to Javascript Compiler. C#-to-JavaScript compiler. jQuery Mobile.