A few years ago, I wrote about how we can use css to style broken images. The technique leveraged on the fact that any styling to the ::before or ::after pseudo-elements on the <img> element will only be applied if the image doesn’t load. So, we could style those elements and they would only display if the image was broken.

Here’s an example of how I’ve styled broken images on this site:

There are pros and cons to handling broken images this way. One limitation is browser support, as this technique doesn’t work in some major browsers like Safari.

Having recently done a lot of work with service workers, it occurred to me that we could use the service worker to handle broken images in a different way. Since the service worker can tell if an image file isn’t able to be fetched, we can handle that condition by, for example, serving a different image to the browser.

JavaScript is the main cause for making websites slow. Ten years ago it was network bottlenecks, but the growth of JavaScript has outpaced network and CPU improvements on today's devices. In the chart below, based on an analysis from the HTTP Archive, we see the number of requests has increased for both first and third party JavaScript since 2011.

The following chart shows the growth in the total size of JavaScript from 2011.

Certainly the amount of JavaScript has increased. Total number of requests went from 9 to 18, and total size increased from 85 KB to 364 KB. (These are medians from the world's top ~1.3 million sites tested on desktop.) It's interesting to see that the size of scripts is growing more rapidly than the number of scripts - we're packing twice as much code into each script compared to 7 years ago.

Like many other open source projects, the Visual Studio Code community collaborates through pull requests to land fixes and new features. Starting this past spring, our team has been working to bring you a new integrated pull request experience so that you can collaborate, comment, review, and validate GitHub pull requests directly from within Visual Studio Code.

Today, we are announcing the public preview of GitHub Pull Requests for Visual Studio Code, closing a gap in the workflow that we and millions of engineers experience every day: The ability to review source code where it was written – inside the editor.

Someone could talk for days on end trying to answer that with some form of completeness. How deep will they go? Strictly for fun, I'm going to put my answer here. When I was asked this in an actual interview, I rambled on for a good 10 minutes before they stopped me. And then I kept remembering things I forgot to include even after the interview finished.

I'm going to keep this formatted as a wall of text because that's how it felt to answer this question in conversation.

For everybody who engages with our journalism, theguardian.com is an industry-best news website that is fast, accessible and easy to use. Unlike other ways of developing products, ours puts the audience first.

These principles apply to all requests on www.theguardian.com and api.nextgen.guardianapps.co.uk (our Ajax URL)

On the server

Every request can be cached and has an appropriate Cache-Control header set.

Each request may only perform one I/O operation on the backend. (you cannot make two calls to the content API or any other 3rd party)

Threats to users’ privacy and security are growing. At Mozilla, we closely track these threats. We believe we have a duty to do everything we can to protect Firefox users and their data.

We’re taking on the companies and organizations that want to secretly collect and sell user data. This is why we added tracking protection and created the Facebook container extension. And you’ll be seeing us do more things to protect our users over the coming months.

Two more protections we’re adding to that list are:

DNS over HTTPS, a new IETF standards effort that we’ve championed

Trusted Recursive Resolver, a new secure way to resolve DNS that we’ve partnered with

The @Cloudflare team just pushed a change that improves our network's performance significantly, especially for particularly slow outlier requests. How much faster? We estimate we're saving the Internet ~54 years *per day* of time we'd all otherwise be waiting for sites to load.

10 million websites, apps and APIs use Cloudflare to give their users a speed boost. At peak we serve more than 10 million requests a second across our 151 data centers. Over the years we’ve made many modifications to our version of NGINX to handle our growth. This is blog post is about one of them.

Please register on football-data.org to get your API Key. Then run $ sudo football config to add your API Key. Requests made using API key increases your rate limit from 50 requests per day to 50 requests per minute.

Usage

Get scores of past and live fixtures

Get upcoming and past fixtures of a league and team

Get standings of particular league

List of codes of various competitions

Change configuration and defaults

Note

For World Cup fixtures, you need to specify league flag with value as WC. API does not provide world cup information in consolidated response and is a known bug.

Your ultimate productivity pair is getting even better. The GitHub and Slack app has a few new features to help you turn conversations into next steps. Take action on pull requests, issues, and more right from your Slack channels to start moving work forward, faster.

Slash commands

Slack conversations often lead to decisions and actionable takeaways. Now it’s easier to start on next steps from Slack with slash commands for common GitHub actions, using /github [action] [resource]. These commands let you:

So you're curious in learning this new thing called Reactive Programming, particularly its variant comprising of Rx, Bacon.js, RAC, and others.

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

With Valentine’s Day around the corner, it is a time for romantic hopefuls to ask out the object of their affection, and await an answer. It could be a simple “yes,” a sad “no,” or a cryptic “I don’t think about you that way, but maybe we can grab a coffee tomorrow?”

Which brings us to HTTP (Hypertext Transfer Protocol) codes . When a URL is typed in a browser, a request is sent out to the server and the browser awaits an answer, just like in our scenario. These answers come in the form of an HTTP code, which is a three-digit number that maps to an answer.

With the image of Valentine’s Day in mind, here are a few likely scenarios.

A Service Worker is a script that executes in the background, in a separate thread from the browser. They enable deeper platform integration for the web, like rich caching, push notifications and background sync. Service workers are designed to be an extensible platform, additional features are currently being planned.

Service workers are have been called a game changer for the web. I don't think that is a simple exaggeration, because they enable many much needed capabilities and make the core architecture I have been using the past 7 years native.

Service Workers sound amazing!

How Do Service Workers Work?
... read the whole story at love2dev.com.

Exactly one year ago today, Cloudflare gave me a mission: Make it so people can run code on Cloudflare's edge. At the time, we didn't yet know what that would mean. Would it be container-based? A new Turing-incomplete domain-specific language? Lua? "Functions"? There were lots of ideas.

Eventually, we settled on what now seems the obvious choice: JavaScript, using the standard Service Workers API, running in a new environment built on V8. Five months ago, we gave you a preview of what we were building, and started the beta.

Today, with thousands of scripts deployed and many billions of requests served, Cloudflare Workers is now ready for everyone.

I’ve been playing around with ServiceWorker a lot recently, so when Chris asked me to write an article about it I couldn’t have been more thrilled. ServiceWorker is the most impactful modern web technology since Ajax. It’s an API that lives inside the browser and sits between your web pages and your application servers. Once installed and activated, a ServiceWorker can programmatically determine how to respond to requests for resources from your origin, even when the browser is offline. ServiceWorker can be used to power the so-called "Offline First" web.

ServiceWorker is a progressive technology, and in this article, I'll show you how to take a website and make it available offline for humans who are using a modern browser while leaving humans with unsupported browsers unaffected.

Development teams often use Slack to coordinate work together on GitHub projects–ourselves included—but following all of your team’s GitHub activity in Slack channels can get difficult as teams grow. To make it easier, we've partnered with Slack to bring you a new GitHub and Slack app. Together, GitHub and Slack are your ultimate productivity pair, providing greater visibility into development work, right alongside your team’s conversations.

If you’re using a previous version of the GitHub and Slack app, install the new app to upgrade today.

Stay up-to-date

The new Slack app brings GitHub activity right into your Slack channels to keep your teams up-to-date and productive. Subscribe to a GitHub repository from any Slack channel with slash commands (

AJAX

“Without reloading the page” is the key sentence here. AJAX stands for Asynchronous JavaScript And XML because initially, the data returned from the server is supposed to be in XML. However, it’s easier to send them in JSON, which JavaScript likes more.

We are going to use AJAX to send an email. You cannot do it from the front-end, so you have to call the back-end. Usually, we would send a POST request to the server, handle it and redirect the user back to the page with the form. In this iteration, we don’t want to reload the page. Instead, we are calling the backend directly where we’re going to capture the form data with JavaScript, then send an asynchronous request to the server to handle the response.

Is it consistency? Enforcing a set of standards and best practices on your code through linter rules and formatters? How about ensuring your code has tests that run automatically during your build process? What about pull requests and code reviews — protecting your master branch from direct commits and having peers review your code?

They’re some of the things that come to mind for me. Automated processes and manual checks. Smart and efficient. Yet, while they’re all useful, they really only address half of the problem.

Automation is crucial for maintaining code quality. Static analysis of your syntax with a linter and automated testing should be mandatory. But I can write code that passes all the automated processes without any guarantee to its actual quality.

While developing a new project is like rolling on a green field for you, maintaining it is a potential dark twisted nightmare for someone else. Here's a list of guidelines we've found, written and gathered that (we think) works really well with most JavaScript projects here at hive. If you want to share a best practice, or think one of these guidelines should be removed, feel free to share it with us.

1. Git

There are a set of rules to keep in mind:

Perform work in a feature branch.

Why:

Because this way all work is done in isolation on a dedicated branch rather than the main branch. It allows you to submit multiple pull requests without confusion. You can iterate without polluting the master branch with potentially unstable, unfinished code.

You can access paths just like you can link to parts of a website. For example, to get a list of all posts tagged under “JavaScript” on Smashing Magazine, you navigate to https://www.smashingmagazine.com/tag/javascript/. https://www.smashingmagazine.com/ is the root-endpoint and /tag/javascript is the path.

To understand what paths are available to you, you need to look through the API documentation. For example, let’s say you want to get a list of repositories by a certain user through Github’s API. The docs tells you to use the the following path to do so:

/users/:username/repos

Any colons (:) on a path denotes a variable. You should replace these values with actual values of when you send your request. In this case, you should replace

While developing a new project is like rolling on a green field for you, maintaining it is a potential dark twisted nightmare for someone else. Here's a list of guidelines we've found, written and gathered that (we think) works really well with most JavaScript projects here at hive. If you want to share a best practice, or think one of these guidelines should be removed, feel free to share it with us.

1. Git

There are a set of rules to keep in mind:

Perform work in a feature branch.

Why:

Because this way all work is done in isolation on a dedicated branch rather than the main branch. It allows you to submit multiple pull requests without confusion. You can iterate without polluting the master branch with potentially unstable, unfinished code.

The Vary HTTP header is sent in billions of HTTP responses every day. But its use has never fulfilled its original vision, and many developers misunderstand what it does or don’t even realize that their web server is sending it. With the coming of the Client Hints, Variants41 and Key38 specifications, varied responses are getting a fresh start.

The story of Vary starts with a beautiful idea of how the web should work. In principle, a URL represents not a web page, but a conceptual resource, like your bank statement. Imagine that you want to see your bank statement: You go to bank.com and send a

If you work even remotely near the web dev industry, you're 100% sure to hear these three infamous letters: API.

They get thrown around by n00bs and experts alike:

"Why do I have to make an API call? Does it have a number?"

"A simple call to this third party API will do the trick here."

"We'll build you a RESTful API; making sure your new system plays well with other services."

While APIs may first seem intimidating, they can literally change your life as a developer.

Why? Well, learning how to use APIs properly can simplify, accelerate, and strengthen your development workflow. Building or integrating APIs brings a fair share of benefits for both clients and yourself.

Node.js 8.4.0 just arrived with the experimental support of HTTP/2, which you can enable by using the --expose-http2 flag.

In this blog post, we will introduce the most important aspects of HTTP/2 Server Push and create a small Node.js app that gains benefit from using it.

About HTTP/2

The primary goals for HTTP/2 are to reduce latency by enabling full request and response multiplexing, minimize protocol overhead via efficient compression of HTTP header fields, and add support for request prioritization and server push.

Whether you’re working on an open source project or building a software company, chances are you can simplify your work with GitHub Apps. In May, we launched GitHub Marketplace—a place where you can easily discover, purchase, and integrate new tools that customize your workflow. Today, we’re launching seven new apps in Marketplace and four new categories: Dependency Management, Localization, Security, and Time Tracking.

Code quality, Code review

Better Code Hub provides development teams with immediate, relevant feedback on code quality. It checks a code base against ten guidelines for maintainable software, delivering actionable recommendations and helping your team get to a shared definition of done. A score of ten out of ten indicates you’re performing among top development teams within the industry.

Performance is a core feature of Algolia. Our search engine delivers millisecond results across millions of records. It was originally designed for mobile devices where the resources are very limited, but was after transformed into an online API that now runs as an NGINX module. Our front-end libraries are written in a way that allows us to express that same speed on the client and ensure a high quality experience across devices. Algolia’s engine and integrations are a great benchmark and an inspiration for performance, so we wanted to mirror that excellence in performance of our website.

Our website is the face of our product. It’s the medium that’s used to present ourselves and the product. It is the first impression that many people get of Algolia. And to embody that core feature of speed we wanted to make sure we go an extra mile on our website as well.

Angular version 4.3.0-rc.0 is now available. In this release, we can see a new exciting feature we all waited for — an improved version of the HTTP client API.

HttpClient is an evolution of the existing Angular HTTP API, which existsalongside of it in a separate package, @angular/common/http. This structureensures that existing codebases can slowly migrate to the new API.

First of all, we need to update all of our packages to version 4.3.0-rc.0.

Next, we need to include the HttpClientModule in our AppModule.

Now we are ready. Let’s see three new things we’ve all been waiting for.

JSON is an assumed default and no longer needs to be explicitly parsed.

While effective code review is essential to every successful project, it's not always clear who should review files—even with GitHub's reviewer suggestions. Now repository maintainers can define exactly which people and teams need to review projects using code owners. This new feature automatically requests reviews from the code owners when a pull request changes any owned files.

To specify code owners, create a file named CODEOWNERS in the repository's root directory (or in .github/ if you prefer) with the following format:

# Lines starting with '#' are comments. # Each line is a file pattern followed by one or more owners. # These owners will be the default owners for everything in the repo. * @defunkt # Order is important. The last matching pattern has the most precedence. # So if a pull request only touches javascript files, only these owners # will be requested to review. *.js @octocat @github/js # You can also use email addresses if you prefer. docs/* docs@example.com